Markdown to PDF (Fast & Standalone)
Instant, high-fidelity Markdown to PDF exporter for Visual Studio Code.
Zero server required. Zero headless browsers (no Puppeteer or Chrome). 100% offline & client-side.
⚡ Highlights
- Blazing Fast: Exports documents to PDF in milliseconds directly inside VS Code.
- 100% Private & Client-Side: No cloud APIs, no telemetry, and no heavy external dependencies like Puppeteer or Chromium.
- Interactive Front-Matter & Cover Wizard: Click "Configure Cover & Front-Matter" in the sidebar or run
md2pdf.insertFrontMatter to visually design publication covers, headers, footers, and metadata without memorizing YAML syntax.
- Pre-Designed Cover Page Templates: First-class cover page designs (
modern, corporate, academic, minimal) with title banners, subtitle, author, organization, version, and date.
- Dynamic Header & Footer Interpolation: Interpolates front-matter variables directly into headers and footers (
{{title}}, {{author}}, {{date}}, {{version}}, {{organization}}, alongside {page} and {pages}).
- Native PDF Bookmarks & Outline Tree: Automatically compiles H1–H6 heading hierarchy into native PDF viewer bookmarks (Acrobat Reader, Chrome, Apple Preview).
- Watermark Presets & Custom Styling: Curated watermark presets (
DRAFT, CONFIDENTIAL, SAMPLE, INTERNAL USE ONLY) with custom rotation angles, colors, and opacity.
- PDF Encryption & Password Security: Secure PDFs with user opening passwords (
userPassword), master owner passwords (ownerPassword), and printing/copying permission restrictions.
- Live PDF Preview Panel with Synchronized Scrolling: Side-by-side live preview (
Cmd+Alt+V) that renders actual PDF pages, auto-refreshes on save, and smoothly synchronizes scroll position as you scroll in your Markdown document.
- Instant 1-Touch Export: Skip save dialogs (
promptForSavePath: false) and auto-open PDFs immediately in your default viewer (autoOpen: true).
- Multi-File Batch Export: Select multiple Markdown files in File Explorer and export them all in a single batch with a live progress bar.
- Automatic Table of Contents: Generates an interactive TOC after the cover page with click navigation, or use
[TOC] / [toc] anywhere (supported in both PDF export and VS Code Markdown Preview).
- Responsive & Protected Tables: Table columns wrap long URLs and maintain clean proportions so tables never overflow the page.
- Dedicated Activity Bar Panel: Interactive control panel on your left sidebar to customize theme, page size, margins, watermark presets, and passwords on the fly.
- Embedded Vector Icons: Native rendering for task list checkboxes (
- [x]), status badges, and 50+ vector icons.
- Universal Image & SVG Scaling: Full support for percentage widths (
width="20%") and fixed sizes (width="200px") for both raster images and SVGs.
- GitHub-Style Callouts: Full support for
> [!NOTE], > [!TIP], > [!IMPORTANT], > [!WARNING], and > [!CAUTION] rendered into accent-bordered cards in both preview and PDF.
- Footnotes & Endnotes:
[^1] reference citations with auto-numbered superscripts and clickable endnotes list.
- PrismJS Syntax Highlighting: Colorizes code blocks (
js, ts, py, bash, json, sql, rust, go, etc.) in printed PDFs with crisp, publication-ready token styles.
- Built-in PlantUML & Diagram Engine: Render Sequence, Activity, Class, State, Component, MindMap, WBS, and Gantt diagrams directly from fenced code blocks or raw
@startuml ... @enduml tags.
⌨️ How to Use
Open any Markdown (.md) file, then export using any of these methods:
- Keyboard Shortcut:
- Mac:
Cmd + Alt + P
- Windows / Linux:
Ctrl + Alt + P
- Activity Bar Panel:
- Click the PDF icon on the left Activity Bar.
- Customize your theme, margins, and page settings, then click "Export to PDF" (you can also click "Save Current as Defaults").
- Editor Title Bar:
- Click the PDF icon in the top right corner of the editor title bar.
- Context Menus:
- Right-click anywhere in your Markdown editor and select "Export Markdown to PDF".
- In the left File Explorer, hover over any
.md file and click the inline PDF icon.
- Multi-File Batch Export:
- In the left File Explorer, hold
Cmd (Mac) or Ctrl / Shift (Windows/Linux) and select multiple .md files.
- Right-click and choose "Export Markdown to PDF" to convert all selected files at once without multiple save dialogs.
💡 Markdown Power Features
1. Custom Page Breaks
Force page breaks at specific sections using standard HTML syntax:
<div style="page-break-before: always;"></div>
2. Proportional Image & SVG Scaling
Scale your images and SVGs easily using HTML attributes or Markdown titles:
- HTML syntax:
<img src="image.svg" width="30%"> or <img src="photo.png" width="250px">
- Markdown syntax:
 or 
3. Automatic Table of Contents & Cover Page Ordering
When a cover page (cover: modern | corporate | academic | minimal) and tableOfContents: true are configured in your document front-matter, Markdown2Pdf formats the preview and PDF in logical sequence:
- Page 1: Cover Page (styled with title, subtitle, author, organization, date, and version).
- Page 2: Table of Contents (indexing all subsequent headings with direct section anchors).
- Page 3+: Document body sections.
Both the VS Code Built-in Markdown Preview and the exported PDF / Live PDF Preview reflect this Cover $\to$ TOC $\to$ Content layout. You can also place an explicit [TOC], [toc], [[toc]], or <!-- toc --> tag anywhere in your markdown.
---
cover: modern
tableOfContents: true
---
# Section 1
Content here...
4. Interactive Task Checkboxes & Icons
- [x] Completed task with vector checkmark
- [ ] In-progress item
5. Built-in PlantUML & Diagram Engine
Markdown to PDF features an integrated, fully offline PlantUML / ReViewer rendering engine supporting Sequence, MindMap, WBS, Class, Activity, State, Component, Use Case, and Gantt diagrams.
Supported Syntaxes:
- Fenced Code Blocks (
plantuml, puml, uml, mindmap, ```wbs):
```plantuml
@startuml
autonumber
Alice -> Bob : Authentication Request
Bob --> Alice : 200 OK (JWT)
@enduml
```
- Standalone Raw Blocks (
@startuml ... @enduml):
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml
Dual-Mode Rendering Architecture:
- VS Code Markdown Preview: Rendered using a dark-mode-optimized Tokyo Night palette with a transparent canvas and no outer bounding box, so diagrams blend seamlessly into your editor theme without jarring color mismatches. A subtle, right-aligned toolbar provides:
- Type Badge: Indicates diagram type (
SEQUENCE, MINDMAP, WBS, etc.).
<> Source Switch: Expandable toggle to inspect the raw PlantUML source code.
- Save SVG Icon: Instant download button to save the vector graphic.
- PDF Export: Compiles to high-contrast Classic white vector SVGs (
#ffffff canvas and publication-grade styling) so printed and exported documents maintain clean legibility on white PDF pages.
⚙️ Configuration Settings & Document Options
You can configure Markdown to PDF at two levels:
- Per-Document (YAML Front-Matter): Overrides settings specifically for the open markdown document. You can also generate this interactively using the Front-Matter Wizard (
md2pdf.insertFrontMatter or sidebar button).
- Global / Workspace Settings: Applies default export preferences across all documents in VS Code (
settings.json).
📝 1. Per-Document YAML Front-Matter
Place standard YAML front-matter (---) at the very top of your .md file to configure that document's export settings:
---
title: "Distributed Cloud Platform Architecture"
subtitle: "Technical Specification & High Availability Guidelines"
author: "Engineering Architecture Team"
organization: "Antigravity Cloud Infrastructure"
date: "October 2026"
version: "v2.5.0"
theme: modern
# Choose a Cover Page Template: modern | corporate | academic | minimal
cover: modern
# Dynamic Header & Footer with automatic variables:
# Available variables: {{title}}, {{author}}, {{date}}, {{version}}, {{organization}}, {page}, {pages}
header:
text: "{{title}} | Page {page} of {pages}"
alignment: right
skipPages: 1
footer:
text: "Confidential • {{organization}} • Version {{version}} • {{date}}"
alignment: center
skipPages: 1
# Watermark Preset (DRAFT, CONFIDENTIAL, SAMPLE, INTERNAL USE ONLY) or custom object
watermark: CONFIDENTIAL
# PDF Password Encryption & Permissions (Optional)
userPassword: "openPassword123"
ownerPassword: "masterSecret456"
permissions:
printing: highResolution
copying: false
modifying: false
# Automatic clickable Table of Contents
tableOfContents: true
---
[TOC]
# System Overview
Here is our overview flow[^1].
> [!NOTE]
> All services run inside secure VPCs with mutual TLS encryption.
> [!IMPORTANT]
> Database migrations must be executed during designated maintenance windows.
[^1]: See technical appendix for complete infrastructure sizing.
Front-Matter Properties:
| Key |
Type |
Default |
Description |
cover |
string \| object |
"" |
Cover page template: "modern", "corporate", "academic", "minimal" |
title |
string |
"" |
Document title (used in cover pages and {{title}} headers/footers) |
subtitle |
string |
"" |
Document subtitle or classification |
author |
string |
"" |
Author name or organization team |
organization |
string |
"" |
Company or institution name (interpolated in {{organization}}) |
version |
string |
"" |
Document version (interpolated in {{version}}) |
date |
string |
"" |
Release date (interpolated in {{date}}) |
theme |
string |
"modern" |
Theme preset: "modern", "github", "academic", "minimal", "default" |
pageSize |
string |
"A4" |
Document paper size: "A4", "LETTER", "LEGAL" |
pageOrientation |
string |
"portrait" |
Page orientation: "portrait" or "landscape" |
pageMargins |
array \| number |
[40, 50, 40, 50] |
Margins in PDF points: [left, top, right, bottom] |
tableOfContents |
boolean |
true |
Insert Table of Contents immediately after cover page (or at explicit [TOC]) |
tableWidth |
string |
"75%" |
Maximum table width percentage for large tables (e.g. "80%") |
header |
string \| object |
"" |
Running header (supports {{title}}, {{organization}}, {page}, {pages}) |
footer |
string \| object |
"Page {page} of {pages}" |
Running footer (supports {{version}}, {{date}}, {page}, {pages}) |
watermark |
string \| object |
"" |
Presets ("DRAFT", "CONFIDENTIAL", "SAMPLE", "INTERNAL USE ONLY") or { text, color, opacity, angle } |
userPassword |
string |
"" |
Password required to open/view the PDF |
ownerPassword |
string |
"" |
Master password required to modify document permissions |
permissions |
object |
{} |
Fine-grained permissions (printing, copying, modifying, annotating) |
skipPages |
number |
0 |
Number of initial pages to suppress headers/footers on (auto-set to 1 when cover is present) |
🛠 2. VS Code Global & Workspace Settings (settings.json)
Customize your default preferences in VS Code Settings (Cmd+, or Ctrl+, ➔ search md2pdf):
| Setting |
Type |
Default |
Description |
md2pdf.theme |
string |
"modern" |
Preset theme (modern, github, academic, minimal, default) |
md2pdf.pageSize |
string |
"A4" |
Document paper size (A4, LETTER, LEGAL) |
md2pdf.pageOrientation |
string |
"portrait" |
Page orientation (portrait, landscape) |
md2pdf.pageMargins |
string |
"standard" |
Margin spacing (standard: 40pt, compact: 20pt, spacious: 60pt) |
md2pdf.tableOfContents |
boolean |
true |
Automatically insert a Table of Contents after initial page |
md2pdf.tableWidth |
string |
"75%" |
Maximum table width percentage for large tables |
md2pdf.header |
string |
"" |
Running header text (supports {page}, {pages}, and {{title}}) |
md2pdf.footer |
string |
"Page {page} of {pages}" |
Running footer text (supports {page}, {pages}, {{version}}, {{date}}) |
md2pdf.watermark |
string |
"" |
Optional background watermark (presets: DRAFT, CONFIDENTIAL, SAMPLE, INTERNAL USE ONLY) |
md2pdf.autoOpen |
boolean |
false |
Automatically open exported PDF in default viewer immediately |
md2pdf.promptForSavePath |
boolean |
true |
Show save dialog (set to false for instant export next to source file) |
Example settings.json:
{
"md2pdf.theme": "modern",
"md2pdf.pageSize": "A4",
"md2pdf.pageMargins": "standard",
"md2pdf.tableWidth": "80%",
"md2pdf.footer": "Page {page} of {pages}",
"md2pdf.autoOpen": true,
"md2pdf.promptForSavePath": false
}
You can preview how your document will look in PDF form side-by-side with your Markdown editor:
- Shortcut: Press
Cmd + Alt + V (Mac) or Ctrl + Alt + V (Windows / Linux).
- Editor Title Bar: Click the Live PDF Preview icon in the top-right toolbar.
- One-Directional Synchronized Scrolling: As you scroll through your Markdown file in the editor, the PDF preview smoothly follows your position to align with your active section.
- Continuous Multi-Page Flow: Pages are rendered sequentially with high-DPI crisp vector text.
- Auto-Refresh on Save: The preview automatically re-compiles whenever you save your Markdown document (
Cmd+S).
📑 Native PDF Bookmarks / Outline Hierarchy
All heading tags (# through ######) are automatically parsed and injected into the binary PDF's native Outline Dictionary. When users open your exported document in Adobe Acrobat, Apple Preview, Chrome, or Edge, the document navigation sidebar displays a clickable hierarchical bookmarks tree.
💬 Support & Inquiries
| |