Markdown cheatsheet · Markdown to PDF
Markdown to PDF
Four routes that reliably work. Pick by how often you convert and how much control you need over the result.
1. An editor that exports PDF
The simplest route for notes and everyday documents. maxdown opens your .md file (or a whole folder of them) and exports a styled PDF directly: no toolchain to install, no account, free on macOS, Windows and Linux.
2. Pandoc, the command line workhorse
The right tool when you convert often or want to script it. Install it from pandoc.org, then:
pandoc notes.md -o notes.pdf
Pandoc's default PDF engine is LaTeX, so this needs a LaTeX distribution installed (TeX Live, MacTeX or MiKTeX).
No LaTeX? Add --pdf-engine=typst, --pdf-engine=weasyprint or --pdf-engine=wkhtmltopdf to use a lighter engine you have installed instead.
Of the alternative engines, Typst is a fast, modern choice and a much smaller install than a full LaTeX distribution.
3. VS Code
If you already write in VS Code, install the Markdown PDF extension (by yzane). Right-click in the editor and choose markdown-pdf: Export (pdf); it renders through Chromium, so the PDF looks like the preview. Good if you live in VS Code and do not want a separate tool.
4. Print to PDF from any preview
Zero installs: render the file anywhere you can see it (the VS Code preview, GitHub, any markdown editor), open the print dialog with Cmd+P or Ctrl+P, and choose Save as PDF. Fine for a quick one-off, but you get little control over margins, headers and where pages break.
Online converters
Plenty of websites convert markdown to PDF in the browser. They are fine for non-sensitive documents; do not upload private notes, contracts or anything containing credentials, because the file passes through someone else's server.
<div style="page-break-after: always"></div>. With pandoc's default LaTeX engine, put a raw \newpage on its own line instead.