md-to-pdf
Convert Markdown to PDF with Mermaid diagrams using Chrome, Chromium, or Edge.
Install as an Agent Plugin
This repository is an Agent Plugins 1.0.0-compliant package.
For Codex CLI, add the repository marketplace and install md-to-pdf:
codex plugin marketplace add MiguelElGallo/md-to-pdf
codex plugin add md-to-pdf@md-to-pdf
For GitHub Copilot CLI, use the equivalent marketplace commands:
copilot plugin marketplace add MiguelElGallo/md-to-pdf
copilot plugin install md-to-pdf@md-to-pdf
Start a new Codex or Copilot session after installation so the plugin's skill and MCP tool are available.
VS Code
- Install Python 3 and Chrome, Chromium, or Edge.
- In VS Code, run Chat: Install Plugin From Source from the Command Palette.
- Enter
https://github.com/MiguelElGallo/md-to-pdf.
VS Code clones and enables the plugin. On the first conversion, its dependency-free
Python MCP server downloads a compatible md-to-pdf release binary, verifies its
SHA-256 checksum, and caches it in the plugin's persistent data directory. No
administrator access or separate CLI installation is required.
MCP tool
convert_markdown_to_pdf requires input and supports output, title, page_size, css, mermaid_url, allow_html, allow_local_files, and browser.
Example arguments:
{
"input": "/path/to/document.md",
"output": "/path/to/document.pdf",
"page_size": "Letter"
}
Set MD_TO_PDF_BIN to use an existing binary or MD_TO_PDF_BROWSER to select a
browser. Set MD_TO_PDF_AUTO_INSTALL=0 to disable the automatic binary download.
Install the CLI
Download a release from GitHub Releases, or install on macOS:
curl -fsSL https://raw.githubusercontent.com/MiguelElGallo/md-to-pdf/main/scripts/install-macos.sh | sh
Build from source:
cargo install --git https://github.com/MiguelElGallo/md-to-pdf
Use the CLI
md-to-pdf document.md
The default output is document.pdf. Common options:
md-to-pdf document.md \
--output report.pdf \
--title "Report" \
--page-size Letter \
--css print.css
Mermaid fenced code blocks render automatically:
```mermaid
graph TD
A[Markdown] --> B[PDF]
```
Use md-to-pdf --help for all options.
Requirements
- Chrome, Chromium, or Microsoft Edge
- Internet access for Mermaid by default; use
--mermaid-jsfor offline rendering - Rust and Cargo only when building from source
Documentation
Development
cargo fmt --check
cargo test
uv run --locked --group docs zensical build --clean --strict
See LICENSE.