Skip to content

atlekbai/ghpdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ghpdf

A CLI tool to convert Markdown files to PDF with GitHub-style rendering.

Why

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
Sample PDF output

Installation

Prerequisites (system libraries required by WeasyPrint)

macOS (Homebrew):

brew install pango

Ubuntu/Debian:

sudo apt install libpango-1.0-0 libpangocairo-1.0-0

Fedora:

sudo dnf install pango

Windows: See WeasyPrint Windows installation

Install ghpdf

pip install ghpdf

Or with pipx (recommended for CLI tools):

pipx install ghpdf

Quick Start

# Convert a file
ghpdf README.md -o output.pdf

# Auto-name output (README.md → README.pdf)
ghpdf README.md -O

Usage

ghpdf [OPTIONS] [FILES]...

Options

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

Examples

# 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

Features

  • 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

Supported Markdown

Headings, bold, italic, strikethrough, lists, task lists, code blocks, inline code, tables, blockquotes, horizontal rules, links, images, footnotes, definition lists, abbreviations, and admonitions.

Page Breaks

Insert page breaks using any of these formats:

---pagebreak---
<!-- pagebreak -->
\pagebreak

License

MIT

About

Markdown to PDF in GitHub-style

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published