How to convert Markdown to PDF

Markdown was designed to be plain text that reads naturally and converts to HTML. Increasingly, people use it for everything: meeting notes, READMEs, blog drafts, even invoices. When the time comes to share that content with someone who doesn't read Markdown, you need a PDF. This guide explains the four free toolchains for converting Markdown to PDF, the trade-offs in styling, and the small things — code highlighting, page breaks, headers — that separate a draft-looking PDF from a publishable one.

  1. Pandoc + LaTeX (most flexible). On the command line: "pandoc input.md -o output.pdf". This pipes Markdown through LaTeX, producing a beautifully typeset PDF. Add "--pdf-engine=xelatex" for non-Latin scripts and "-V geometry:margin=1in" to control margins.
  2. VS Code with the Markdown PDF extension. Install "Markdown PDF" by yzane, open your .md, right-click → Markdown PDF: Export (pdf). The extension uses Chromium under the hood, so you get the same styling as your VS Code preview, including syntax-highlighted code blocks.
  3. Typora (one-click WYSIWYG). Typora is a Markdown editor that previews as you type. File → Export → PDF gives you the styled version of what you see on screen. Themes control fonts, spacing and code highlighting; the default looks publishable.
  4. GitHub README → Print to PDF. Push the .md to a GitHub repo, open the rendered README, Ctrl+P → Save as PDF. Quickest if your Markdown is already on GitHub. Style follows GitHub's renderer — clean and familiar.

Your files stay on your device

All processing happens locally in your browser using JavaScript. We never upload, store or look at your files.

What you can produce

A meeting summary email attachment

Write the notes in Markdown (## headings, - bullets, **bold**), pipe through Pandoc, share the PDF. Two minutes from raw notes to a polished one-pager.

A README that doubles as a printed manual

Same source file becomes a README on GitHub, a HTML page on docs.example.com, and a PDF you give to new hires. Single source, three audiences.

Technical documentation with code samples

Pandoc and the VS Code extension both highlight code blocks in the PDF. The output is suitable for printed handouts at workshops or course materials.

A blog draft for client review

Convert your draft Markdown to PDF and send for sign-off. Reviewers comment in PDF annotations; you fold the changes back into the .md and re-publish.

Markdown-to-PDF problems

Code blocks are unreadable

Default Pandoc styling can be plain. Pass a custom CSS file: "pandoc input.md --css=style.css -o out.pdf" via the WeasyPrint engine, or switch to the VS Code extension which uses Chromium and gives proper syntax colours out of the box.

Images don't appear

Markdown image links are relative. Make sure the path in ![alt](path/image.png) is correct relative to where the converter runs, or use absolute paths. Pandoc and VS Code Markdown PDF both follow standard relative resolution.

Page breaks happen mid-paragraph

Insert an HTML page break in the Markdown: <div style="page-break-after: always;"></div>. Pandoc, VS Code Markdown PDF and Typora all respect this.

Non-Latin characters appear as boxes

Default LaTeX fonts cover Latin only. Use "--pdf-engine=xelatex" with Pandoc and specify a font that covers your script: "-V mainfont=\"Noto Serif\"" for general Unicode coverage.

Headers and footers are missing

Pandoc supports "--variable=header-includes" with LaTeX commands. The VS Code extension has a settings.json key "markdown-pdf.headerTemplate" that takes HTML. Both let you put page numbers, document titles and dates on every page.

Frequently asked questions

After conversion, polish your PDF