Skip to main content

Convert markdown to professional PDFs with clickable table of contents. No API keys.

Project description

Markdown to PDF Converter

Convert markdown (.md) files into professional, interactive PDF documents with automatic table of contents.

mcp-name: io.github.wmarceau/md-to-pdf

Features

  • Automatic Table of Contents - Generated from markdown headers
  • Interactive Navigation - Clickable TOC links to sections
  • Professional Styling - Clean, readable PDF output
  • Code Block Support - Syntax highlighting preserved
  • Table Support - Markdown tables convert to PDF tables
  • Image Support - Embedded images in PDFs
  • Batch Conversion - Process multiple files at once
  • MCP Integration - Use as an MCP server for AI assistants

Use Cases

  • Convert documentation to shareable PDFs
  • Create professional reports from markdown
  • Generate user manuals with navigation
  • Archive markdown content in PDF format
  • Prepare presentations or handouts
  • AI-powered document generation workflows

Project Structure

md-to-pdf/
├── src/
│   ├── md_to_pdf.py          # Core conversion logic
│   └── convert.sh            # Wrapper script (sets library paths)
├── mcp-server/
│   └── md_to_pdf_mcp.py      # MCP server wrapper
├── registry/
│   └── manifest.json         # MCP Registry manifest
├── workflows/
│   └── convert-md-to-pdf.md  # Conversion workflow guide
├── testing/                  # Multi-agent test infrastructure
├── VERSION                   # Current version
├── CHANGELOG.md              # Version history
├── SKILL.md                  # MCP skill documentation
└── README.md                 # This file

Requirements

  • Python 3.8+
  • markdown2 (markdown parsing)
  • weasyprint (PDF generation)
  • pygments (code syntax highlighting)
  • mcp (MCP server - for MCP mode only)

macOS Additional Requirements

brew install pango cairo

Quick Start

CLI Usage

# Set library path (macOS)
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH

# Convert single file
python src/md_to_pdf.py input.md output.pdf

# Using wrapper script
./src/convert.sh input.md output.pdf

# Batch convert
python src/md_to_pdf.py "docs/*.md" --output-dir pdfs/

# With custom styling
python src/md_to_pdf.py input.md output.pdf --css custom.css

# Without table of contents
python src/md_to_pdf.py input.md output.pdf --no-toc

MCP Server Usage

# Install MCP SDK
pip install mcp

# Run MCP server
python mcp-server/md_to_pdf_mcp.py

MCP Tools

Tool Description
convert_markdown_to_pdf Convert markdown to PDF with optional TOC
extract_toc Extract table of contents structure
get_default_styles Get default CSS for customization

See SKILL.md for detailed MCP tool documentation.

Version

Current version: 1.0.0

License

MIT License

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

md_to_pdf_mcp-1.0.1.tar.gz (524.0 kB view details)

Uploaded Source

Built Distribution

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

md_to_pdf_mcp-1.0.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file md_to_pdf_mcp-1.0.1.tar.gz.

File metadata

  • Download URL: md_to_pdf_mcp-1.0.1.tar.gz
  • Upload date:
  • Size: 524.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for md_to_pdf_mcp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4d2acc319d3d8f96d159a42c6e58bb512234be347fde44bb4b5e758915fa3143
MD5 52e495156ca27a8eeae7860c468ef979
BLAKE2b-256 e44c6c4bcfaf41e14346a8575959db8b2e9af91cefcebfe9086af52daa11b405

See more details on using hashes here.

File details

Details for the file md_to_pdf_mcp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: md_to_pdf_mcp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for md_to_pdf_mcp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 298ae34a1eb2830d5e0126b89930282b5f00bf0d027a5133adfce3872289c031
MD5 c756254e2f17c0c9382786a0671f57a0
BLAKE2b-256 3c163d03bbd6698c3e710c5be36cffe596cdf8705c083587b3a3f66af2c22a88

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