whitepaper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseProfessional PDF Generator
专业PDF生成工具
This skill converts Markdown files into professionally typeset PDF whitepapers using pandoc and typst.
本Skill使用pandoc和typst将Markdown文件转换为排版专业的PDF白皮书。
Assets
资源
The skill includes (located in the plugin's root directory):
- Typst template:
templates/whitepaper.typ - Source Sans 3 fonts: — variable fonts supporting all weights (open source from Google Fonts)
fonts/ - Source Code Pro fonts: (Regular, Bold, Italic, Bold Italic) — used for code blocks and inline code
fonts/
Plugin Root: The plugin root is determined dynamically (see Step 2.5 below)
本Skill包含以下内容(位于插件根目录):
- Typst模板:
templates/whitepaper.typ - Source Sans 3字体:—— 支持全字重的可变字体(来自Google Fonts的开源字体)
fonts/ - Source Code Pro字体:(常规、粗体、斜体、粗斜体)—— 用于代码块和行内代码
fonts/
插件根目录:插件根目录会动态确定(见下文第2.5步)
Typography Hierarchy
排版层级
| Element | Weight | Style |
|---|---|---|
| Headlines (H1) | Black (900) | Large, tight tracking |
| Section headlines (H2) | Bold (700) | Blue accent line |
| Subheads (H3, H4) | Bold (700) | Medium size |
| Body copy | Regular (400) | Justified, comfortable leading |
| Code | Source Code Pro | Monospace |
| 元素 | 字重 | 样式 |
|---|---|---|
| 主标题(H1) | Black(900) | 大字号,紧凑字距 |
| 章节标题(H2) | Bold(700) | 蓝色装饰线 |
| 子标题(H3、H4) | Bold(700) | 中等字号 |
| 正文 | Regular(400) | 两端对齐,舒适行高 |
| 代码 | Source Code Pro | 等宽字体 |
CRITICAL: FULLY AUTOMATIC EXECUTION
重要说明:完全自动执行
THIS SKILL RUNS COMPLETELY UNATTENDED. DO NOT:
- Ask "Should I proceed?" before generating PDF
- Ask "Should I delete these files?" before cleanup
- Ask "Is this okay?" at any step
- Wait for user confirmation between steps
- Pause to show intermediate results
- Request permission for file operations
REQUIRED BEHAVIOR:
- Execute all steps sequentially without stopping
- Generate PDF immediately when invoked
- Delete ALL source files immediately after PDF is created
- Only communicate with user AFTER everything is complete
- Report final result: "PDF created: [path]"
If you find yourself about to ask the user a question during PDF generation or cleanup, STOP and just execute the operation instead.
本Skill完全自动运行。请勿:
- 生成PDF前询问“是否继续?”
- 清理前询问“是否删除这些文件?”
- 在任何步骤询问“这样可以吗?”
- 在步骤之间等待用户确认
- 暂停以展示中间结果
- 请求文件操作权限
必须遵循的行为:
- 按顺序执行所有步骤,无需停顿
- 调用后立即生成PDF
- PDF生成完成后立即删除所有源文件
- 仅在所有操作完成后与用户沟通
- 报告最终结果:"PDF已创建:[路径]"
如果在PDF生成或清理过程中你想要向用户提问,请停止提问并直接执行操作。
Usage
使用方法
When the user asks to create a PDF, follow these steps:
当用户要求创建PDF时,请遵循以下步骤:
1. Determine Input and Output
1. 确定输入与输出
- Parse for the input markdown file and optional output PDF path
$ARGUMENTS - If no output path is given, use the same name as the input with a extension
.pdf - If no input is given, ask the user which markdown file to convert
- Check the file's YAML frontmatter (see "Frontmatter Reference" below). If is missing, ask the user for a title before proceeding. If
titleis missing, default to today's date.date
- 解析获取输入Markdown文件和可选的输出PDF路径
$ARGUMENTS - 如果未指定输出路径,使用与输入文件同名的文件
.pdf - 如果未指定输入文件,询问用户要转换哪个Markdown文件
- 检查文件的YAML前置内容(见下文“前置内容参考”)。如果缺少字段,在继续前询问用户标题。如果缺少
title字段,默认使用当前日期。date
2. Install Dependencies (if missing)
2. 安装依赖(如果缺失)
Run for each missing tool — the script auto-detects the platform:
bash
OS=$(uname -s)为每个缺失的工具运行以下命令——脚本会自动检测平台:
bash
OS=$(uname -s)pandoc
pandoc
command -v pandoc >/dev/null 2>&1 || {
[ "$OS" = "Darwin" ] && brew install pandoc || sudo apt-get update && sudo apt-get install -y pandoc
}
command -v pandoc >/dev/null 2>&1 || {
[ "$OS" = "Darwin" ] && brew install pandoc || sudo apt-get update && sudo apt-get install -y pandoc
}
typst
typst
command -v typst >/dev/null 2>&1 || {
[ "$OS" = "Darwin" ] && brew install typst || {
curl -fsSL https://github.com/typst/typst/releases/latest/download/typst-x86_64-unknown-linux-musl.tar.xz
| tar xJ --strip-components=1 -C /usr/local/bin/ typst-x86_64-unknown-linux-musl/typst chmod +x /usr/local/bin/typst } }
| tar xJ --strip-components=1 -C /usr/local/bin/ typst-x86_64-unknown-linux-musl/typst chmod +x /usr/local/bin/typst } }
undefinedcommand -v typst >/dev/null 2>&1 || {
[ "$OS" = "Darwin" ] && brew install typst || {
curl -fsSL https://github.com/typst/typst/releases/latest/download/typst-x86_64-unknown-linux-musl.tar.xz
| tar xJ --strip-components=1 -C /usr/local/bin/ typst-x86_64-unknown-linux-musl/typst chmod +x /usr/local/bin/typst } }
| tar xJ --strip-components=1 -C /usr/local/bin/ typst-x86_64-unknown-linux-musl/typst chmod +x /usr/local/bin/typst } }
undefined2.5 Locate Plugin Root Directory
2.5 定位插件根目录
CRITICAL: Determine the plugin root before copying assets.
The plugin root contains and directories. Use this single command:
templates/fonts/bash
PLUGIN_ROOT=$([ -d ".claude/plugins/project-management" ] && echo ".claude/plugins/project-management" || echo "$CLAUDE_PLUGIN_ROOT")
echo "Using plugin root: $PLUGIN_ROOT"
ls "$PLUGIN_ROOT/templates/whitepaper.typ" || echo "ERROR: Template not found!"Expected location:
.claude/plugins/project-management重要说明:复制资源前必须确定插件根目录。
插件根目录包含和目录。使用以下命令:
templates/fonts/bash
PLUGIN_ROOT=$([ -d ".claude/plugins/project-management" ] && echo ".claude/plugins/project-management" || echo "$CLAUDE_PLUGIN_ROOT")
echo "Using plugin root: $PLUGIN_ROOT"
ls "$PLUGIN_ROOT/templates/whitepaper.typ" || echo "ERROR: Template not found!"预期位置:
.claude/plugins/project-management3. Copy Template to Output Directory
3. 复制模板到输出目录
Copy the typst template to the same directory as the output PDF:
bash
PLUGIN_ROOT=$([ -d ".claude/plugins/project-management" ] && echo ".claude/plugins/project-management" || echo "$CLAUDE_PLUGIN_ROOT")
cp "$PLUGIN_ROOT/templates/whitepaper.typ" <output-directory>/whitepaper.typReplace with the directory where the PDF will be generated (e.g., ).
<output-directory>project-guides/将typst模板复制到输出PDF所在的目录:
bash
PLUGIN_ROOT=$([ -d ".claude/plugins/project-management" ] && echo ".claude/plugins/project-management" || echo "$CLAUDE_PLUGIN_ROOT")
cp "$PLUGIN_ROOT/templates/whitepaper.typ" <output-directory>/whitepaper.typ将替换为PDF生成的目录(例如:)。
<output-directory>project-guides/4. Run Pandoc
4. 运行Pandoc
Execute the conversion with these exact flags. Run from the output directory so the template is found:
bash
cd <output-directory> && \
PLUGIN_ROOT=$(if [ -d "../.claude/plugins/project-management" ]; then echo "../.claude/plugins/project-management"; elif [ -d ".claude/plugins/project-management" ]; then echo ".claude/plugins/project-management"; else echo "$CLAUDE_PLUGIN_ROOT"; fi) && \
TYPST_FONT_PATHS="$PLUGIN_ROOT/fonts" pandoc <input.md> \
-o <output.pdf> \
--pdf-engine=typst \
-V template="whitepaper.typ" \
-V mainfont="Source Sans 3" \
-V fontsize=10pt \
-V papersize=a4Example for :
project-guides/ADMIN-GUIDE.mdbash
cd content && \
PLUGIN_ROOT=$([ -d "../.claude/plugins/project-management" ] && echo "../.claude/plugins/project-management" || echo "$CLAUDE_PLUGIN_ROOT") && \
TYPST_FONT_PATHS="$PLUGIN_ROOT/fonts" pandoc ADMIN-GUIDE.md -o ADMIN-GUIDE.pdf --pdf-engine=typst -V template="whitepaper.typ" -V mainfont="Source Sans 3" -V fontsize=10pt -V papersize=a4Note: Do not pass — the template generates its own table of contents page with proper styling.
--toc使用以下精确参数执行转换。从输出目录运行以确保能找到模板:
bash
cd <output-directory> && \
PLUGIN_ROOT=$(if [ -d "../.claude/plugins/project-management" ]; then echo "../.claude/plugins/project-management"; elif [ -d ".claude/plugins/project-management" ]; then echo ".claude/plugins/project-management"; else echo "$CLAUDE_PLUGIN_ROOT"; fi) && \
TYPST_FONT_PATHS="$PLUGIN_ROOT/fonts" pandoc <input.md> \
-o <output.pdf> \
--pdf-engine=typst \
-V template="whitepaper.typ" \
-V mainfont="Source Sans 3" \
-V fontsize=10pt \
-V papersize=a4针对的示例:
project-guides/ADMIN-GUIDE.mdbash
cd content && \
PLUGIN_ROOT=$([ -d "../.claude/plugins/project-management" ] && echo "../.claude/plugins/project-management" || echo "$CLAUDE_PLUGIN_ROOT") && \
TYPST_FONT_PATHS="$PLUGIN_ROOT/fonts" pandoc ADMIN-GUIDE.md -o ADMIN-GUIDE.pdf --pdf-engine=typst -V template="whitepaper.typ" -V mainfont="Source Sans 3" -V fontsize=10pt -V papersize=a4注意:请勿传递参数——模板会自动生成样式规范的目录页。
--toc5. Clean Up (MANDATORY - DO NOT SKIP)
5. 清理(必须执行 - 请勿跳过)
CRITICAL: You MUST execute cleanup immediately after PDF generation. Only PDF should remain.
bash
undefined重要说明:PDF生成完成后必须立即执行清理。仅保留PDF文件。
bash
undefinedRemove ALL intermediate files in one command
一条命令删除所有中间文件
rm -f <output-directory>/whitepaper.typ <input.md> <input-without-extension>.plain.html <input-without-extension>.html
**Example cleanup for `project-guides/AUTHOR-GUIDE.md`:**
```bash
rm -f project-guides/whitepaper.typ project-guides/AUTHOR-GUIDE.md project-guides/AUTHOR-GUIDE.plain.html project-guides/AUTHOR-GUIDE.htmlAfter cleanup, only should exist. No .md, .html, or .plain.html files.
project-guides/AUTHOR-GUIDE.pdfrm -f <output-directory>/whitepaper.typ <input.md> <input-without-extension>.plain.html <input-without-extension>.html
**针对`project-guides/AUTHOR-GUIDE.md`的清理示例:**
```bash
rm -f project-guides/whitepaper.typ project-guides/AUTHOR-GUIDE.md project-guides/AUTHOR-GUIDE.plain.html project-guides/AUTHOR-GUIDE.html清理完成后,仅应保留文件。不应存在.md、.html或.plain.html文件。
project-guides/AUTHOR-GUIDE.pdf6. Report Result
6. 报告结果
"PDF created: [output.pdf]""PDF已创建:[output.pdf]"Frontmatter Reference
前置内容参考
The template reads pandoc YAML frontmatter from the markdown file to populate the title page and footer. The frontmatter block must be the very first thing in the file, delimited by lines.
---模板会从Markdown文件中读取pandoc YAML前置内容,用于填充标题页和页脚。前置内容块必须是文件的第一部分,用行分隔。
---Required Fields
必填字段
| Field | Purpose | Example |
|---|---|---|
| Cover page headline, PDF metadata | |
| 字段 | 用途 | 示例 |
|---|---|---|
| 封面标题,PDF元数据 | |
Recommended Fields
推荐字段
| Field | Purpose | Example |
|---|---|---|
| Second line on cover, below the accent line | |
| Cover page and page footer | |
| 字段 | 用途 | 示例 |
|---|---|---|
| 封面第二行,位于装饰线下方 | |
| 封面和页脚显示 | |
Optional Fields
可选字段
| Field | Purpose | Example |
|---|---|---|
| Author list on cover page | See structured example below |
| 字段 | 用途 | 示例 |
|---|---|---|
| 封面作者列表 | 见下方结构化示例 |
Minimal Example
最简示例
yaml
---
title: "AEM Code Sync for Edge Delivery Services"
subtitle: "Technical Architecture and Security Documentation"
date: "January 29, 2026"
---yaml
---
title: "AEM Code Sync for Edge Delivery Services"
subtitle: "Technical Architecture and Security Documentation"
date: "January 29, 2026"
---Full Example with Authors
包含作者的完整示例
yaml
---
title: "AEM Code Sync for Edge Delivery Services"
subtitle: "Technical Architecture and Security Documentation"
date: "January 29, 2026"
author:
- name: "Jane Smith"
affiliation: "Edge Delivery Services"
- name: "John Doe"
affiliation: "Security Engineering"
---yaml
---
title: "AEM Code Sync for Edge Delivery Services"
subtitle: "Technical Architecture and Security Documentation"
date: "January 29, 2026"
author:
- name: "Jane Smith"
affiliation: "Edge Delivery Services"
- name: "John Doe"
affiliation: "Security Engineering"
---What the Template Renders
模板渲染内容
- Title: Large black-weight text on the cover
- Subtitle: Lighter text below the accent divider line
- Date: Shown on the cover and in the page footer
- Authors: Listed on the cover with optional affiliation
- 标题:封面的大字号黑粗体文本
- 副标题:装饰分隔线下方的浅色文本
- 日期:显示在封面和页脚
- 作者:在封面列出,可包含所属机构
Common Mistakes
常见错误
- Putting the frontmatter after a heading or blank line (it must be the first thing in the file)
- Using unquoted strings that contain colons, e.g. -- wrap in quotes
title: AEM: A Guide - Adding pandoc variables like or
fontsizein the frontmatter -- pass those aspapersizeflags to pandoc instead (the skill handles this automatically)-V
- 将前置内容放在标题或空行之后(必须是文件的第一部分)
- 使用包含冒号的未加引号字符串,例如—— 需用引号包裹
title: AEM: A Guide - 在前置内容中添加或
fontsize等pandoc变量 —— 应作为papersize参数传递给pandoc(本Skill会自动处理)-V
Template Design
模板设计
The template provides professional document formatting:
- Professional typography using Source Sans 3 (open source font from Google Fonts)
- Blue accent color (#0066cc) for section dividers and links
- Clean header with title/subtitle (no separator line)
- Footer with date and page numbering (hidden on title page)
- Source Code Pro for code blocks and inline code
- Automatic table of contents page
- Title page with accent divider line
模板提供专业的文档格式:
- 专业排版:使用Source Sans 3(来自Google Fonts的开源字体)
- 蓝色装饰色(#0066cc):用于章节分隔线和链接
- 简洁页眉:包含标题/副标题(无分隔线)
- 页脚:包含日期和页码(标题页隐藏)
- Source Code Pro:用于代码块和行内代码
- 自动生成目录页
- 带装饰分隔线的标题页
Template Features
模板特性
| Feature | Description |
|---|---|
| Title page | Clean design with title, subtitle, date, authors |
| Table of contents | Auto-generated on page 2 |
| H1 headings | Black weight, page break before |
| H2 headings | Bold with blue accent line |
| Code blocks | Gray background, rounded corners |
| Blockquotes | Blue left border, light blue background |
| Tables | Light borders, bold header row |
| Links | Blue color (#0066cc) |
| 特性 | 描述 |
|---|---|
| 标题页 | 简洁设计,包含标题、副标题、日期、作者 |
| 目录 | 自动生成在第2页 |
| H1标题 | 黑粗体,前分页 |
| H2标题 | 粗体加蓝色装饰线 |
| 代码块 | 灰色背景,圆角 |
| 引用块 | 蓝色左侧边框,浅蓝色背景 |
| 表格 | 浅色边框,粗体表头行 |
| 链接 | 蓝色(#0066cc) |
Customizing the Document
自定义文档
The user can override pandoc variables with :
-V key=value| Variable | Default | Description |
|---|---|---|
| | Page size ( |
| | Base font size |
| | Typst template file |
| | Main body font |
用户可通过覆盖pandoc变量:
-V key=value| 变量 | 默认值 | 描述 |
|---|---|---|
| | 页面尺寸( |
| | 基础字号 |
| | Typst模板文件 |
| | 正文主字体 |
Requirements
要求
- and
pandocmust be installed (the skill auto-installs them if missing)typst- macOS: via Homebrew ()
brew - Linux: via
pandoc,apt-getvia GitHub release binarytypst
- macOS: via Homebrew (
- Source Sans 3 fonts are included in the plugin's directory
fonts/
- 必须安装和
pandoc(如果缺失,本Skill会自动安装)typst- macOS:通过Homebrew()安装
brew - Linux:通过
pandoc安装,apt-get通过GitHub发布的二进制文件安装typst
- macOS:通过Homebrew(
- Source Sans 3字体包含在插件的目录中
fonts/
Troubleshooting
故障排除
If fonts are not found by typst, ensure the environment variable is set correctly:
TYPST_FONT_PATHSbash
export TYPST_FONT_PATHS=${CLAUDE_PLUGIN_ROOT}/fonts| Issue | Solution |
|---|---|
| Font not found | Check TYPST_FONT_PATHS points to plugin's fonts/ directory |
| Template not found | Ensure whitepaper.typ was copied to output directory |
| Tables not breaking | Template handles this automatically |
| Missing title page | Check frontmatter has |
如果typst找不到字体,请确保环境变量设置正确:
TYPST_FONT_PATHSbash
export TYPST_FONT_PATHS=${CLAUDE_PLUGIN_ROOT}/fonts| 问题 | 解决方案 |
|---|---|
| 字体未找到 | 检查TYPST_FONT_PATHS指向插件的fonts/目录 |
| 模板未找到 | 确保whitepaper.typ已复制到输出目录 |
| 表格未分页 | 模板会自动处理此问题 |
| 缺少标题页 | 检查前置内容是否包含 |