A comprehensive guide to creating beautiful presentations with Marp CLI using Markdown.
npm installnpm run dev
# or
npm run watchThis starts a local server with live reload at http://localhost:8080
# Generate PDF
npm run build
# Generate HTML
npm run build:html
# Generate PowerPoint
npm run build:pptx
# Generate all formats
npm run export:all| Script | Description |
|---|---|
npm run dev |
Start development server with live reload |
npm run watch |
Same as dev (alias) |
npm run preview |
Preview without auto-reload |
npm run build |
Generate PDF output |
npm run build:html |
Generate HTML output |
npm run build:pptx |
Generate PowerPoint output |
npm run export:all |
Generate all formats (PDF, HTML, PPTX) |
npm run clean |
Remove generated files |
Use --- to separate slides:
# Slide 1
Content here
---
# Slide 2
More content---
marp: true
theme: default
paginate: true
size: 16:9
headingDivider: 2
---marp: true- Enable Marp processingtheme: default- Use built-in theme (default,gaia,uncover)paginate: true- Add page numberssize: 16:9- Aspect ratio (4:3,16:9,A4)headingDivider: 2- Auto-create slides from H2 headings
Add custom styles in the front matter:
style: |
section {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
h1 {
color: #ff6b6b;
font-weight: 600;
}Apply special layouts to individual slides:
<!-- _class: lead -->
# Title Slide
Centered content
---
<!-- _class: invert -->
# Inverted Colors
Dark background, light text<!-- _backgroundColor: "#123456" -->
# Colored Background
---

# Background Image
---

# Fitted Background
---

# Split Layout
Content on the right<div style="display: flex;">
<div style="flex: 1;">
### Left Column
- Point 1
- Point 2
</div>
<div style="flex: 1;">
### Right Column
- Point A
- Point B
</div>
</div><div class="highlight-box">
### Important Content
This content will be styled with custom CSS
</div>```mermaid
graph TD
A[Start] --> B[Process]
B --> C[End]
### Math Expressions
```markdown
$$
E = mc^2
$$
Inline math: $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$
- Use meaningful headings (H1 for slide titles, H2-H3 for sections)
- Keep bullet points concise
- Use visual hierarchy effectively
- Maintain consistent color scheme
- Use high contrast for readability
- Limit fonts to 2-3 families maximum
- Leave adequate white space
- One main idea per slide
- Use progressive disclosure
- Include clear call-to-actions
- End with strong conclusion
- Optimize images before embedding
- Use web-safe fonts when possible
- Test across different screen sizes
# Regular image

# Sized image

# Background image

# Background with positioning
deck/
βββ deck.md
βββ assets/
β βββ images/
β βββ logos/
β βββ diagrams/
βββ styles/
β βββ custom.css
βββ output/
βββ deck.pdf
βββ deck.html
βββ deck.pptx
Fonts not loading:
style: |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;700&display=swap');
section { font-family: 'Inter', sans-serif; }Images not displaying:
- Use
--allow-local-filesflag - Check file paths are relative to markdown file
- Ensure images are web-compatible formats (JPG, PNG, SVG)
CSS not applying:
- Verify CSS syntax in style block
- Use browser dev tools to debug
- Check CSS specificity
- Live Reload: Use
npm run devfor instant feedback - Browser DevTools: Inspect generated HTML for debugging
- PDF Issues: Test HTML output first, then generate PDF
- Performance: Use
npm run previewto test without auto-reload
# Welcome to Marp!
- Easy to write
- Beautiful output
- Multiple formats
---
## Features
| Feature | Benefit |
|---------|---------|
| Markdown | Simple syntax |
| CSS | Custom styling |
| Export | Multiple formats |<div class="highlight-box">
### π― Key Metrics
<div class="metrics">
<div class="metric">
<span class="metric-number">25M</span>
<span class="metric-label">Users</span>
</div>
<div class="metric">
<span class="metric-number">$90B</span>
<span class="metric-label">Revenue</span>
</div>
</div>
</div>- Edit
deck.mdfor content changes - Modify styles in the front matter
- Test with
npm run dev - Build final outputs with
npm run export:all
Happy presenting! π