mcpField
M
md-to-pdf

md-to-pdf

github.com/steveclarkeDocuments36221 installsUpdated today
Repository

About md-to-pdf

md-to-pdf is a skill for converting Markdown files into PDFs for people preparing documents to share or print. It uses crossnote and Chrome/Puppeteer to render diagrams, equations, and code, with page numbering.

Key features

  1. 01Convert Markdown files to PDF
  2. 02Render Mermaid diagrams
  3. 03Render KaTeX equations
  4. 04Highlight code with GitHub theme
  5. 05Add page numbers automatically

Use cases

  1. 01Convert a README to PDF
  2. 02Prepare a specification document for sharing
  3. 03Convert multiple Markdown files in docs

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/steveclarke/dotfiles --skill md-to-pdf

After installing, type/md-to-pdfin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.gitignore
package.json
scripts/
md-to-pdf
md-to-pdf.cjs

Details

From the project README

Markdown to PDF

Converts markdown files to beautifully formatted PDFs using crossnote (same engine as mcp-printer).

Features

  • Mermaid diagrams — Flowcharts, sequence diagrams, etc.
  • Math equations — KaTeX rendering
  • Syntax highlighting — GitHub theme
  • Page numbers — Automatic footer with page X / Y
  • GitHub-light theme — Clean, print-optimized styling

Usage

~/.claude/skills/md-to-pdf/scripts/md-to-pdf.cjs input.md              # Creates input.pdf
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.cjs input.md output.pdf   # Custom output name

Options

FlagDescription
-o FILESpecify output filename

Requirements

  • Chrome or Chromium — Auto-detected on macOS/Linux
  • Node.js — For running the script
  • Dependencies — Run npm install in the skill directory once

How It Works

  1. Uses crossnote (Markdown Preview Enhanced engine)
  2. Injects page numbering config into front-matter
  3. Renders via Chrome/Puppeteer
  4. Supports Mermaid, math, code highlighting out of the box

Examples

# Quick conversion
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.cjs README.md

# Spec document for sharing
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.cjs spec.md spec-v2.pdf

# Multiple files
for f in docs/*.md; do ~/.claude/skills/md-to-pdf/scripts/md-to-pdf.cjs "$f"; done

Mermaid Example

Include in your markdown:

```mermaid
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Do something]
    B -->|No| D[Do something else]
```

The diagram will render as a graphic in the PDF.

Printing

If the user wants to print the PDF, use the /print skill after generating.

Workflow decision:

User intentAction
"Convert to PDF"Keep the PDF
"Print this markdown"Generate PDF → print with /print → delete PDF
"Create a PDF and print it"Keep the PDF, also print

When printing is the goal (not the PDF itself), delete the PDF after printing:

# Generate, print, cleanup
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.cjs doc.md
~/.claude/skills/print/scripts/print doc.pdf
rm doc.pdf

The /print skill handles double-sided and b&w defaults automatically.

Alias (Optional)

Add to your shell profile:

alias md-to-pdf='~/.claude/skills/md-to-pdf/scripts/md-to-pdf.cjs'

Comments

Markdown supported