md-to-pdf
18
总安装量
6
周安装量
#19698
全站排名
安装命令
npx skills add https://github.com/steveclarke/dotfiles --skill md-to-pdf
Agent 安装分布
opencode
4
claude-code
4
codex
3
gemini-cli
3
openclaw
2
trae-cn
2
Skill 文档
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.mjs input.md # Creates input.pdf
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.mjs input.md output.pdf # Custom output name
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.mjs input.md --open # Open after creating
Options
| Flag | Description |
|---|---|
--open, -O |
Open the PDF after creating |
-o FILE |
Specify output filename |
Requirements
- Chrome or Chromium â Auto-detected on macOS/Linux
- Node.js â For running the script
- Dependencies â Run
npm installin the skill directory once
How It Works
- Uses crossnote (Markdown Preview Enhanced engine)
- Injects page numbering config into front-matter
- Renders via Chrome/Puppeteer
- Supports Mermaid, math, code highlighting out of the box
Examples
# Quick conversion
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.mjs README.md
# Spec document for sharing
~/.claude/skills/md-to-pdf/scripts/md-to-pdf.mjs spec.md spec-v2.pdf --open
# Multiple files
for f in docs/*.md; do ~/.claude/skills/md-to-pdf/scripts/md-to-pdf.mjs "$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 intent | Action |
|---|---|
| “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.mjs 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.mjs'