Export Marp to PDF and PPTX with marp-cli
To export a Marp deck, install marp-cli and run marp deck.md --pdf for a PDF or marp deck.md --pptx for PowerPoint. PDF is exact and needs a browser on the machine; the default PPTX is a set of slide images, and the editable PPTX option needs LibreOffice, drops presenter notes and renders less faithfully. HTML needs nothing extra.
This guide lists the commands that matter for teaching, what each output preserves, and a script that exports every week of a course in one go.
Install marp-cli
Any one of these:
npm install -g @marp-team/marp-cli # global, any platform with Node
brew install marp-cli # macOS with Homebrew
npx @marp-team/marp-cli@latest deck.md # no install, runs the latest version once
PDF, PPTX and image exports need a browser: Chrome, Edge or Firefox installed on the same machine. HTML export does not.
Export to PDF
marp week3-slides.md --pdf
marp week3-slides.md -o week3-slides.pdf # same, output name given
PDF is the format to bring to a lecture hall: it renders exactly what the preview shows, fonts embedded, one page per slide, and it opens on any machine. Two flags worth knowing:
--allow-local-fileswhen the deck references images by local path and the conversion complains about them.--pdf-notesto include presenter notes as PDF annotations, so the notes travel with the file.
Export to PPTX
marp week3-slides.md --pptx
The default PPTX places one rendered image of each slide on each PowerPoint slide. It looks exactly like the PDF and it opens in PowerPoint and Keynote, but the text is not editable: it is a picture. Presenter notes are carried over as PowerPoint notes in this mode, which makes it a good format for a co-lecturer who presents from PowerPoint and wants your notes.
Editable PPTX: what it costs
marp week3-slides.md --pptx --pptx-editable
This produces real text boxes that a colleague can edit. The trade-offs, from marp-cli's own documentation:
- it needs LibreOffice Impress installed in addition to the browser;
- slide reproduction is lower: custom themes, layered backgrounds and fine positioning may come out differently;
- presenter notes are not supported in this mode;
- complex themes can make the conversion fail.
A practical rule: export the editable PPTX only when someone must edit in PowerPoint, and keep the Markdown as the source of truth. If they send edits back, fold them into the Markdown rather than maintaining two decks.
Export to HTML
marp week3-slides.md # writes week3-slides.html
marp week3-slides.md --html # also allows raw HTML inside the Markdown
HTML is self-contained and presentable in a browser, with keyboard navigation. It is the right format for putting a deck on a course page; students can open it on any device. Note that --html (the flag that enables raw HTML in Markdown) is distinct from HTML output, which is the default.
Export the notes
marp week3-slides.md --notes # writes week3-slides.txt
Writes the presenter notes as plain text, one block per slide. Useful for a printed cheat sheet or for pasting into the instructor guide.
Watch, preview and serve while writing
marp -w week3-slides.md # rebuild on every save
marp -p week3-slides.md # open a preview window
marp -s ./course # serve a folder of decks on http://localhost:8080
-s is convenient for a course folder: every Markdown file becomes a browsable deck. Set PORT to change the port.
Use your theme
marp week3-slides.md --theme lecture.css --pdf
marp week3-slides.md --theme gaia --pdf
A custom CSS theme is passed by path; a built-in one by name. With a theme file the front matter still needs theme: lecture (the name from the /* @theme lecture */ comment in the CSS). How to write one is in the Marp tutorial for teaching.
Export a whole course
A course has many decks; export them together so the PDFs match the Markdown at the same commit:
#!/usr/bin/env bash
# From the course folder: export every week's deck to PDF next to it.
set -euo pipefail
for deck in week*/week*-slides.md; do
marp "$deck" --theme themes/lecture.css --pdf --allow-local-files -o "${deck%.md}.pdf"
done
Run it before the term starts and again whenever a deck changes; commit the PDFs if students download them from the repository, or ignore them if they are built on a server.
What each format keeps
| Format | Layout fidelity | Editable text | Presenter notes | Needs |
|---|---|---|---|---|
| exact | no | with --pdf-notes, as annotations |
browser | |
| PPTX (default) | exact (images) | no | yes | browser |
PPTX --pptx-editable |
approximate | yes | no | browser + LibreOffice |
| HTML | exact | no (edit the Markdown) | in presenter view | nothing |
--notes text |
n/a | yes | only the notes | nothing |
Where Lecture Studio fits
Lecture Studio writes and previews Marp decks and presents them, but it does not export PDF itself. The export is marp-cli, run from the terminal on the course folder as above; the app keeps the Markdown and the sources in that folder, so the script finds them where they are. It runs on macOS and needs an Oberik project key for the assistant.
FAQ
Do I need a browser installed to export Marp to PDF?
Yes. marp-cli renders PDF, PPTX and images through Chrome, Edge or Firefox found on the machine. HTML output needs no browser.
Why is the text in my Marp PPTX not editable?
The default PPTX export places a rendered image of each slide. Use --pptx-editable for real text boxes; it needs LibreOffice and drops presenter notes.
Can I export presenter notes from Marp?
Yes: marp deck.md --notes writes them as a text file, --pdf-notes attaches them to the PDF, and the default PPTX export carries them as PowerPoint notes.
How do I export all decks in a folder?
Loop over the files in a shell script and call marp-cli for each, as in the course script above, or serve the folder with marp -s while writing.