Beautiful, configurable, extensible Markdown-to-PDF rendering for Python.
Project description
Markprint
Markprint is a beautiful, configurable, extensible Markdown-to-PDF renderer for Python.
It is built for developers who want polished PDFs from Markdown without giving up control over themes, profiles, syntax highlighting, document metadata, batch rendering, logging, or advanced rendering backends.
Markdown source
-> frontmatter and config
-> parsed document model
-> HTML body
-> themed printable HTML
-> PDF artifact
Why Markprint?
Markdown-to-PDF tooling often falls into two extremes. Some tools are easy but plain. Others are powerful but heavy, requiring Pandoc, LaTeX, browser automation, or lots of project-specific glue. Markprint aims for a better middle path:
- simple by default,
- beautiful out of the box,
- deeply configurable when needed,
- extensible through clean rendering stages,
- useful as both a CLI and Python library.
Installation
pip install markprint
With optional extras:
pip install "markprint[logging]"
pip install "markprint[browser]"
pip install "markprint[pandoc]"
pip install "markprint[pdf]"
For local development:
pdm install -G dev -G test -G docs
Quickstart
Render a Markdown file to PDF:
markprint README.md README.pdf
Render raw Markdown:
markprint render-string "# Hello Markprint" --output hello.pdf
Render from stdin:
echo "# Hello from stdin" | markprint - hello.pdf
Compile multiple Markdown files into one PDF:
markprint compile docs/intro.md docs/usage.md docs/api.md --output manual.pdf
Python API
from pathlib import Path
from markprint import RenderOptions, render_pdf
render_pdf(
source=Path("README.md"),
output=Path("README.pdf"),
options=RenderOptions(theme="github", profile="docs", toc=True),
)
Raw Markdown:
from markprint import render_pdf
render_pdf(
markdown="# Hello
This is **raw Markdown**.",
output="hello.pdf",
)
Documentation
- Documentation: https://markprint.readthedocs.io/
- PyPI: https://pypi.org/project/markprint/
- Repository: https://github.com/pr1m8/markprint
Core features
- Markdown file, raw string, stdin, batch, and multi-file input
- YAML frontmatter and project config support
- Themeable Jinja HTML templates
- Pygments syntax highlighting
- WeasyPrint backend by default
- Optional Playwright and Pandoc backends
- Optional ultilog logging integration
- PDF helper extension points
- Plugin-oriented architecture
Development
pdm install -G dev -G test -G docs
pdm run ruff check .
pdm run ruff format --check .
pdm run pytest --cov=markprint --cov-report=term-missing
pdm run mkdocs build --strict
License
MIT.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file markprint-0.1.6.tar.gz.
File metadata
- Download URL: markprint-0.1.6.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f6369c990eec9092b908c040dc00bb0aa3cec0865279b485cd52f7394a164df
|
|
| MD5 |
6d9c860ea2be949e87fe8c48f5efd1a8
|
|
| BLAKE2b-256 |
1b0a8c944993824837ac29cbef22c9b23d0a00f618b1fdbf87ac369872f6781f
|
Provenance
The following attestation bundles were made for markprint-0.1.6.tar.gz:
Publisher:
release.yml on pr1m8/markprint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markprint-0.1.6.tar.gz -
Subject digest:
2f6369c990eec9092b908c040dc00bb0aa3cec0865279b485cd52f7394a164df - Sigstore transparency entry: 1417310379
- Sigstore integration time:
-
Permalink:
pr1m8/markprint@d8ab433bc567f0e24b360f2feb52f5db58d69af9 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/pr1m8
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d8ab433bc567f0e24b360f2feb52f5db58d69af9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file markprint-0.1.6-py3-none-any.whl.
File metadata
- Download URL: markprint-0.1.6-py3-none-any.whl
- Upload date:
- Size: 51.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9042a0aaac052522cf70847c97b47d3027f5c0eaf060fd19e2a3dd6919ddd468
|
|
| MD5 |
0cec02e97fc2de6499a823d97fd97d8d
|
|
| BLAKE2b-256 |
c1d35671ff3953fd0e0f51be48c11481ff559fe2208b72b8d07f5b02a5b48551
|
Provenance
The following attestation bundles were made for markprint-0.1.6-py3-none-any.whl:
Publisher:
release.yml on pr1m8/markprint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markprint-0.1.6-py3-none-any.whl -
Subject digest:
9042a0aaac052522cf70847c97b47d3027f5c0eaf060fd19e2a3dd6919ddd468 - Sigstore transparency entry: 1417310381
- Sigstore integration time:
-
Permalink:
pr1m8/markprint@d8ab433bc567f0e24b360f2feb52f5db58d69af9 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/pr1m8
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d8ab433bc567f0e24b360f2feb52f5db58d69af9 -
Trigger Event:
release
-
Statement type: