md-to-pdf
Skill2 starsChanged 3 months agoMITView on GitHub
Convert Markdown files to well-formatted PDF with Chinese support, bookmarks, and page numbers. Uses PyMuPDF Story HTML rendering with DroidSansFallbackFull font for full CJK + Latin + special character coverage. Trigger on phrases like "markdown to pdf", "md转pdf", "生成pdf", "导出pdf", "markdown导出", or any request to convert .md files to PDF with proper Chinese rendering and bookmarks. Not for the reverse direction: to turn PDF/DOCX into Markdown, use doc-to-markdown instead.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- thestratcore/My-skillstheir own version, first seen Jul 10, 2026
- luochang212/skillstheir own version, first seen May 9, 2026
- hamzafarooq/claude-code-startertheir own version, first seen May 8, 2026
- loongyowl/my-skillstheir own version, first seen Apr 19, 2026
- Mspagnolo27248/claude-skilltheir own version, first seen Mar 29, 2026
- allenyan513/open-investor-skillstheir own version, first seen Mar 15, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- huangserva/servasyy_skills★ 167same name
- hamzafarooq/claude-code-starter★ 145same name
- madebyecho/agent-skills★ 8same name
- allenyan513/open-investor-skills★ 6same name
- luochang212/skills★ 1same name
- loongyowl/my-skills★ 0same name
- Mspagnolo27248/claude-skill★ 0same name
- thestratcore/My-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- anthropic-designSkill
- apple-designSkill
- atelier-designSkill
- datasheet-readingSkill
- design-evolveSkill
- design-plannerSkill
- design-reviewSkill
- doc-review-loopSkill
- doc-to-markdownSkill
- eclat-designSkill
- ember-designSkill
- gated-dual-clone-auditSkill
- gated-dual-cloneSkill
- glass-designSkill
- hardware-3dSkill
- lectern-designSkill
- linux-kernel-devSkill
- primer-designSkill
- relief-designSkill
- sage-designSkill
- skills-syncSkill
- tech-pdf-readerSkill
- wechat-video-publisherSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
If no font is found automatically, locate one:
- Distinctive: line 59
After generating, verify the PDF:
- Distinctive: line 130
Complex nested lists: Only single-level lists are supported.
- Distinctive: line 131
Images in markdown: Not supported; only text content is converted.
“Common” is measured: kept by at least 6 in 10 of the 6 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.
Files
Markdown to PDF Converter
Convert Markdown files to professional PDFs with full Chinese support, clickable bookmarks, and page numbers.
Features
- Full CJK + Latin + special character support (├── └── │ etc.)
- Auto-generated bookmarks from h1/h2/h3 headings with accurate page jumps
- Code blocks with background shading
- Tables, blockquotes, lists properly formatted
- Page numbers at bottom
- Auto font discovery (DroidSansFallbackFull, NotoSansCJK, WQY, etc.)
Workflow
1. Ensure dependencies
python3 -c "import fitz" 2>/dev/null || pip3 install pymupdf2. Find a CJK font
The script auto-searches for fonts in these locations:
- User-specified
--fontpath ~/.fonts//usr/share/fonts/- Android SDK fonts (DroidSansFallbackFull.ttf)
If no font is found automatically, locate one:
find / -name "DroidSansFallbackFull.ttf" -o -name "NotoSansCJK*" -o -name "wqy-zenhei*" 2>/dev/null | head -53. Run the converter
python3 <skill-dir>/scripts/md2pdf.py input.md output.pdfWith explicit font:
python3 <skill-dir>/scripts/md2pdf.py input.md output.pdf --font /path/to/DroidSansFallbackFull.ttf4. Verify output
After generating, verify the PDF:
import fitz
doc = fitz.open("output.pdf")
print(f"Pages: {len(doc)}")
print(f"Bookmarks: {len(doc.get_toc())}")
# Check first page text renders correctly
print(doc[0].get_text()[:300])Supported Markdown Elements
| Element | Syntax | PDF Rendering |
| Headings | # ## ### | Sized text + bookmark entry |
| Code blocks | ``` | Gray background, monospace-style |
| Inline code | `code` | Red text with pink background |
| Tables | | col | | Bordered table with header shading |
| Blockquotes | > text | Gray text with left border |
| Lists | - item / 1. item | Bulleted / numbered |
| Bold | **text** | Bold text |
| Links | [text](url) | Text preserved, URL stripped |
| HR | --- | Spacer |
Font Recommendation
DroidSansFallbackFull.ttf is the recommended font. It produces ~7.7MB PDFs and covers:
- Latin characters (A-Z, a-z, 0-9)
- CJK Chinese characters
- Box-drawing characters (├── └── │)
- All common symbols
This font is bundled in Android SDK at frameworks/base/data/fonts/DroidSansFallbackFull.ttf.
Bookmark accuracy
Bookmarks are located by finding each heading's text in the rendered pages, with three safeguards (added 2026-07-23 after real breakage in a CJK document):
- Fallback beyond
search_for()— PyMuPDF'ssearch_for()silently fails on some headings (observed with、()/and enclosed numerals like②④). It used to fall back to page 1, so those bookmarks jumped to the cover. Now a normalizedget_text()line scan catches them. - Monotonic search — each heading is searched from the previous heading's page onward, so a later heading can't match an earlier page that repeats the same words.
- HTML entities un-escaped — a heading like
路径 <version>is<version>in the intermediate HTML but renders as<version>; without un-escaping, the lookup could never match.
Verify after generating:
import fitz, unicodedata
def norm(s): return unicodedata.normalize("NFC", s).strip()
d = fitz.open("output.pdf")
lines = [[norm(l) for l in d[i].get_text().split("\n")] for i in range(len(d))]
for lvl, title, pg in d.get_toc():
key = norm(title)
real = next((i+1 for i, ls in enumerate(lines) if any(key == l or key in l for l in ls)), None)
if real != pg:
print(f"BAD: {title} -> bookmark p{pg}, actually p{real}")Regression baseline: two CJK documents (8 pages / 19 bookmarks and 11 pages / 28 bookmarks) both report 0 mismatched bookmarks.
Edge Cases
- No CJK font available: Script exits with error message. User must provide
--font. - Very long documents: PyMuPDF handles multi-page layout automatically.
- Complex nested lists: Only single-level lists are supported; nested items render as flat.
- Images in markdown: Not supported; only text content is converted.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

