Skip to main content

A fast, clean CLI tool to convert Markdown files into beautifully styled PDFs.

Project description

markpdf-cli

A fast, clean CLI tool to convert Markdown files into beautifully styled PDFs.

Built with markdown and WeasyPrint.


✨ Features

  • 📄 Convert one or many .md files to PDF in one command.
  • 🔀 Merge mode — combine multiple Markdown files into a single PDF with page breaks.
  • 🎨 Professional, print-ready CSS styling out of the box.
  • 📦 Installable as a Python package; works as a markpdf command.

📋 Prerequisites

WeasyPrint depends on system libraries. On Ubuntu / Debian, install them first:

sudo apt update
sudo apt install -y libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev libcairo2

On macOS (Homebrew):

brew install pango libffi

🚀 Installation

From PyPI (once published)

pip install markpdf-cli

From source

git clone https://github.com/amritanshu/markpdf-cli.git
cd markpdf-cli
pip install .

Development install

pip install -e .

📖 Usage

Convert a single file

markpdf README.md
# → produces README.pdf

Convert a single file with a custom output name

markpdf README.md -o documentation.pdf
# → produces documentation.pdf

Convert multiple files (separate PDFs)

markpdf chapter1.md chapter2.md chapter3.md
# → produces chapter1.pdf, chapter2.pdf, chapter3.pdf

Merge multiple files into one PDF

markpdf chapter1.md chapter2.md chapter3.md --merge
# → produces merged_output.pdf

Merge with a custom output name

markpdf chapter1.md chapter2.md chapter3.md -m -o book.pdf
# → produces book.pdf

Show version

markpdf --version

🏗️ Publishing to PyPI

1. Build the package

pip install build
python -m build

This creates dist/markpdf_cli-0.1.0.tar.gz and dist/markpdf_cli-0.1.0-py3-none-any.whl.

2. Upload to TestPyPI

pip install twine
twine upload --repository testpypi dist/*

You'll need an API token from TestPyPI.

3. Verify from TestPyPI

python -m venv /tmp/test-markpdf && source /tmp/test-markpdf/bin/activate
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ markpdf-cli
markpdf --version
deactivate

4. Upload to production PyPI

twine upload dist/*

📄 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

markpdf_cli-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markpdf_cli-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file markpdf_cli-0.1.0.tar.gz.

File metadata

  • Download URL: markpdf_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for markpdf_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a19d5ac0298b614c7f0db06ba2129705dd0ae0f53101887b28dde85b46bf4467
MD5 65ee339bdbe15388eeac052e6f03b59f
BLAKE2b-256 9ff57baf05985da4913f064a0b3d175d565bde3eb17a0d10f73746cfa4854bcf

See more details on using hashes here.

File details

Details for the file markpdf_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: markpdf_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for markpdf_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d82e974688f9098c065202766e5abbc9aafee441d145806040f0a8590dc30c07
MD5 603285b57ebb59a458eb15a1bdaddb3a
BLAKE2b-256 a089cbcf4a44dcd4da969df1a7cb46dcee9a806d56f2acec4afda08202b91fd0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page