Skip to main content

md-to-pdf-cli

Convert local Markdown files to PDF using headless Chromium — the same engine your editor preview uses, so what you see is what you get.

The CLI command is md2pdf (the PyPI package is md-to-pdf-cli).

Install

Requires Python 3.12+.

# with uv (recommended): installs the `md2pdf` command, isolated
uv tool install md-to-pdf-cli

# or with pip
pip install md-to-pdf-cli

That's it. Chromium is not a pip dependency — it's a browser binary Playwright downloads once into a shared cache. The first time you run md2pdf it detects the missing browser and downloads it automatically (~150 MB, one time only). To do it up front instead, run playwright install chromium (or, for a uv-tool install, uv tool run --from md-to-pdf-cli playwright install chromium).

Quick start

md2pdf report.md                 # writes report.pdf next to the input
md2pdf report.md -o out/doc.pdf  # choose the output path
md2pdf init                      # scaffold md2pdf.toml + theme.css

md2pdf <file> is shorthand for md2pdf convert <file>. Run md2pdf --help for all options.

Configuration

md2pdf auto-loads md2pdf.toml from the current directory. Precedence: CLI flags > config file > defaults.

[output]
page_size = "A4"
margin = { top = "2cm", bottom = "2cm", left = "1.8cm", right = "1.8cm" }

[theme]
css = ["theme.css"]              # extra CSS, applied after the default theme
code_style = "default"           # any Pygments style
# font_family = '"Noto Sans CJK TC", "Microsoft JhengHei", sans-serif'

[features]
math = true
mermaid = true
toc = false
embed_images = false

[footer]
enabled = true
template = '<span class="pageNumber"></span> / <span class="totalPages"></span>'

See the full README and wiki on GitHub for the complete options table, theming guide, troubleshooting, and architecture.

License

MIT

Metadata

Release files for md-to-pdf-cli 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md-to-pdf-cli 0.1.5
File Size Uploaded Provenance Actions
md_to_pdf_cli-0.1.5.tar.gz 1.1 MB Without provenance Details for md_to_pdf_cli-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for md-to-pdf-cli 0.1.5
File Interpreter ABI Platform Actions
md_to_pdf_cli-0.1.5-py3-none-any.whl Python 3 none any Details for md_to_pdf_cli-0.1.5-py3-none-any.whl

Total release size: 2.3 MB

Release files / md_to_pdf_cli-0.1.5.tar.gz

Download URL md_to_pdf_cli-0.1.5.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
445635f48b55df04ef20feca14d1c3f3fe396acc598d51876b004120134feb52
BLAKE2b-256 checksum
How to use checksums
3ddd236e0073370a8748ea70911b71326bbd064500b9f2b9f0b66e621012dc8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / md_to_pdf_cli-0.1.5-py3-none-any.whl

Download URL md_to_pdf_cli-0.1.5-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0be266539073acff5c46f6d721b9b7f81156317d0a1935768193c35e4f573d76
BLAKE2b-256 checksum
How to use checksums
f44cca8adb6d853bcfb62d70b88a6163c5e0f23cec90478fab9f777ed9671523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for md-to-pdf-cli 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page