huashu-md-to-pdf

alchaincyf/huashu-skills · updated Jun 1, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/alchaincyf/huashu-skills --skill huashu-md-to-pdf
0 commentsdiscussion
summary

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

skill.md

Markdown to PDF Skill

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

核心功能

  1. 专业排版:书籍级排版质量,自动处理分页、孤行寡行
  2. 苹果设计:SF 字体系统、现代简洁风格、专业配色
  3. 完整目录:自动提取章节结构,双列布局,可点击跳转
  4. Markdown 完美支持:代码块、表格、引用、列表等全部正确渲染

使用方法

基础用法

# 转换单个文件
python scripts/convert.py input.md

# 指定输出文件名
python scripts/convert.py input.md -o "我的白皮书.pdf"

# 自定义标题和作者
python scripts/convert.py input.md --title "技术白皮书" --author "花叔"

Markdown 文档要求

你的 Markdown 文档应该遵循以下结构:

# 文档标题

## 1. 第一章
### 1.1 第一节
### 1.2 第二节

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

关键规则

  • 主章节:## 1. 标题(数字 + 点 + 空格 + 标题)
  • 子章节:### 1.1 标题(数字.数字 + 空格 + 标题)
  • 这样才能正确提取目录

设计特点

封面设计

  • 淡灰色渐变背景
  • 大标题:64pt,简洁现代
  • 副标题和元信息

目录设计

  • 双列布局,单页展示
  • 主章节粗体,子章节缩进
  • 可点击跳转到对应章节

正文排版

  • SF 字体系列(苹果设计语言)
  • 行高 1.7,舒适阅读
  • 章节自动分页
  • 孤行寡行控制

代码块

  • 浅灰背景 + 细边框
  • 圆角 8px
  • SF Mono 等宽字体
  • 自动避免分页

表格

  • 清晰网格线
  • 浅灰表头
  • 自动保留表头(长表格分页时)

配置选项

如果需要自定义样式,可以修改 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'

常见问题

Q: 目录为什么是空的?

A: 确保你的 Markdown 使用了正确的章节格式:

  • ## 1. 标题 而不是 ## 标题
  • ### 1.1 标题 而不是 ### 标题

Q: 代码块显示不正确?

A: 确保使用三个反引号包裹:

```python
def hello():
    print("Hello")
```

Q: 表格格式乱了?

A: 使用标准的 Markdown 表格语法:

| 列1 | 列2 |
|-----|-----|
| 值1 | 值2 |

Q: 如何修改字体?

A: 编辑 scripts/convert.py 中的 CSS,修改 font-family 属性。

Q: 生成的 PDF 太大?

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 使用:

  • markdown2:Markdown 解析(支持扩展语法)
  • WeasyPrint:HTML to PDF 转换(支持 CSS3)
  • 苹果设计系统:SF 字体、专业配色、现代排版

更新日志

v1.0 (2025-12-24)

  • 初始版本
  • 支持完整 Markdown 语法
  • 苹果设计风格
  • 自动目录生成
  • 书籍级排版质量

花叔出品 | AI Native Coder · 独立开发者 公众号「花叔」| 30万+粉丝 | AI工具与效率提升 代表作:小猫补光灯(AppStore付费榜Top1)·《一本书玩转DeepSeek》

how to use huashu-md-to-pdf

How to use huashu-md-to-pdf on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add huashu-md-to-pdf
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/alchaincyf/huashu-skills --skill huashu-md-to-pdf

The skills CLI fetches huashu-md-to-pdf from GitHub repository alchaincyf/huashu-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/huashu-md-to-pdf

Reload or restart Cursor to activate huashu-md-to-pdf. Access the skill through slash commands (e.g., /huashu-md-to-pdf) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.528 reviews
  • Yuki Mehta· Dec 16, 2024

    huashu-md-to-pdf fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Fatima Huang· Dec 8, 2024

    Registry listing for huashu-md-to-pdf matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Sakura Park· Nov 27, 2024

    Solid pick for teams standardizing on skills: huashu-md-to-pdf is focused, and the summary matches what you get after install.

  • Arya Sanchez· Nov 15, 2024

    I recommend huashu-md-to-pdf for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Fatima Dixit· Nov 7, 2024

    We added huashu-md-to-pdf from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Yusuf Perez· Oct 26, 2024

    Solid pick for teams standardizing on skills: huashu-md-to-pdf is focused, and the summary matches what you get after install.

  • James Thomas· Oct 18, 2024

    We added huashu-md-to-pdf from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Mei Kapoor· Oct 6, 2024

    huashu-md-to-pdf reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Ren Desai· Sep 25, 2024

    Keeps context tight: huashu-md-to-pdf is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Yash Thakker· Sep 17, 2024

    Useful defaults in huashu-md-to-pdf — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

showing 1-10 of 28

1 / 3