Skip to content

alchaincyf/huashu-skills / huashu-md-to-pdf

huashu-md-to-pdf

Verified

将 Markdown 文档转换为专业的 PDF 白皮书,采用苹果设计风格。 支持完整的 Markdown 语法(代码块、表格、引用、列表等)。 自动生成封面、目录、页眉页脚。 使用场景:技术文档、白皮书、教程、报告等需要专业排版的 Markdown 文档。

FileKindSize
EXAMPLES.mdmarkdown3.7 KB
README.mdmarkdown2.1 KB
SKILL.mdskill md5.5 KB
scripts/convert.pyexecutablescript18.6 KB
# Markdown to PDF Skill

将 Markdown 文档转换为专业的苹果设计风格 PDF 白皮书。

## 快速开始

### 1. 安装依赖(仅首次)

```bash
pip3 install markdown2 weasyprint
```

### 2. 基础使用

```bash
# 转换 Markdown 文件
python .claude/skills/markdown-to-pdf/scripts/convert.py your-file.md

# 指定输出文件名
python .claude/skills/markdown-to-pdf/scripts/convert.py your-file.md -o "我的白皮书.pdf"

# 自定义标题和作者
python .claude/skills/markdown-to-pdf/scripts/convert.py your-file.md --title "技术白皮书" --author "花叔"
```

## Markdown 格式要求

你的文档应该使用带序号的章节格式:

```markdown
# 文档标题

## 1. 第一章
### 1.1 第一节
内容...

### 1.2 第二节
内容...

## 2. 第二章
### 2.1 第一节
...
```

**关键点**:
- ✅ `## 1. 标题` - 正确(数字.空格标题)
- ❌ `## 标题` - 错误(无序号)
- ✅ `### 1.1 标题` - 正确
- ❌ `### 标题` - 错误

## 设计特点

- 📖 **书籍级排版**:自动分页、孤行寡行控制
- 🎨 **苹果设计语言**:SF 字体、现代简洁
- 📑 **自动目录**:双列布局、可点击跳转
- 💻 **完美代码块**:语法高亮、圆角边框
- 📊 **专业表格**:清晰网格、自动表头

## 文件结构

```
.claude/skills/markdown-to-pdf/
├── SKILL.md              # Skill 说明文档
├── README.md             # 本文件
└── scripts/
    └── convert.py        # 转换脚本
```

## 示例

在 Claude Code 中使用:

```
用户:帮我把这个 Markdown 文档转成 PDF
Claude:好的,我使用 markdown-to-pdf skill 来转换
       [执行] python .claude/skills/markdown-to-pdf/scripts/convert.py document.md
       ✅ 已生成 document.pdf
```

## 常见问题

**Q: WeasyPrint 安装失败?**
```bash
# macOS
brew install pango
pip3 install weasyprint

# Linux
sudo apt-get install libpango-1.0-0 libpangocairo-1.0-0
pip3 install weasyprint
```

**Q: 目录为空?**
确保使用 `## 1.` 和 `### 1.1` 格式。

**Q: 代码块显示不正确?**
使用三个反引号包裹代码。

## 更新日志

- **v1.0** (2025-12-24): 初始版本
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall