alchaincyf avatar

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-code

Installs into .claude/skills of the current project.

Files

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 里的相对路径图片,是相对 md 文件自身所在目录解析的,目录名和文件名带中文都可以:

![示意图](图片/架构图.png)     ← 和 md 文件同级的「图片」目录
![示意图](./assets/arch.png)

找不到的图片会在转换时打印警告并列出路径。以前这种情况是静默跳过的,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
1sbroenne avatarexcel-clisbroenne/mcp-server-excelExcel CLI automation skill for Windows workbooks. Use when a coding agent needs token-efficient, scriptable, or unattended Excel automation via excelcli command1Kskills.sh installs
2hkuds avatarcli-anything-obsidianhkuds/cli-anythingCommand-line interface for Obsidian — Knowledge management and note-taking via Obsidian Local REST API. Designed for AI agents and power users who need to manag1Kskills.sh installs
3aradotso avatar724-office-ai-agentaradotso/trending-skills724 office ai agent1Kskills.sh installs
4zubair-trabzada avatargeo-report-pdfzubair-trabzada/geo-seo-claudeGenerate a professional PDF report from a GEO audit using pandoc + Chrome headless. Converts GEO-AUDIT-REPORT.md into a styled, client-ready PDF with a cover pa933skills.sh installs
5jwynia avatarpdf-generatorjwynia/agent-skillsCreate and manipulate PDF files programmatically. Use when the user needs to generate PDFs, fill PDF forms, extract PDF content, add watermarks/overlays, or mer921skills.sh installs
6ailabs-393 avatarpdfailabs-393/ai-labs-claude-skillsComprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to 905skills.sh installs