
Huashu Md To Pdf
Converts Markdown files to professionally formatted PDFs with Apple's design aesthetic. Built on WeasyPrint and markdown2, it automatically generates a cover page, clickable table of contents, and handles code blocks, tables, and standard Markdown syntax without breaking layouts across pages. The catch is your headings need to follow a specific numbering format (like "## 1. Chapter Title" and "### 1.1 Section") or the TOC generation fails. Nice touch: it uses SF fonts, handles orphan/widow control, and keeps code blocks intact during pagination. Created by huashu, who's known for shipping polished dev tools. Best for technical docs, whitepapers, or tutorials where you want that clean, book-quality output without wrestling with LaTeX.
- skills.sh installs
- 1.1K
- GitHub stars
- 2.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add alchaincyf/huashu-skills --skill huashu-md-to-pdf --agent claude-codeInstalls into .claude/skills of the current project.
Files
Markdown to PDF Skill
将 Markdown 文档转换为专业的苹果设计风格 PDF 白皮书。
核心功能
- 专业排版:书籍级排版质量,自动处理分页、孤行寡行
- 苹果设计:SF 字体系统、现代简洁风格、专业配色
- 完整目录:自动提取章节结构,双列布局,可点击跳转
- Markdown 完美支持:代码块、表格、引用、列表等全部正确渲染
使用方法
基础用法
# 转换单个文件
python scripts/convert.py input.md
# 指定输出文件名
python scripts/convert.py input.md -o "我的白皮书.pdf"
# 自定义标题和作者
python scripts/convert.py input.md --title "技术白皮书" --author "花叔"
图片路径
Markdown 里的相对路径图片,是相对 md 文件自身所在目录解析的,目录名和文件名带中文都可以:
 ← 和 md 文件同级的「图片」目录

找不到的图片会在转换时打印警告并列出路径。以前这种情况是静默跳过的,PDF 照样生成、只是没有图。
已知未解决:某些环境下 macOS「预览」打开是乱码
有用户报告生成的 PDF 在 macOS「预览」里是乱码,浏览器打开正常。这个问题还没有解决办法,原因也还没定位——在一台用 Arial Unicode MS 渲染中文的机器上复现不出来,而报告者的字体环境和 weasyprint 版本都不清楚。
不要试图用 weasyprint 的 full_fonts=True 绕过它。 实测:macOS 上的中文字体(PingFang.ttc、Songti.ttc、Hiragino Sans GB.ttc)都是 TrueType Collection,full_fonts=True 会把整个 collection 的原始字节塞进 PDF 的 /FontFile2(magic 是 ttcf 而不是合法的 \x00\x01\x00\x00),结果是文件暴涨到几十 MB,而且照样乱码——实测一段中文从 10 KB 变成 43 MB,渲染出来是「Oě 据⊤」。它让问题更糟,不是逃生出口。
碰到乱码时可以先试:升级 weasyprint、或在 CSS 里换一个非 collection 的字体。
Markdown 文档要求
你的 Markdown 文档应该遵循以下结构:
Sponsors
Details
- Repository
- github.com/alchaincyf/huashu-skills
- Category
- Office & Documents
- First seen
- May 16, 2026
More from alchaincyf/huashu-skills
All 21- Huashu Douyin Script1K
- Huashu Proofreading883
- Huashu Slides844
- Huashu Design776
- Huashu Research753
- Huashu Data Pro748
- Huashu Script Polish741
- Huashu Wechat Image740
- Huashu Xhs Image740
- Huashu Topic Gen734
- Huashu Speech Coach731
- Huashu Article Edit698
- Huashu Video Outline693
- Huashu Info Search692
- Huashu Article To X687
- Huashu Image Upload678
- Huashu Video Check675
- Huashu Material Search673
- Huashu Agent Swarm672
- Huashu Prompt Save662