Export a deck to PDF and MP4
Goal: export a three-slide Markdown deck to a tagged PDF with recit export, render a deck to
MP4 with recit render through the deck-to-motion bridge, and render a story written as a film,
with its captions, transcript and exports.json manifest.
The starting files for this guide live in examples/ (slides.md) for the PDF,
sites/ for a deck rendered as a film, and examples/
(hello.) for a story written as a film.
1. Install what the exports need
Both exports run headless Chromium through Playwright next to the recit CLI (@recit/cli), and
MP4 rendering adds @recit/ plus ffmpeg on the system.
For PDF export alone (recit export --), install Playwright and its Chromium browser in the
project:
Bash
To also render motion stories to MP4 (recit render), install @recit/ alongside
Playwright:
Bash
recit render assembles video frames with the system ffmpeg binary (brew install ffmpeg,
sudo apt install ffmpeg, or winget install ffmpeg, or set RECIT_FFMPEG to point at a binary).
recit render loads @recit/ on demand: if @recit/, Playwright, or
ffmpeg is missing, the CLI names what to install before drawing any frame.
2. Export the deck to PDF
Start in a folder containing slides.md from examples/ (the three-slide Markdown
deck from Write and present your first deck: cover, grid
with two :::card columns, and quote) and export it to slides.pdf:
Bash
--to pdf is the default target of recit export, and -o, -- sets the output file
path. Récit prints the deck through @recit/paged (Récit's Chromium print runner, preview): one
page per slide at the exact design size (1280×720, 1024×768, or 1080×1080 and 1080×1350 for
a square or portrait carousel), tagged for screen readers and with bookmarks.
On examples/, the export finishes in about 12 s and prints:
Code
Pass --notes to add a notes page after each slide, or --color- / --color-
to choose the color mode. You can set the same options in the story front matter
(pdf:), in settings.pdf of the JSON twin, or in deck.pdf of
recit.config; the command line wins over the story, and the story over the config.
3. Check the PDF and exports.json
Open slides.pdf in a PDF viewer: it has 3 pages — one for each slide of slides.md — at the
deck's design dimensions, with document bookmarks and accessibility tags.
Next to slides.pdf, recit export also writes exports.json (unless --no- is passed)
with one entry describing the generated PDF:
Code
"kind":and"pdf" "path":identify the exported file;"slides.pdf" "origin":and{ "type": "story", "format": "deck" } "source":link it back to the deck story;"slides.md" "pages": 3records the printed page count.
For a story PDF, recit export also writes a PNG preview of the first page next to the PDF as
<name>. (slides. here) and records preview: on
the PDF entry in exports.json (path relative to the manifest folder). On an
encrypted site (access.), no preview PNG
is written and preview is omitted.
4. Render a deck to MP4
recit render reads a deck through the deck-to-motion bridge of Récit 1.0: each
scene becomes a shot when its shape is in the closed table of the motion format (a cover is a
title, a section a chapter, a paragraph a statement, a bullet list a list). A scene outside
that table stops the render, and the message names it at its line. The deck of step 2 is one of
those: its second slide is a grid of two :::card columns, so npx recit render slides.md
refuses it (is not a valid motion film, then layout "grid" has no motion block at its line).
A deck that keeps to the table renders as it is, with no format:. Save it as talk.md:
talk.md
Bash
It renders in about 18 s to a 1920×1080 MP4 (345 frames @), the deck's 16:9 ratio, with
talk.vtt, talk.txt and exports.json next to it. The same file still runs as slides with
recit dev talk.md.
5. Render a story written as a film
A story written for the film (format:) uses the motion blocks directly, with their timing
and voice-over. Copy examples/ into hello.:
hello.story.md
- The front matter sets
format:,motion aspectRatio:, and9: 16 theme:.warm- editorial - Each
---separator starts a motion scene (open,promisewith speaker:::notes,chapter,steps, andproofwithtype=statandhold=1) thatstoryToFilmcompiles into a motion block. You can check its scene and total duration withnpx recit dur hello.or preview it live in the browser withstory.md npx recit dev hello..story.md
Render hello. to hello.mp4 (-o, -- accepts a .mp4 file or an output
directory, defaulting to out/):
Bash
recit render draws the film frame by frame in Chromium and encodes the video with ffmpeg. On
hello., rendering takes about 27 s and prints:
Code
followed by a line reporting hello. and hello.. Next to
hello.mp4, the command writes:
hello.mp4— the1080×1920(9:16) MP4 video (511 frames @);30 fps hello.vtt— the WebVTT captions file (1 captions, from the:::notesblock);hello.txt— the plain-text transcript of the film;exports.json— the export manifest recording the video entry with"kind":."mp4"
Pass --preset <name> (instagram-, tiktok, instagram-, square, or linkedin-,
comma-separated, with a folder as -o, out/ by default) to render one <story>. per
preset at its aspect ratio while checking the middle frame of every scene against the preset's safe
area. Pass --aspect <aspect> (16:9, 1:1, 9:16, or 4:5, comma-separated, with a folder as
-o too) to render one MP4 per ratio instead of the story's default, or alongside --preset to
check that the preset matches that ratio.
Check
- Running
npx recit export --exits withto pdf slides. md - o slides.pdf 0and writes a 3-pageslides.pdf. - Running
npx recit render talk.exits withmd - o talk.mp4 0and writes a1920×1080talk.mp4;npx recit render slides.mdnames thegridscene it cannot render. - Running
npx recit render hello.exits withstory. md - o hello.mp4 0and writes a1080×1920hello.mp4(511 frames @), with30 fps hello.vtt(1 captions) andhello.txtnext to it. - Each export is listed in the
exports.jsonwritten next to it:slides.pdfwith"kind":and"pdf" "pages": 3, each MP4 with"kind":."mp4"
See also
- Exporting — export a deck to a static site, a single self-contained HTML file, a PDF, slide images, or PowerPoint.
- Bridges — the deck-to-motion bridge of 1.0 and its table of layouts.
- Motion — motion blocks, scene timing, safe-area validation,
<StoryEmbed>, and MP4 rendering. - CLI reference — every option of
recit export,recit render,recit dur, andrecit validate. - Write and present your first deck — create
slides.mdfromexamples/, preview withdeck- starter recit dev, and builddist/.