| name | marp |
| description | Creates professional presentation slides using Marp (Markdown Presentation Ecosystem). Use when user asks to create a presentation, slides, slide deck, or mentions Marp. |
Marp Presentation Creation
Create professional presentation slides using Marp, which converts Markdown into beautiful HTML/CSS/PDF presentations.
Core Syntax
Basic Structure
---
marp: true
theme: default
paginate: true
---
# Title Slide
---
## Regular Slide
Content here
---
## Another Slide
More content
Key Points:
- Use
---(horizontal ruler) to separate slides - First
---block contains YAML frontmatter with global directives - Each subsequent
---creates a new slide - Based on CommonMark Markdown specification
Directives
Global Directives (Apply to entire deck)
Define in YAML frontmatter at the start:
---
marp: true
theme: default # Built-in: default, gaia, uncover
size: 16:9 # Aspect ratio (16:9, 4:3)
paginate: true # Show page numbers
header: 'Header text' # Deck-wide header
footer: 'Footer text' # Deck-wide footer
style: | # Custom CSS
section {
background-color: #fff;
}
headingDivider: 2 # Auto-split at heading level
math: katex # Math typesetting library
title: 'Presentation Title'
author: 'Author Name'
---
Local Directives (Apply to specific slides)
Use HTML comments for slide-specific settings:
<!-- _paginate: false -->
# Title Slide
(no page number on this slide)
---
<!--
_backgroundColor: #123456
_color: white
-->
## Slide with Custom Colors
Scoped vs Persistent:
_directive(with underscore) = applies ONLY to current slidedirective(no underscore) = applies to current and ALL subsequent slides
Common Local Directives
| Directive | Purpose | Example |
|---|---|---|
paginate |
Show page number | <!-- paginate: true --> |
header |
Slide header | <!-- header: 'Section 1' --> |
footer |
Slide footer | <!-- footer: '' --> (reset) |
class |
CSS class | <!-- class: lead --> |
backgroundColor |
Background color | <!-- _backgroundColor: #e1f5fe --> |
backgroundImage |
Background image | <!-- backgroundImage: url('img.jpg') --> |
color |
Text color | <!-- _color: #333 --> |
Built-in Themes
Marp includes three themes:
- default - Clean, professional appearance
- gaia - Modern design with accent colors
- uncover - Minimalist presentation style
---
theme: gaia
---
Advanced Features
Image Syntax
 # Regular image
 # Background image
 # Split background (left)
 # Split background (right, 40% width)
 # Fit background
 # Contain background
 # Sized image
 # Height-specified image
Multiple Backgrounds



Math Typesetting
Enable with math: katex in frontmatter:
Inline math: $E = mc^2$
Block math:
$$
\int_0^\infty f(x)dx
$$
Auto-Scaling
Text automatically scales to fit slides. Force specific sizes:
<!-- _class: lead -->
# Large Centered Text
Custom Styling
Inject CSS via style directive:
---
style: |
section {
font-family: 'Arial', sans-serif;
}
h1 {
color: #2196f3;
}
---
Workflow
- Create markdown file (e.g.,
presentation.md) - Add YAML frontmatter with global directives
- Write content using
---to separate slides - Export to HTML, PDF, or PowerPoint using Marp CLI or VS Code extension
Best Practices
- One idea per slide: Keep slides focused
- Use headings:
#for title slides,##for content slides - Leverage directives: Use
_paginate: falseon title/section slides - Background images: Use
![bg fit]for full-screen imagery - Split layouts: Combine
![bg left]with content on right - Consistent styling: Define global styles in frontmatter
- Test pagination: Ensure page numbers appear where intended
Common Patterns
Title Slide
<!-- _paginate: false -->
# Presentation Title
## Subtitle
Author Name
Date
Section Divider
<!-- _class: lead -->
<!-- _paginate: false -->
# Section Title
Content Slide with Image

## Topic
- Point 1
- Point 2
- Point 3
Two-Column Layout
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;">
<div>
### Left Column
- Item 1
- Item 2
</div>
<div>
### Right Column
- Item A
- Item B
</div>
</div>
Output Formats
Export presentations using:
- HTML: Self-contained, works in any browser
- PDF: Shareable document format
- PowerPoint: PPTX for compatibility
References
See examples.md for complete presentation templates and advanced patterns.