Convert Markdown files to beautifully styled PDFs
Project description
markd2pdf
A command-line tool to convert Markdown files to PDF with customizable themes.
Features
- Convert single files or entire directories recursively
- 5 built-in themes (github_dark, dracula, nord, minimal_light, professional_dark)
- Syntax highlighting for code blocks
- Support for tables, footnotes, admonitions, and table of contents
- Parallel processing for batch conversions
Installation
Prerequisites
WeasyPrint requires system dependencies:
# Arch / Manjaro
sudo pacman -S pango gdk-pixbuf2
# Debian / Ubuntu
sudo apt install libpango-1.0-0 libgdk-pixbuf-2.0-0
# macOS
brew install pango gdk-pixbuf
Install from PyPI
pip install markd2pdf
Install from source
git clone https://github.com/ramcharan/markd2pdf.git
cd markd2pdf
pip install -e .
Usage
Convert a single file
markd2pdf convert document.md ./output
Convert a directory
markd2pdf convert ./docs ./output
Specify a theme
markd2pdf convert document.md ./output --theme dracula
List available themes
markd2pdf themes
Themes
| Theme | Description |
|---|---|
github_dark |
GitHub-style dark theme (default) |
dracula |
Dracula color scheme |
nord |
Nord color palette |
minimal_light |
Light theme for printing |
professional_dark |
Dark theme with blue accents |
Custom Themes
Themes are CSS files located in the styles/ directory. To create a custom theme:
- Copy an existing theme file
- Modify the CSS
- Register the theme in
cli.pyby adding it to theThemeenum
Supported Markdown Extensions
- Tables
- Fenced code blocks with syntax highlighting
- Table of contents (
[TOC]) - Admonitions
- Footnotes
- Definition lists
- Abbreviations
Development
git clone https://github.com/ramcharan/markd2pdf.git
cd markd2pdf
uv sync --group dev
# Run linters
uv run black src/
uv run mypy src/
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
markd2pdf-0.1.1.tar.gz
(11.2 kB
view details)
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
markd2pdf-0.1.1-py3-none-any.whl
(16.0 kB
view details)
File details
Details for the file markd2pdf-0.1.1.tar.gz.
File metadata
- Download URL: markd2pdf-0.1.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1ede518409b3164ddb6ae17f6f975c61c52c6f7185e52a6e27d08848653b5b6
|
|
| MD5 |
7e91cd77e5b49a6157e104feeae91c05
|
|
| BLAKE2b-256 |
ea7bde0ab6dc489380a0b6839f59cbc5926070ec35b81a57f424368b08f07e95
|
File details
Details for the file markd2pdf-0.1.1-py3-none-any.whl.
File metadata
- Download URL: markd2pdf-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1be8cbc0f353c0011dd3250463110d7a0525df1a3bf13ce6491092bda7c632be
|
|
| MD5 |
09113c0da1f22cb943300dea8db02ea3
|
|
| BLAKE2b-256 |
d674c7660c0e60c140d18c94b7d7f37c5839485400193e95b442ca65f068b2d4
|