Skip to main content

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

Project description

📄 markpdf-cli

Convert Markdown to beautifully styled PDFs — from the terminal.

PyPI Python License


markpdf-cli is a lightweight command-line tool that takes your .md files and produces clean, print-ready PDF documents with professional styling — no configuration needed.

Built with python-markdown for parsing and WeasyPrint for rendering.


⚡ Quick Start

pip install markpdf-cli
markpdf README.md

That's it. You now have a README.pdf with beautiful typography and styling.


🚀 Installation

From PyPI

pip install markpdf-cli

From source

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

System dependencies

WeasyPrint requires some system libraries. Install them before using markpdf:

Ubuntu / Debian
sudo apt update
sudo apt install -y libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev libcairo2
macOS (Homebrew)
brew install pango libffi

📖 Usage

Convert a single file

markpdf report.md
# → report.pdf

Custom output name

markpdf report.md -o final-report.pdf
# → final-report.pdf

Convert multiple files (separate PDFs)

markpdf ch1.md ch2.md ch3.md
# → ch1.pdf  ch2.pdf  ch3.pdf

Merge multiple files into one PDF

markpdf ch1.md ch2.md ch3.md --merge
# → merged_output.pdf  (page breaks between each file)

Merge with a custom name

markpdf ch1.md ch2.md ch3.md -m -o book.pdf
# → book.pdf

🐍 Use as a Python library

You can also import markpdf directly in your scripts:

from markpdf.converter import convert_single, convert_merged

# Single file
convert_single("notes.md", "notes.pdf")

# Merge multiple files
convert_merged(["ch1.md", "ch2.md", "ch3.md"], "book.pdf")

🏗️ Project Structure

markpdf-cli/
├── pyproject.toml          # Build config & metadata
├── README.md
├── .gitignore
└── src/
    └── markpdf/
        ├── __init__.py     # Version
        ├── cli.py          # CLI entry point (argparse)
        └── converter.py    # Core MD → HTML → PDF logic

🤝 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

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

📄 License

MIT © Amritanshu

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.1.tar.gz (6.2 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.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: markpdf_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 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.1.tar.gz
Algorithm Hash digest
SHA256 ad2cb6e17fbd0bdef1e48504b05002e0a4cac43cde2ae4e92bc790265b50d41e
MD5 6ea91494bb1f2f3045faca7ce74021bc
BLAKE2b-256 47dbe4b0d0eef0b6a17b839d36f74b10a345498a1c7d2ab6116f2287e37a5821

See more details on using hashes here.

File details

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

File metadata

  • Download URL: markpdf_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6001af06da20da6acc40039de52cfd0b1b8c9a127a6bac712b3adf3ca2582f29
MD5 5037bdc02b576a998ff2791a61432a3a
BLAKE2b-256 aadf169cc5db67d004a15dd4e88c4b1947edc41094ef55f640037f9737b94193

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