huashu-md-to-pdf

huashu-md-to-pdf is a skill for Claude Code, Codex from alchaincyf/huashu-skills. It costs 83 tokens per session (1,690 once invoked), scanned A, original, MIT.

A document converter that turns Markdown files into professionally formatted PDF white papers with an Apple-style design.

In plain words
What is it for?
Use it to create PDFs from technical documents, white papers, tutorials, and reports, including code blocks, tables, quotes, lists, covers, contents pages, headers, and footers.
Why use it?
It saves you from formatting long Markdown documents manually for publication.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ![示意图](./assets/arch.png).

Good fit Use it to create PDFs from technical documents, white papers, tutorials, and reports, including code blocks, tables, quotes, lists, covers, contents pages, headers, and footers.

Compare 6 skills from other repositories ↓
About the project

huashu-skills is a catalogue of Agent Skills, which are reusable instruction packages that extend coding agents such as Claude Code, Codex, and Kimi Code for particular tasks. It organizes skills for design, research, document conversion, content creation, and other workflows, and includes machine-readable metadata and update checking. The catalogue entries are the skills and related tools that agents install and use.

alchaincyf/huashu-skills · 2,025 stars · on GitHub

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/alchaincyf/huashu-skills
agentmods
npx agentmods add skills/alchaincyf/huashu-skills/huashu-md-to-pdf

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for huashu-md-to-pdf

README.md
[![agentmods](https://agentmods.dev/badge/skills/alchaincyf/huashu-skills/huashu-md-to-pdf/github.svg)](https://agentmods.dev/skills/alchaincyf/huashu-skills/huashu-md-to-pdf)
Your own site
<a href="https://agentmods.dev/skills/alchaincyf/huashu-skills/huashu-md-to-pdf"><img src="https://agentmods.dev/badge/skills/alchaincyf/huashu-skills/huashu-md-to-pdf/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for huashu-md-to-pdf

Your own site · 80×15
<a href="https://agentmods.dev/skills/alchaincyf/huashu-skills/huashu-md-to-pdf"><img src="https://agentmods.dev/badge/skills/alchaincyf/huashu-skills/huashu-md-to-pdf.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,690 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 15 Sept 2026
  • Snyk pass 15 Sept 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00083 $0.01690
Opus 5.5 $0.00033 $0.00676
Sonnet 5.5 $0.00017 $0.00338
Haiku 4.5 $0.00008 $0.00169

Measured 1mo ago against content hash 6accb3d469ac, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

huashu-md-to-pdf scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/convert.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

huashu-md-to-pdf/SKILL.md · 204 lines

How it starts

The opening of the file, as written. The whole thing — 204 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 文档应该遵循以下结构:

# 文档标题

## 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 标题 而不是 ### 标题

Read the full file on GitHub · 204 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 204 lines · 83 tokens per session scan A 6accb3d469ac

Subscribe to this mod's changes

huashu-md-to-pdf is a skill published in the GitHub repository alchaincyf/huashu-skills (2,025 stars, last pushed yesterday), licensed MIT. It adds 83 tokens to every session and 1,690 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.