Code to PDF

Markdown to PDF: Convert .md Files Into Beautiful Documents

Markdown is great for writing, but PDF is great for sharing. Here are 6 ways to convert .md files into polished, properly-formatted PDFs — with screenshots and a quality comparison.

H By Houcine Published May 17, 2026 8 min read

Markdown has quietly taken over technical writing. README files, GitHub issues, Notion pages, internal wikis, documentation, blog drafts, meeting notes — all Markdown. It's a great format to write in: minimal syntax, fast, and editor-agnostic.

But it's not always a great format to share. A raw .md file is plain text. Open it in Notepad and the headings are just lines starting with hash marks. The links are full URLs. The tables are rows of pipes and dashes. None of the structure that makes Markdown lovely is visible until something renders it.

This is where Markdown-to-PDF conversion shines: it takes your .md source and produces a beautiful, styled document with proper headings, formatted tables, syntax-highlighted code blocks, and clickable links. Let's walk through six ways to do it.

When to convert Markdown to PDF

Method 1: Online Markdown to PDF converter

Quickest path: drop your .md file into FixMyPDF's Markdown to PDF tool. It supports standard Markdown plus GitHub Flavored Markdown (GFM) extensions: tables, task lists, strikethrough, autolinks, and fenced code blocks with syntax highlighting for 100+ languages.

Best for: any single-file conversion. Free, no install, no watermark.

Method 2: Pandoc (the universal converter)

Pandoc is the Swiss Army knife of document conversion. To convert Markdown to PDF:

pandoc document.md -o document.pdf \
  --pdf-engine=xelatex \
  --highlight-style=tango \
  -V geometry:margin=2cm \
  -V mainfont="Times New Roman"

Pandoc gives you total control over fonts, page sizes, headers, footers, table of contents, bibliography, and citations. The trade-off is setup: you need a LaTeX engine installed (XeLaTeX or LuaLaTeX).

Best for: academic papers, books, anything that benefits from professional typography.

Method 3: VS Code + "Markdown PDF" extension

Install the "Markdown PDF" extension by yzane. Open your .md file, right-click, and choose "Markdown PDF: Export (pdf)". The output uses VS Code's Markdown preview styling, which is clean and professional out of the box.

Best for: daily workflow when you already have VS Code open. Fully offline.

Method 4: Typora or Obsidian export

If you write Markdown in a dedicated app like Typora, Obsidian, or iA Writer, they all have built-in PDF export with beautiful default styling. Typora is particularly nice — the WYSIWYG editing means you can see exactly what the PDF will look like as you write.

Best for: writers who do most of their work in a Markdown editor anyway.

Method 5: GitHub-style render in browser

A surprisingly good approach for GitHub-flavored Markdown:

  1. Push your .md to a GitHub repo (or use a Gist)
  2. Open it in the browser
  3. Hit Ctrl+P / Cmd+P
  4. Choose "Save as PDF"

GitHub's rendered Markdown looks great printed. Tables, code blocks, and task lists all come through beautifully. Free, requires no install, just uses what's already in your browser.

Method 6: Programmatic with marked + Puppeteer (JS)

For automated workflows, render Markdown to HTML with marked, then print to PDF with Puppeteer:

const fs = require('fs');
const { marked } = require('marked');
const puppeteer = require('puppeteer');

const md = fs.readFileSync('post.md', 'utf8');
const html = `<!DOCTYPE html><html><head>
<link rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/github-markdown-css@5/github-markdown-light.css">
<style>body{padding:30px;max-width:800px;margin:auto;}</style>
</head><body class="markdown-body">${marked(md)}</body></html>`;

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setContent(html, { waitUntil: 'networkidle0' });
  await page.pdf({ path: 'post.pdf', format: 'A4' });
  await browser.close();
})();

This produces a GitHub-styled PDF that you can integrate into any Node.js workflow.

Need a quick Markdown to PDF conversion?

Drop your .md file into our free converter — rendered headings, tables, code blocks, and images. No watermark.

Open the Markdown to PDF tool →

Quality comparison

MethodSetupVisual qualityCustomization
Online (FixMyPDF)None★★★★Themes
Pandoc15 min★★★★★Total
VS Code extension1 min★★★★Themes
Typora / ObsidianAlready installed★★★★Themes
GitHub + printNone★★★★Limited
marked + Puppeteer30 min★★★★Total

Tips for great Markdown PDFs

FAQ

Will my code blocks be syntax-highlighted?

Yes, if you tag them with the language. ```python ... ``` gives you Python highlighting. Plain ``` renders as monospaced text with no colors.

How are images handled?

Online converters fetch absolute-URL images and embed them. Relative paths (./img/foo.png) require the images to be uploaded alongside the .md file or referenced via an absolute URL.

Does it support LaTeX math?

Most modern converters (including FixMyPDF's) render $...$ and $$...$$ as proper math via MathJax or KaTeX. Pandoc with the right pdf-engine is the gold standard for math-heavy documents.

What about footnotes?

Footnotes [^1] with definitions at the bottom of the file are supported in GFM and rendered correctly. They appear as proper PDF footnotes.

Can I include a table of contents?

Pandoc has --toc for an auto-generated table of contents. Online tools usually don't. If you need a ToC, generate the Markdown manually using a tool like markdown-toc and include it at the top of your file.

Wrap-up

Markdown is a fantastic writing format, but for sharing — especially with non-technical readers — PDF is the lingua franca. Pick the conversion method that matches your situation: online tool for quick one-offs, Pandoc for publication-grade output, VS Code for daily workflow.

The next time someone asks for "the README as a document I can read on the train", you'll know exactly what to do.

#markdown #md #documentation #tutorial
Code to PDF

Markdown to PDF: Convert .md Files Into Beautiful Documents

Markdown is great for writing, but PDF is great for sharing. Here are 6 ways to convert .md files into polished, properly-formatted PDFs — with screenshots and a quality comparison.

H By Houcine Published May 17, 2026 8 min read

Markdown has quietly taken over technical writing. README files, GitHub issues, Notion pages, internal wikis, documentation, blog drafts, meeting notes — all Markdown. It's a great format to write in: minimal syntax, fast, and editor-agnostic.

But it's not always a great format to share. A raw .md file is plain text. Open it in Notepad and the headings are just lines starting with hash marks. The links are full URLs. The tables are rows of pipes and dashes. None of the structure that makes Markdown lovely is visible until something renders it.

This is where Markdown-to-PDF conversion shines: it takes your .md source and produces a beautiful, styled document with proper headings, formatted tables, syntax-highlighted code blocks, and clickable links. Let's walk through six ways to do it.

When to convert Markdown to PDF

Method 1: Online Markdown to PDF converter

Quickest path: drop your .md file into FixMyPDF's Markdown to PDF tool. It supports standard Markdown plus GitHub Flavored Markdown (GFM) extensions: tables, task lists, strikethrough, autolinks, and fenced code blocks with syntax highlighting for 100+ languages.

Best for: any single-file conversion. Free, no install, no watermark.

Method 2: Pandoc (the universal converter)

Pandoc is the Swiss Army knife of document conversion. To convert Markdown to PDF:

pandoc document.md -o document.pdf \
  --pdf-engine=xelatex \
  --highlight-style=tango \
  -V geometry:margin=2cm \
  -V mainfont="Times New Roman"

Pandoc gives you total control over fonts, page sizes, headers, footers, table of contents, bibliography, and citations. The trade-off is setup: you need a LaTeX engine installed (XeLaTeX or LuaLaTeX).

Best for: academic papers, books, anything that benefits from professional typography.

Method 3: VS Code + "Markdown PDF" extension

Install the "Markdown PDF" extension by yzane. Open your .md file, right-click, and choose "Markdown PDF: Export (pdf)". The output uses VS Code's Markdown preview styling, which is clean and professional out of the box.

Best for: daily workflow when you already have VS Code open. Fully offline.

Method 4: Typora or Obsidian export

If you write Markdown in a dedicated app like Typora, Obsidian, or iA Writer, they all have built-in PDF export with beautiful default styling. Typora is particularly nice — the WYSIWYG editing means you can see exactly what the PDF will look like as you write.

Best for: writers who do most of their work in a Markdown editor anyway.

Method 5: GitHub-style render in browser

A surprisingly good approach for GitHub-flavored Markdown:

  1. Push your .md to a GitHub repo (or use a Gist)
  2. Open it in the browser
  3. Hit Ctrl+P / Cmd+P
  4. Choose "Save as PDF"

GitHub's rendered Markdown looks great printed. Tables, code blocks, and task lists all come through beautifully. Free, requires no install, just uses what's already in your browser.

Method 6: Programmatic with marked + Puppeteer (JS)

For automated workflows, render Markdown to HTML with marked, then print to PDF with Puppeteer:

const fs = require('fs');
const { marked } = require('marked');
const puppeteer = require('puppeteer');

const md = fs.readFileSync('post.md', 'utf8');
const html = `<!DOCTYPE html><html><head>
<link rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/github-markdown-css@5/github-markdown-light.css">
<style>body{padding:30px;max-width:800px;margin:auto;}</style>
</head><body class="markdown-body">${marked(md)}</body></html>`;

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setContent(html, { waitUntil: 'networkidle0' });
  await page.pdf({ path: 'post.pdf', format: 'A4' });
  await browser.close();
})();

This produces a GitHub-styled PDF that you can integrate into any Node.js workflow.

Need a quick Markdown to PDF conversion?

Drop your .md file into our free converter — rendered headings, tables, code blocks, and images. No watermark.

Open the Markdown to PDF tool →

Quality comparison

MethodSetupVisual qualityCustomization
Online (FixMyPDF)None★★★★Themes
Pandoc15 min★★★★★Total
VS Code extension1 min★★★★Themes
Typora / ObsidianAlready installed★★★★Themes
GitHub + printNone★★★★Limited
marked + Puppeteer30 min★★★★Total

Tips for great Markdown PDFs

FAQ

Will my code blocks be syntax-highlighted?

Yes, if you tag them with the language. ```python ... ``` gives you Python highlighting. Plain ``` renders as monospaced text with no colors.

How are images handled?

Online converters fetch absolute-URL images and embed them. Relative paths (./img/foo.png) require the images to be uploaded alongside the .md file or referenced via an absolute URL.

Does it support LaTeX math?

Most modern converters (including FixMyPDF's) render $...$ and $$...$$ as proper math via MathJax or KaTeX. Pandoc with the right pdf-engine is the gold standard for math-heavy documents.

What about footnotes?

Footnotes [^1] with definitions at the bottom of the file are supported in GFM and rendered correctly. They appear as proper PDF footnotes.

Can I include a table of contents?

Pandoc has --toc for an auto-generated table of contents. Online tools usually don't. If you need a ToC, generate the Markdown manually using a tool like markdown-toc and include it at the top of your file.

Wrap-up

Markdown is a fantastic writing format, but for sharing — especially with non-technical readers — PDF is the lingua franca. Pick the conversion method that matches your situation: online tool for quick one-offs, Pandoc for publication-grade output, VS Code for daily workflow.

The next time someone asks for "the README as a document I can read on the train", you'll know exactly what to do.

#markdown #md #documentation #tutorial