A CLI tool to convert Markdown files to PDF with GitHub-style rendering.
| Feature | Description |
|---|---|
| GitHub styling | PDFs look exactly like GitHub renders Markdown |
| Simple | No config, no LaTeX, no templates. Just pip install and go |
| Curl-like flags | Familiar -o and -O flags for output control |
| Wildcards | Bulk convert with ghpdf *.md -O |
Prerequisites (system libraries required by WeasyPrint)
macOS (Homebrew):
brew install pangoUbuntu/Debian:
sudo apt install libpango-1.0-0 libpangocairo-1.0-0Fedora:
sudo dnf install pangoWindows: See WeasyPrint Windows installation
pip install ghpdfOr with pipx (recommended for CLI tools):
pipx install ghpdf# Convert a file
ghpdf README.md -o output.pdf
# Auto-name output (README.md → README.pdf)
ghpdf README.md -Oghpdf [OPTIONS] [FILES]...| Flag | Long | Description |
|---|---|---|
-o |
--output |
Output filename (single file or stdin only) |
-O |
--remote-name |
Auto-name output (input.md → input.pdf) |
-n |
--page-numbers |
Add page numbers at bottom center |
-q |
--quiet |
Suppress progress output |
-V |
--version |
Show version and exit |
# Single file with explicit output
ghpdf README.md -o documentation.pdf
# Auto-name output (README.md → README.pdf)
ghpdf README.md -O
# Bulk convert all markdown files
ghpdf *.md -O
# With page numbers
ghpdf report.md -O -n
# Stdin to file
echo "# Hello World" | ghpdf -o hello.pdf
# Stdin to stdout (for piping)
cat document.md | ghpdf > output.pdf
# Quiet mode for scripting
ghpdf *.md -O -q- GitHub-flavored markdown styling
- Syntax highlighting for code blocks
- Tables, task lists, footnotes, and more
- Page break support
- Optional page numbers
- Bulk conversion
- Stdin/stdout piping
Headings, bold, italic, strikethrough, lists, task lists, code blocks, inline code, tables, blockquotes, horizontal rules, links, images, footnotes, definition lists, abbreviations, and admonitions.
Insert page breaks using any of these formats:
---pagebreak---
<!-- pagebreak -->
\pagebreak
MIT