Agent skill
markdown-to-pdf
Convert markdown files to PDF with custom styling. Use when generating PDF documents from markdown, creating printable documentation, or exporting reports.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/markdown-to-pdf
SKILL.md
markdown-to-pdf
Convert markdown files to professionally-styled PDF documents.
Installation Required
cd .claude/skills/markdown-to-pdf
npm install
Dependencies: md-to-pdf (includes Puppeteer, auto-downloads Chromium ~200MB)
Quick Start
# Basic conversion
node .claude/skills/markdown-to-pdf/scripts/convert.cjs \
--file ./README.md
# Custom output path
node .claude/skills/markdown-to-pdf/scripts/convert.cjs \
--file ./doc.md \
--output ./output/doc.pdf
# Custom styling
node .claude/skills/markdown-to-pdf/scripts/convert.cjs \
--file ./report.md \
--style ./custom-style.css
CLI Options
| Option | Required | Description |
|---|---|---|
--file <path> |
Yes | Input markdown file |
--output <path> |
No | Output PDF path (default: input name + .pdf) |
--style <path> |
No | Custom CSS file |
Output Format (JSON)
{
"success": true,
"input": "/path/to/input.md",
"output": "/path/to/output.pdf",
"pages": 5
}
Default Styling
- GitHub-flavored markdown
- Code syntax highlighting (highlight.js)
- Sans-serif body (system fonts)
- Monospace code blocks
- A4 page size, 2cm margins
Customization
Create custom CSS:
body {
font-family: Georgia, serif;
font-size: 12pt;
line-height: 1.6;
}
h1 { color: #2c3e50; border-bottom: 2px solid #3498db; }
code { background: #f4f4f4; padding: 2px 6px; }
Troubleshooting
Chromium download fails: Set PUPPETEER_SKIP_DOWNLOAD=1 then manually install Chrome
Memory issues: Large docs may need --max-old-space-size=4096
IMPORTANT Task Planning Notes
- Always plan and break many small todo tasks
- Always add a final review todo task to review the works done at the end to find any fix or enhancement needed
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?