md2pdf — Markdown to PDF Converter
Convert Markdown to beautiful, professional PDFs with full Mermaid diagram support.
✨ Features
| Feature |
Description |
| 📊 Mermaid Diagrams |
Flowcharts, sequence diagrams, Gantt charts, ER diagrams, and more |
| 📄 Cover Pages |
Professional title pages with logo, author, version, and confidential badge |
| 📑 Table of Contents |
Auto-generated, numbered, with clickable links |
| 🎨 4 Themes |
GitHub, Professional, Minimal, Academic |
| 💻 5 Code Themes |
GitHub, Monokai, Dracula, One Dark, GitHub Dark |
| 🔢 Line Numbers |
Optional line numbers for code blocks |
| 💧 Watermarks |
Configurable text watermarks (DRAFT, CONFIDENTIAL, etc.) |
| 📐 Math Support |
KaTeX equations (inline and block) |
| 📖 Page Numbers |
Multiple formats (numeric, Page X of Y) |
🚀 Quick Start
- Install from VS Code Marketplace
- Open any
.md file
- Press Cmd+Shift+E (Mac) or Ctrl+Shift+E (Windows)
- PDF is created in the same folder!
Other Ways to Export
- Status Bar: Click the
PDF button when editing Markdown
- Context Menu: Right-click → "Export to PDF"
- Command Palette: Cmd+Shift+P → "md2pdf: Export to PDF"
⚙️ Configuration
Option 1: VS Code Settings
Open Settings (Cmd+,) and search for "md2pdf":
| Setting |
Default |
Description |
md2pdf.theme |
github |
Document theme |
md2pdf.codeTheme |
github |
Syntax highlighting theme |
md2pdf.coverPage |
false |
Enable cover page |
md2pdf.coverTitle |
"" |
Cover page title |
md2pdf.coverSubtitle |
"" |
Cover page subtitle |
md2pdf.coverAuthor |
"" |
Cover page author |
md2pdf.coverOrganization |
"" |
Organization name |
md2pdf.coverLogo |
"" |
Logo path or URL |
md2pdf.coverVersion |
"" |
Version number |
md2pdf.coverConfidential |
false |
Show CONFIDENTIAL badge |
md2pdf.toc |
false |
Generate table of contents |
md2pdf.tocTitle |
"Table of Contents" |
TOC heading |
md2pdf.tocMaxLevel |
3 |
TOC depth (1-6) |
md2pdf.watermark |
"" |
Watermark text |
md2pdf.watermarkOpacity |
0.08 |
Watermark opacity |
md2pdf.showPageNumbers |
true |
Show page numbers |
md2pdf.showLineNumbers |
false |
Line numbers in code |
md2pdf.pageSize |
A4 |
Page size |
Option 2: YAML Frontmatter
Add configuration directly in your Markdown file:
---
title: My Document
theme: professional
coverPage: true
coverTitle: Project Documentation
coverSubtitle: Technical Guide v2.0
coverAuthor: Your Name
coverOrganization: Your Company
coverLogo: ./images/logo.png
toc: true
tocTitle: Contents
watermark: DRAFT
codeTheme: monokai
showLineNumbers: true
---
Option 3: Config Files
- Create: Cmd+Shift+P → "md2pdf: Create Config File"
- Export: Cmd+Shift+P → "md2pdf: Export with Config"
📊 Mermaid Diagram Support
All Mermaid diagram types are fully supported:
- Flowcharts — Process flows, decision trees
- Sequence Diagrams — API calls, interactions
- Gantt Charts — Project timelines
- Class Diagrams — UML structures
- State Diagrams — State machines
- ER Diagrams — Database schemas
- Pie Charts — Data visualization
- Git Graphs — Branch visualization
🎨 Themes
| Theme |
Best For |
| GitHub |
General documentation |
| Professional |
Corporate documents |
| Minimal |
Clean, simple reports |
| Academic |
Papers, formal reports |
💻 Code Themes
| Theme |
Style |
| GitHub |
Light, clean |
| Monokai |
Dark, classic |
| Dracula |
Dark, purple |
| One Dark |
Atom-style |
| GitHub Dark |
Dark GitHub |
📁 Output Options
PDFs are saved in the same directory by default.
Change output location in settings:
{
"md2pdf.outputDirectory": "./pdf"
}
🔧 Requirements
- VS Code 1.74.0+
- Puppeteer (auto-installed on first use)
📝 Changelog
1.0.0
- Initial release
- Full Mermaid diagram support
- Cover pages with logo
- Table of contents generation
- 4 document themes
- 5 code syntax themes
- Watermark support
- Math equations (KaTeX)
- Line numbers for code
- Page numbering options
📄 License
MIT © Ehtesham Nasim
Made with ❤️ for developers who love Markdown
| |