Written and tested by the MD Converter editorial team
How to Convert Markdown to Slide PDF with Marp
Learn how to structure a Marp slide deck, split slides, control density, handle images and code, and export Markdown to a presentation-ready PDF.
Decide what the deck must communicate
Converting Markdown into slides lets you reuse an outline and review changes as text. A long document split at arbitrary headings, however, is not automatically a useful presentation. Decide three things first:
- What the audience should take away
- The single point each slide should make
- Which detail belongs in spoken explanation or a separate handout
Build the deck around conclusions, evidence, and next actions. If every supporting detail is placed on the slide, the audience has to read instead of listen.
A minimal Marp deck
Marp converts Markdown into slide formats such as HTML, PDF, and PowerPoint. Its key difference from ordinary Markdown is that a horizontal rule, ---, separates slides. If PowerPoint is your target format, see why a Markdown-converted PPTX often isn't editable for the differences between export methods.
---
marp: true
theme: default
paginate: true
---
# Weekly sync
This week's conclusion
---
## Progress
- Released the new feature
- Reduced response time
---
## Next actions
1. Review usage
2. Choose the next improvement
The first block is front matter. marp: true identifies a Marp document, theme selects a theme, and paginate controls page numbers. Supported directives can depend on the rendering environment, so confirm the result in its actual preview.
Place slide breaks deliberately
Do not rely on heading levels alone. Explicit --- separators make the intended pacing easier to preserve. Start a new slide when:
- The topic changes.
- A conclusion and its evidence need separate attention.
- A table or diagram needs more space.
- You want to ask a question and pause.
Keep elements together when they must be understood at the same time, such as a chart and its conclusion. Think of one slide as one beat in the talk, not as one heading in the source document.
Reduce information density
Markdown written for a document often needs editing before it works on a screen.
| Document pattern | Slide adjustment |
|---|---|
| Background before conclusion | Put the conclusion in the heading |
| Long paragraph of conditions | Use a few short bullets |
| Table containing every metric | Keep only rows and columns needed for the point |
| Complete source listing | Show only the lines being discussed |
A fixed bullet count is not a universal rule. If the text must be made small just to fit, remove detail or split the slide.
Make images, tables, and code legible
Images
Small labels inside an image may be unreadable during screen sharing or projection. Crop empty space and enlarge the part being discussed. Relative image paths depend on the Markdown file's location. Remote images also make export dependent on network access, so keep critical assets with the deck when reproducibility matters.
Tables
Split a wide table instead of shrinking it until nobody can read it. Show the data needed for the comparison, and include its unit and reference date on the slide.
Code
Limit code to the lines the audience needs. Imports and unrelated error handling can usually move to a linked example or appendix. If an omission would change the meaning, label it clearly.
Adjust themes after the structure works
Starting with decoration can hide a content-density problem. Check the story with a built-in theme, then adjust typography, color, and spacing.
Marp can also use CSS themes. In a team project, version the theme and rendering configuration alongside the Markdown. Fonts, themes, and engine versions can change line wrapping, so use the same versions locally and in CI.
Export with Marp CLI
In an environment with Node.js and a supported browser, the one-off PDF command documented by Marp CLI is:
npx @marp-team/marp-cli@latest slide-deck.md --pdf
For a maintained project, install and pin a development dependency instead of following latest on every build, then run the same command through npm scripts and CI. Loading local images may require additional permission; do not grant broad file access to untrusted Markdown. Check the current requirements in the official Marp CLI README.
Export from a browser or editor
A no-CLI workflow follows the same review sequence:
- Load the Markdown.
- Confirm the slide count created by the
---separators. - Fix overflowing text, tables, code, and images.
- Save as PDF.
- Review every page in the saved file.
Before loading confidential material into a converter, check where the source is processed. Even a browser-side converter can contact other hosts for remote images or web fonts, so replace those assets with local files when necessary.
Presentation preflight
- Each title states the slide's point.
- You can explain the slide without reading its body aloud.
- Tables and code remain legible in screen sharing or projection.
- Images are present and sharp enough.
- Page numbers, date, and revision are correct.
- You tested page turns in full-screen view.
- Links work for the intended audience.
The main benefit of a Markdown slide workflow is not the conversion button; it is the ability to inspect the story as structured text. Build the pacing with ---, keep one point per slide, and apply visual polish only after the content fits.
Review the Markdown syntax guide for basic notation and the Markdown-to-PDF guide for document-style output.