Skip to content

md-to-pdf documentation

Convert one Markdown file into one PDF, with Mermaid diagrams rendered before the PDF is written.

md-to-pdf turns Markdown into browser-ready HTML, waits for Mermaid diagrams to finish, and asks Chrome, Chromium, or Edge to print the page as a PDF.

Start with one file:

md-to-pdf guide.md

By default, this writes guide.pdf next to guide.md.

flowchart LR
    markdown["Markdown file"] --> html["HTML document"]
    html --> browser["Chrome / Chromium / Edge"]
    browser --> pdf["PDF file"]

Find your way around

This documentation follows the Diataxis framework. Pick the section that matches what you need right now.

  • Tutorials


    Learning-oriented. Start with a small Markdown file, then add Mermaid diagrams.

    Start learning

  • How-to guides


    Task-oriented. Install the CLI, choose a browser, add CSS, use local assets, debug rendering, and run in CI.

    Solve a task

  • Reference


    Information-oriented. Look up CLI options, defaults, supported Markdown, configuration, and errors.

    Look up details

  • Explanation


    Understanding-oriented. Learn why md-to-pdf uses a browser and how Mermaid, safety, and tradeoffs work.

    Understand the design

Requirements

Browser required

md-to-pdf needs Chrome, Chromium, or Microsoft Edge for PDF rendering.

Plain Markdown conversion works offline. Mermaid diagrams use jsDelivr by default unless you provide a local Mermaid browser bundle.

See Install md-to-pdf for platform-specific installation steps.

Why use a browser?

Markdown-to-PDF tools often struggle when diagrams need JavaScript and browser layout. md-to-pdf keeps the pipeline HTML-first so Mermaid and print CSS run in the same environment that creates the PDF.

For the design details, read Rendering pipeline and Design tradeoffs.

Maintainers

Maintainer pages cover release operations such as macOS signing and the release checklist. They are contributor-facing, separate from the user-facing Diataxis sections.