A lightweight, client-side Markdown to PDF converter. No server required - runs entirely in your browser.
Write Markdown → See live preview → Export to PDF
- Real-time Markdown preview
- PDF export with customizable options
- Syntax highlighting (highlight.js with multiple themes)
- Mermaid diagram support (flowcharts, sequence diagrams, etc.)
- Custom header/footer templates with dynamic values
- Page breaks support (
<!-- pagebreak -->) - Paper size selection (A4, Letter, Legal, A3, A5)
- Paper orientation (Portrait / Landscape)
- Margin adjustment
- Font size control
- Typography improvements (Smartypants)
- GitHub Flavored Markdown support
Visit https://zabio3.github.io/md-to-pdf/
# Clone the repository
git clone <repo-url>
cd md-to-pdf
# Start a local server (choose one)
npx serve # Node.js
python3 -m http.server 8080 # Python
php -S localhost:8080 # PHP
# Open in browser
open http://localhost:8080Insert page breaks in your Markdown using HTML comments:
# Page 1 Content
<!-- pagebreak -->
# Page 2 ContentNote: --- is rendered as a horizontal rule (standard Markdown behavior).
Code blocks are automatically syntax highlighted using highlight.js with the GitHub theme.
Create diagrams using Mermaid syntax in fenced code blocks:
```mermaid
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Process]
B -->|No| D[End]
```Supported diagram types:
- Flowcharts
- Sequence diagrams
- Class diagrams
- State diagrams
- Entity Relationship diagrams
- And more (Mermaid documentation)
Mermaid rendering can be toggled on/off in Settings > Advanced Settings > Render Mermaid diagrams.
Add custom headers and footers to your PDF with dynamic values:
| Token | Description |
|---|---|
{date} |
Current date |
{title} |
Document title (from first H1) |
Example footer template: {title} - {date}
Configure in Settings > Advanced Settings > Header / Footer.
Additional PDF options available:
- Orientation: Portrait or Landscape
- Background printing: Include background colors in PDF
Ctrl/Cmd + S: Export to PDF
- Vanilla JavaScript (no frameworks)
- Marked.js - Markdown parsing
- highlight.js - Syntax highlighting
- Mermaid.js - Diagram rendering
- Native browser print API - PDF generation
- GitHub Pages - Hosting
The site automatically deploys to GitHub Pages when pushing to the main branch via GitHub Actions.
- Go to repository Settings > Pages
- Under "Build and deployment", select GitHub Actions as the source
- Push to main branch to trigger deployment
MIT
