agentleFS
matthullmatthull/my-skills/skills/technical/markdown-to-pdf/SKILL.md

markdown-to-pdf

Skill0 starsChanged 55 days agoMITView on GitHub

Convert markdown files to beautifully formatted PDFs with dark mode support. This skill should be used when users want to export markdown documents to PDF format, especially when they need dark themes, proper ASCII diagram rendering, or professional formatting for tables with icons.

  • Installs packages

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add --print-to to send the PDF directly to a printer after conversion:

    line 56
  2. Distinctive:

    Ensure Noto Color Emoji or similar emoji font is installed:

    line 141

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Markdown to PDF Skill

Convert markdown documents to high-quality PDFs with dark mode support, proper ASCII diagram rendering, and professional table formatting.

Features

  • Dark mode theme (default) with Catppuccin Mocha colors
  • Light mode theme with Catppuccin Latte colors
  • Print mode theme - printer-friendly black & white, high contrast
  • ASCII diagram support with proper monospace font alignment
  • Unicode icon support (checkmarks, emojis, etc.)
  • Professional table formatting with alternating row colors
  • Code block syntax highlighting optimized for readability

Usage

Basic Conversion (Dark Mode)

python ~/.claude/skills/markdown-to-pdf/scripts/md2pdf.py document.md

Specify Output File

python ~/.claude/skills/markdown-to-pdf/scripts/md2pdf.py document.md -o output.pdf

Light Mode

python ~/.claude/skills/markdown-to-pdf/scripts/md2pdf.py document.md --light

Print Mode (Black & White)

python ~/.claude/skills/markdown-to-pdf/scripts/md2pdf.py document.md --print

Best for physical printing - uses only black, white, and grays for maximum legibility and toner efficiency.

Custom CSS

python ~/.claude/skills/markdown-to-pdf/scripts/md2pdf.py document.md --css custom.css

Send to Printer

Add --print-to to send the PDF directly to a printer after conversion:

python ~/.claude/skills/markdown-to-pdf/scripts/md2pdf.py document.md --print --print-to brother

This converts to PDF (using print-friendly theme) and sends it straight to the printer via lp. The --print-to flag takes a CUPS printer name.

Printing an existing PDF (no conversion needed):

lp -d brother document.pdf

Available Printers

The system has CUPS configured with:

  • brother — Brother printer (default)

To check printer status: lpstat -p

Output

The script outputs file:// URLs for the created PDFs. Always include these URLs in your response to the user so they can easily open the files in their browser or PDF viewer.

Requirements

The following packages must be installed:

# Arch Linux
sudo pacman -S pandoc python-weasyprint

# Ubuntu/Debian
sudo apt install pandoc weasyprint

# macOS
brew install pandoc
pip install weasyprint

Bundled Assets

  • assets/dark-mode.css - Catppuccin Mocha dark theme
  • assets/light-mode.css - Catppuccin Latte light theme
  • assets/print-mode.css - Printer-friendly black & white theme

Technical Notes

ASCII Diagram Rendering

The CSS is optimized for ASCII art with:

  • DejaVu Sans Mono as the primary monospace font
  • Zero letter-spacing to ensure box characters align
  • Proper line-height (1.3) for connected box drawings
  • white-space: pre to preserve exact spacing

Color Printing

The stylesheets include print-color-adjust: exact to ensure background colors render correctly when printing to PDF.

Page Breaks

To force a page break, use:

<div class="page-break"></div>

Troubleshooting

Missing fonts

Install DejaVu fonts for best ASCII diagram rendering:

# Arch Linux
sudo pacman -S ttf-dejavu

# Ubuntu/Debian
sudo apt install fonts-dejavu

Icons not rendering

Ensure Noto Color Emoji or similar emoji font is installed:

# Arch Linux
sudo pacman -S noto-fonts-emoji

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.