Skip to content

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/deck-starter/ (slides.md) for the PDF, sites/www/stories/motion/bridge.md for a deck rendered as a film, and examples/motion-hello/ (hello.story.md) 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/motion-render plus ffmpeg on the system.

For PDF export alone (recit export --to pdf), install Playwright and its Chromium browser in the project:

TerminalBash
pnpm add -D playwright && npx playwright install chromium

To also render motion stories to MP4 (recit render), install @recit/motion-render alongside Playwright:

TerminalBash
pnpm add -D @recit/motion-render playwright && npx playwright install chromium

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/motion-render on demand: if @recit/motion-render, 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/deck-starter/ (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:

TerminalBash
npx recit export --to pdf slides.md -o slides.pdf

--to pdf is the default target of recit export, and -o, --output <file> 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/deck-starter/slides.md, the export finishes in about 12 s and prints:

Code
📄 Exported PDF: 3 page(s) (64 KB) to …/slides.pdf

Pass --notes to add a notes page after each slide, or --color-mode light / --color-mode dark to choose the color mode. You can set the same options in the story front matter (pdf: { notes: true, colorMode: light }), 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-manifest is passed) with one entry describing the generated PDF:

Code
{"kind": "pdf", "path": "slides.pdf", "origin": {"type": "story", "format": "deck"}, "source": "slides.md", "pages": 3, …}
  • "kind": "pdf" and "path": "slides.pdf" identify the exported file;
  • "origin": { "type": "story", "format": "deck" } and "source": "slides.md" link it back to the deck story;
  • "pages": 3 records 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>.preview.png (slides.preview.png here) and records preview: { path, width, height } on the PDF entry in exports.json (path relative to the manifest folder). On an encrypted site (access.mode: "encrypted"), 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: motion. Save it as talk.md:

Markdowntalk.md
--- title: Lorem ipsum, deck and film description: "One Markdown source rendered as slides and as a film." aspectRatio: 16:9 theme: saas-product --- --- id=open layout=cover Lorem ipsum # Dolor sit amet. --- id=promise Write it **once**, tell it everywhere. --- id=chapter layout=section ## Consectetur adipiscing --- id=steps ## Sed do eiusmod - Tempor incididunt - Ut labore et dolore - Magna aliqua
TerminalBash
npx recit render talk.md -o talk.mp4

It renders in about 18 s to a 1920×1080 MP4 (345 frames @ 30 fps), 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: motion) uses the motion blocks directly, with their timing and voice-over. Copy examples/motion-hello/hello.story.md into hello.story.md:

Markdownhello.story.md
--- title: Lorem ipsum, the film description: A vertical film in pure Markdown, warm-editorial theme format: motion aspectRatio: 9:16 theme: warm-editorial --- --- id=open Lorem ipsum # Dolor sit amet. --- id=promise One source. Two **renderings**. :::notes Lorem ipsum dolor sit amet, consectetur adipiscing elit. ::: --- id=chapter ## 01 · Consectetur --- id=steps ## Adipiscing elit - Sed do eiusmod - Tempor incididunt - Ut labore et dolore --- type=stat id=proof hold=1 # 30s magna aliqua _ut enim ad minim veniam_
  • The front matter sets format: motion, aspectRatio: 9:16, and theme: warm-editorial.
  • Each --- separator starts a motion scene (open, promise with speaker :::notes, chapter, steps, and proof with type=stat and hold=1) that storyToFilm compiles into a motion block. You can check its scene and total duration with npx recit dur hello.story.md or preview it live in the browser with npx recit dev hello.story.md.

Render hello.story.md to hello.mp4 (-o, --output <path> accepts a .mp4 file or an output directory, defaulting to out/):

TerminalBash
npx recit render hello.story.md -o hello.mp4

recit render draws the film frame by frame in Chromium and encodes the video with ffmpeg. On hello.story.md, rendering takes about 27 s and prints:

Code
🎬 …/hello.mp4 (300.7 KB) · 1080×1920 · 511 frames @ 30 fps

followed by a line reporting hello.vtt (1 captions) and hello.txt (transcript). Next to hello.mp4, the command writes:

  • hello.mp4 — the 1080×1920 (9:16) MP4 video (511 frames @ 30 fps);
  • hello.vtt — the WebVTT captions file (1 captions, from the :::notes block);
  • 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-story, tiktok, instagram-post, square, or linkedin-post, comma-separated, with a folder as -o, out/ by default) to render one <story>.<preset>.mp4 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

  1. Running npx recit export --to pdf slides.md -o slides.pdf exits with 0 and writes a 3-page slides.pdf.
  2. Running npx recit render talk.md -o talk.mp4 exits with 0 and writes a 1920×1080 talk.mp4; npx recit render slides.md names the grid scene it cannot render.
  3. Running npx recit render hello.story.md -o hello.mp4 exits with 0 and writes a 1080×1920 hello.mp4 (511 frames @ 30 fps), with hello.vtt (1 captions) and hello.txt next to it.
  4. Each export is listed in the exports.json written next to it: slides.pdf with "kind": "pdf" and "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, and recit validate.
  • Write and present your first deck — create slides.md from examples/deck-starter, preview with recit dev, and build dist/.