md-to-pdf

Convert Markdown files to print-ready PDFs with pandoc, KaTeX, and Playwright.

310|45|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/Mathews-Tom/praxis-skills --skill md-to-pdf-mathews-tom
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: md-to-pdf
Source: https://github.com/Mathews-Tom/praxis-skills/tree/main/skills/md-to-pdf
Command: npx skills add https://github.com/Mathews-Tom/praxis-skills --skill md-to-pdf-mathews-tom

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandoc, mmdc, node, katex, playwright, chromium, and includes scripts (resource) components.

What problem does it solve?

Converts Markdown documents into professionally styled, print-ready PDF files while preserving complex content such as Mermaid diagrams, LaTeX math, tables, and syntax-highlighted code so users do not need to manually reformat or rebuild documents for distribution.

Core Features & Use Cases

  • High-fidelity rendering: Full pipeline that renders Mermaid diagrams to SVG, converts Markdown to HTML via pandoc, performs server-side KaTeX math rendering, injects professional CSS, and prints to PDF via Playwright/Chromium.
  • Flexible export options: Supports page sizes (A4/Letter/Legal/A3), custom margins, landscape orientation, header/footer page numbers, custom CSS injection, and flags to skip Mermaid or math rendering for speed.
  • Use Case: Turn technical notes, research drafts, or documentation containing diagrams and equations into a single, publication-quality PDF without manual layout work.

Quick Start

Run the conversion using the included script, for example: python3 scripts/md_to_pdf.py input.md output.pdf

Frequently Asked Questions about md-to-pdf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Markdown to PDF with Mermaid diagrams and LaTeX math?▼

To convert Markdown to PDF, this tool renders Mermaid diagrams to SVG, converts Markdown to HTML via pandoc, performs server-side KaTeX math rendering, and prints to PDF using Playwright and Chromium.

Can I customize page size, margins, and orientation when exporting Markdown to PDF?▼

Yes, Markdown to PDF conversion supports flexible export options including A4, Letter, Legal, and A3 page sizes, custom margins, landscape orientation, and header or footer page numbers.

Do I need pandoc and Chromium installed to render Markdown files to PDF?▼

Yes, the Markdown to PDF pipeline requires pandoc, mmdc (mermaid-cli), node, katex, and Playwright with Chromium installed to execute the full rendering workflow.

What is the best way to generate print-ready PDFs from Markdown documentation?▼

The best way to generate print-ready PDFs from Markdown is using an automated pipeline that injects professional CSS, renders syntax-highlighted code blocks, and exports via Chromium for publication-quality output.

How does server-side KaTeX rendering work when converting Markdown to PDF?▼

Server-side KaTeX rendering processes LaTeX math equations during the Markdown to HTML conversion step, ensuring mathematical expressions are visually rendered in the final PDF output.

Can I skip Mermaid or math rendering to speed up Markdown to PDF conversion?▼

Yes, flags are available to skip Mermaid diagram or KaTeX math rendering, allowing faster Markdown to PDF conversion when those specific content types are not present.