| name | md-to-pdf |
| description | Converts markdown files into professionally styled PDF documents. Use this skill whenever the user asks to generate a PDF, export markdown as PDF, convert .md to .pdf, or create a printable version of a document. Also triggers when the user wants status-colored tables, styled documentation export, or says things like "make this a PDF", "I need a PDF version", "export this doc". Supports auto orientation, optional keyword-based cell coloring, and graceful engine fallback. |
Markdown to PDF
Convert any markdown file into a clean, professionally styled PDF. Handles tables, code blocks, blockquotes, and deep heading hierarchies out of the box. Optionally color-codes table cells based on status keywords.
When to Apply
Reference these guidelines when:
- The user asks to convert a markdown file to PDF
- The user wants a printable or shareable version of a document
- The user asks to "export", "generate PDF", or "make a PDF"
- The user wants styled tables with color-coded status cells
- The user needs landscape orientation for wide tables
How It Works
This skill bundles a Python script (scripts/md_to_pdf.py) that handles the full conversion pipeline:
Markdown → HTML (via markdown2) → Styled HTML → PDF (via weasyprint or xhtml2pdf)
Always run the bundled script rather than writing conversion code inline. This ensures consistent styling and avoids reinventing the wheel each time.
Quick Start
Basic conversion — the script auto-detects the best orientation:
python3 <skill-path>/scripts/md_to_pdf.py input.md output.pdf
With status cell coloring (colors the table cells, not the text):
python3 <skill-path>/scripts/md_to_pdf.py input.md output.pdf --status-colors
Force landscape or portrait: