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.
npx -y skills add alchaincyf/huashu-skills --skill huashu-md-to-pdf --agent claude-codeInstalls into .claude/skills of the current project.
将 Markdown 文档转换为专业的苹果设计风格 PDF 白皮书。
# 转换单个文件
python scripts/convert.py input.md
# 指定输出文件名
python scripts/convert.py input.md -o "我的白皮书.pdf"
# 自定义标题和作者
python scripts/convert.py input.md --title "技术白皮书" --author "花叔"
你的 Markdown 文档应该遵循以下结构:
# 文档标题
## 1. 第一章
### 1.1 第一节
### 1.2 第二节
## 2. 第二章
### 2.1 第一节
关键规则:
## 1. 标题(数字 + 点 + 空格 + 标题)### 1.1 标题(数字.数字 + 空格 + 标题)如果需要自定义样式,可以修改 scripts/convert.py 中的 CSS 变量:
# 主色调
PRIMARY_COLOR = '#06c' # 苹果蓝
TEXT_COLOR = '#1d1d1f' # 主文本黑色
GRAY_COLOR = '#86868b' # 浅灰色
# 字体大小
COVER_TITLE_SIZE = '64pt'
H2_SIZE = '22pt'
H3_SIZE = '17pt'
BODY_SIZE = '11pt'
A: 确保你的 Markdown 使用了正确的章节格式:
## 1. 标题 而不是 ## 标题### 1.1 标题 而不是 ### 标题A: 确保使用三个反引号包裹:
```python
def hello():
print("Hello")
```
A: 使用标准的 Markdown 表格语法:
| 列1 | 列2 |
|-----|-----|
| 值1 | 值2 |
A: 编辑 scripts/convert.py 中的 CSS,修改 font-family 属性。
A: 检查是否有大量图片,考虑压缩图片或使用外链。
首次使用需要安装 Python 依赖:
pip3 install markdown2 weasyprint
如果遇到 WeasyPrint 安装问题(macOS):
brew install pango
pip3 install weasyprint
python scripts/convert.py tech-guide.md -o "技术指南.pdf"
python scripts/convert.py whitepaper.md --title "产品白皮书" --author "团队"
scripts/convert.py - 主转换脚本scripts/styles.css - CSS 样式定义(已嵌入脚本)templates/cover.html - 封面模板(已嵌入脚本)本 Skill 使用:
花叔出品 | AI Native Coder · 独立开发者 公众号「花叔」| 30万+粉丝 | AI工具与效率提升 代表作:小猫补光灯(AppStore付费榜Top1)·《一本书玩转DeepSeek》
larksuite/cli
googleworkspace/cli
googleworkspace/cli
googleworkspace/cli