skills/md-to-pdf/SKILL.md
--- name: md-to-pdf description: Use when converting Markdown files (.md) to PDF on macOS, Windows, or Linux, especially files containing CJK (Chinese/Japanese/Korean) text. Triggers include "convert md to pdf", "markdown to pdf", "generate pdf from markdown", "export md as pdf", "md转pdf". Two cross-platform backends: Playwright/Chromium for best quality (default), reportlab for pure-Python lightweight fallback. --- # Markdown to PDF Converter Two cross-platform backends. Choose based on your
npx skillsauth add luochang212/skills skills/md-to-pdfInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Two cross-platform backends. Choose based on your situation:
| | Playwright (convert_playwright.py) | reportlab (convert_reportlab.py) |
|------|-----------|------------|
| Quality | Perfect — full browser rendering | Good — manual Flowable layout |
| CJK | Native — system fonts just work | Manual font registration per platform |
| Special chars | Native — box-drawing, arrows, emoji | Replaced with ASCII (see Fix 1 in script) |
| CSS theming | Full CSS | Hardcoded HexColor values |
| Images | Rendered | Placeholder text |
| Italic | Rendered | Intentionally skipped (conflicts with code tags) |
| Dependencies | ~150MB (Chromium) | ~10MB (pure Python) |
| Platforms | macOS, Windows, Linux | macOS, Windows, Linux |
# Playwright (best quality, needs Chromium)
python scripts/convert_playwright.py input.md [output.pdf]
# reportlab (pure Python, no Chromium needed)
python scripts/convert_reportlab.py input.md [output.pdf]
If no output path is given, replaces .md with .pdf.
convert_playwright.py)The recommended default. Pipeline:
.md → mdformat → markdown → HTML + CSS → Playwright/Chromium → PDF
CSS variable to change colors, fonts, spacingcodehilite extensionmdx_math + KaTeX CDN (falls back to LaTeX source if offline)pip install playwright markdown mdformat pygments python-markdown-math
playwright install chromium
convert_reportlab.py)Pure Python, no browser dependency. Pipeline:
.md → mdformat → sanitize_unicode() → markdown → BeautifulSoup → Flowables → reportlab → PDF
_FONTS)pip install reportlab markdown beautifulsoup4 mdformat
When deeper platform guidance is needed, read the relevant reference:
references/macos.md — font paths, TTC subfont indices, Apple Silicon notesreferences/windows.md — font paths, WeasyPrint caveat, wkhtmltopdf alternativePlaywright works on Linux if Chromium dependencies are installed (playwright install-deps chromium). The reportlab backend uses generic CJK font names by default — you may need to edit _FONTS in convert_reportlab.py to match your distribution's font paths.
Add Tencent Cloud mirror:
pip install <packages> --index-url https://mirrors.cloud.tencent.com/pypi/simple/
development
Create beautiful, self-contained single-file HTML reports, landing pages, and documents that are visual, interactive, and spatial. Use when the user wants to present information that would benefit from layout, color, diagrams, or interaction — such as project reports, product pages, architecture overviews, design documents, dashboards, slide decks, code review summaries, incident post-mortems, status reports, or any document where plain text would be too flat. Triggers include "create an HTML page", "make a report", "write a landing page", "build a dashboard", "present this information visually", or any request to communicate technical or business information in a polished, readable format.
development
Use when the user asks to review code quality, find redundant code, audit duplication, or "clean up" a codebase. Also use when the user says "find issues" or "anything worth fixing" after a feature is built. This skill provides a systematic framework for identifying code quality issues, evaluating whether each fix is worth making, and safely applying changes without over-engineering.
development
Security audit and code scanning. Use when the user asks to scan code for bugs/vulnerabilities, audit security, run SAST, find code patterns, or review code for security issues. Supports two modes — fast pattern scanning (Semgrep) for quick results and CI gating, and deep AI-powered investigation (deepsec) for thorough reasoning-based analysis. Also use when the user mentions "semgrep", "deepsec", "static analysis", "security scan", "code scanning", "find vulnerabilities", "scan my code", or "security audit".
development
AI-powered vulnerability scanning with deepsec. Use when the user asks to audit security, scan for vulnerabilities, run a deep security audit, or review code for security issues. Also use when the user mentions "deepsec", "AI security scan", "agent-powered audit", "deep code audit", or wants to find hard-to-find vulnerabilities that grep/Semgrep would miss. Use for PR security review when the user mentions "review this PR for security" or "check these changes for vulnerabilities". Prefer this over semgrep when the user wants thorough, reasoning-based investigation rather than pattern matching.