Skip to content

LeafPress

Convert MkDocs sites to branded PDF and Word documents — from the CLI, desktop, or CI.

Home

PyPI License: MIT CI

Multiple Output Formats

Generate PDF, DOCX, HTML, ODT, EPUB, and Markdown files from any MkDocs project with a single command. HTML output is one self-contained file.

Custom Branding

Cover pages, logos, colors, and footers — all configurable via leafpress.yml.

Git-Aware

Automatically embeds tag, branch, commit hash, and date into your documents.

Package Version Detection

Automatically reads your project version from pyproject.toml, package.json, Cargo.toml, and more — shown alongside git info without any configuration.

CLI & Desktop UI

Use the command line for automation or the desktop app for a visual workflow.

CI / CD Pipelines

Run in GitHub Actions, GitLab CI, or any pipeline with environment variables.

Remote Sources

Convert directly from git URLs — no need to clone repos manually.

Monorepo Support

Combine multiple MkDocs projects into one document — local paths or git URLs with per-project metadata.

Diagram Fetching

Pull diagrams from URLs or Lucidchart before converting — with built-in caching.

Document Import

Import Word, PowerPoint, Excel, and LaTeX files to Markdown with image extraction, code block detection, tables, and math support.

Safe with Untrusted Repos

Converting someone else's repository can't read your local files, reach internal hosts, or inject scripts. HTML is sanitized automatically for git URL sources.

Mermaid Diagrams

Mermaid code blocks become images in PDF, Word, HTML, ODT, and EPUB, rendered by mermaid.ink or your own self-hosted server, or kept as code when privacy matters.

Zensical Ready

Experimental support for projects configured with zensical.toml, the successor to Material for MkDocs.

Doctor Command

Run `leafpress doctor` to diagnose your environment — checks dependencies, system libs, and suggests fixes.

Docker Support

Run in a container with all dependencies included — no system setup required.

Quick Start

$ pip install 'leafpress[pdf]'
---> 100%
Successfully installed leafpress

$ leafpress init
Created leafpress.yml

$ leafpress convert . -f pdf -o dist/
Converting MkDocs site to PDF...
✓ dist/docs.pdf

$ leafpress convert . -f all -c leafpress.yml -o dist/
Converting MkDocs site to all formats...
✓ dist/docs.pdf
✓ dist/docs.docx
✓ dist/docs.html
✓ dist/docs.odt
✓ dist/docs.epub
✓ dist/docs.md

Next Steps