md2pdf

Markdown to PDF converter with GitHub-flavored styling

Mermaid Diagrams GitHub CSS Japanese Text
Terminal
$ brew install 135yshr/tap/md2pdf
$ md2pdf document.md
Converting document.md → document.pdf ... done

Mermaid Diagrams

Flowcharts, sequence diagrams, and more — rendered as inline SVG via the mmdc CLI.

GitHub Styling

Tables, fenced code blocks, strikethrough, and all GFM features with familiar GitHub CSS.

Japanese Support

Noto Sans CJK JP fonts are auto-detected and embedded for beautiful Japanese typography.

Configurable Output

A4, Letter, A3 page sizes with customizable margins. Output to any path.

How It Works

1

Parse

goldmark converts Markdown to HTML with GFM extensions

2

Render Diagrams

Mermaid blocks are rendered to SVG via mmdc

3

Build HTML

GitHub CSS + fonts + SVGs assembled into one HTML file

4

Print PDF

Headless Chromium via Playwright prints to PDF