Agent转换
- 作者仓库星标 21,713
- 叉子 2,492
- 作者更新于 2026年6月13日 05:00
- 作者仓库 baoyu-skills
- 领域
- 文档
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 92 / 100 · 已通过审计
- 作者 / 版本 / 许可
- @JimLiu · v1.57.0 · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需手动接入
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- Bun · Python
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: baoyu-format-markdown
description: Formats plain text or markdown files with frontmatter, titles, summaries, headings, bold, lists…
category: 文档
runtime: Bun / Python
---
# baoyu-format-markdown 输出预览
## PART A: 任务判断
- 适用问题:PRD、RFC、README、项目说明或知识库整理。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“User Input Tools / Script Directory / Preferences (EXTEND.md)”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于PRD、RFC、README、项目说明或知识库整理,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“User Input Tools / Script Directory / Preferences (EXTEND.md)”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“User Input Tools / Script Directory / Preferences (EXTEND.md)”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: baoyu-format-markdown
description: Formats plain text or markdown files with frontmatter, titles, summaries, headings, bold, lists…
category: 文档
source: JimLiu/baoyu-skills
---
# baoyu-format-markdown
## 什么时候使用
- 把粗 Markdown 一键格式化——补 frontmatter、统一标题层级、加粗关键词、断段、清空行 适合处理README、PRD、RFC、教程和知识库文档,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛…
- 面向PRD、RFC、README、项目说明或知识库整理,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「User Input Tools / Script Directory / Preferences (EXTEND.md)」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "baoyu-format-markdown" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> User Input Tools / Script Directory / Preferences (EXTEND.md)
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Bun / Python | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Markdown 格式化工具
将纯文本或 Markdown 转换为结构良好、易于阅读的 Markdown。目标是帮助读者快速掌握要点、亮点和结构,同时不改变任何原始内容。
核心原则:只调整格式并修正明显的拼写错误。绝不添加、删除或重写内容。
用户输入工具
当此技能提示用户时,请遵循以下工具选择规则(优先级顺序):
- 优先使用当前 Agent 运行时提供的内置用户输入工具,例如
AskUserQuestion、request_user_input、clarify、ask_user或任何等效工具。 - 备用方案:如果不存在此类工具,则发出带编号的纯文本消息,并要求用户回复所选的编号/答案以回答每个问题。
- 批量处理:如果工具支持每次调用处理多个问题,则将所有适用问题合并到一次调用中;如果只支持单个问题,则按优先级顺序逐一提问。
下面具体的 AskUserQuestion 引用是示例——在其他运行时中请替换为本地等效工具。
脚本目录
脚本位于 scripts/ 子目录中。{baseDir} = 此 SKILL.md 的目录路径。解析 ${BUN_X} 运行时:如果安装了 bun → bun;如果 npx 可用 → npx -y bun;否则建议安装 bun。将 {baseDir} 和 ${BUN_X} 替换为实际值。
| 脚本 | 用途 |
|---|---|
scripts/main.ts |
带有 CLI 选项的主入口点(使用 remark-cjk-friendly 处理 CJK 强调) |
scripts/quotes.ts |
将 ASCII 引号替换为全角引号 |
scripts/autocorrect.ts |
通过自动更正添加 CJK/英文间距 |
偏好设置 (EXTEND.md)
按优先级顺序检查 EXTEND.md——找到的第一个生效:
| 优先级 | 路径 | 范围 |
|---|---|---|
| 1 | .baoyu-skills/baoyu-format-markdown/EXTEND.md |
项目 |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-format-markdown/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-format-markdown/EXTEND.md |
用户主目录 |
如果未找到,则使用默认值——此技能无需首次设置。
EXTEND.md 支持:
| 设置 | 值 | 默认值 | 描述 |
|---|---|---|---|
auto_select |
true/false |
false |
跳过标题和摘要选择,自动选择最佳 |
auto_select_title |
true/false |
false |
仅跳过标题选择 |
auto_select_summary |
true/false |
false |
仅跳过摘要选择 |
| 其他 | — | — | 默认格式选项、排版偏好设置 |
用法
工作流程分为两个阶段:分析(理解内容)然后格式化(应用格式)。Claude 执行内容分析和格式化(步骤 1-5),然后运行脚本进行排版修正(步骤 6)。
工作流程
步骤 1:读取并检测内容类型
读取用户指定的文件,然后检测内容类型:
| 指示符 | 分类 |
|---|---|
包含 --- YAML Frontmatter |
Markdown |
包含 #、##、### 标题 |
Markdown |
包含 **粗体**、*斜体*、列表、代码块、引用块 |
Markdown |
| 以上均不符合 | 纯文本 |
如果检测到 Markdown,使用 AskUserQuestion 提问:
检测到现有 Markdown 格式。您想怎么做?
1. 优化格式(推荐)
- 分析内容,改进标题、粗体、列表以提高可读性
- 运行排版脚本(间距、强调修正)
- 输出:{filename}-formatted.md
2. 保留原始格式
- 保留现有 Markdown 结构
- 仅运行排版脚本
- 输出:{filename}-formatted.md
3. 仅修正排版
- 在原始文件上原地运行排版脚本
- 不创建副本,直接修改原始文件
根据用户选择:
- 优化:继续执行步骤 2(完整工作流程)
- 保留原始:跳到步骤 5,复制文件然后运行步骤 6
- 仅修正排版:跳到步骤 6,直接在原始文件上运行
步骤 2:分析内容(读者视角)
仔细阅读全部内容。从读者的角度思考:什么能帮助他们快速理解和记住关键信息?
生成涵盖以下维度的分析:
2.1 亮点与关键见解
- 作者提出的核心论点或结论
- 令人惊讶的事实、数据点或反直觉的主张
- 令人难忘的引语或措辞优美的句子(金句)
2.2 结构评估
- 内容是否有清晰的逻辑流程?是什么?
- 是否存在缺乏标题的自然章节边界?
- 是否有冗长的文本块可以从视觉分隔中受益?
2.3 对读者重要的信息
- 可操作的建议或要点
- 关键概念的定义、解释
- 散布在散文中的列表或枚举
- 作为表格会更清晰的比较或对比
2.4 格式问题
- 缺少或不一致的标题层级
- 混合多个主题的段落
- 并行项以散文形式而非列表形式编写
- 未标记为代码的代码、命令或技术术语
- 明显的拼写错误或格式错误
将分析保存到文件:{original-filename}-analysis.md
分析文件作为步骤 3 的蓝图。使用以下格式:
# 内容分析:{filename}
## 亮点与关键见解
- [列出发现]
## 结构评估
- 当前流程:[描述]
- 建议章节:[列出标题候选及其简要理由]
## 对读者重要的信息
- [列出可操作项、关键概念、隐藏列表、潜在表格]
## 格式问题
- [列出具体问题及位置引用]
## 发现的拼写错误
- [列出所有明显的拼写错误及更正,或“未发现”]
步骤 3:检查/创建 Frontmatter、标题和摘要
检查 YAML Frontmatter(--- 块)。如果缺失则创建。
| 字段 | 处理 |
|---|---|
title |
参见下面的标题生成 |
slug |
从文件路径推断或从标题生成 |
summary |
一句话的简洁摘要(参见下面的摘要生成) |
description |
较长的描述性摘要(参见下面的摘要生成) |
coverImage |
检查同一目录下是否存在 imgs/cover.png;如果存在,则使用相对路径 |
标题生成
无论标题是否已存在,除非设置了 auto_select_title,否则都运行标题优化流程。
准备——阅读全文并提取:
- 核心论点(一句话:“这篇文章是关于什么的?”)
- 最有影响力的观点或结论
- 读者痛点或好奇心触发点
- 最令人难忘的隐喻或金句
使用 references/title-formulas.md 中的公式生成候选标题:
- 根据文章内容、语气和结构,选择2-3 个最匹配的钩子公式(参见参考资料中的“何时选择每个公式”)
- 生成1-2 个直截了当的标题(描述性或陈述性,无公式——清晰准确)
- 如果用户指定了方向(例如,“使其悬念迭起”),则优先考虑该方向
- 总计:4-5 个候选标题
通过 AskUserQuestion 呈现:
选择一个标题:
1. [钩子标题 A] — (推荐) [公式名称]
2. [钩子标题 B] — [公式名称]
3. [钩子标题 C] — [公式名称]
4. [直截了当的标题 D] — 直截了当
5. [直截了当的标题 E] — 直截了当
输入数字,或输入自定义标题:
将最强的钩子标题放在首位并标记为 (推荐)。有关原则和禁止模式,请参阅 references/title-formulas.md。
如果第一行是 H1,则将其提取到 Frontmatter 并从正文中删除。如果 Frontmatter 已有 title,则将其作为上下文包含,但仍生成新的候选标题——现有标题可能较弱。
跳过行为:如果 auto_select: true 或 auto_select_title: true,则跳过用户提示并直接使用首选候选标题。
摘要生成
直接生成两个版本(无需用户选择),均存储在 Frontmatter 中:
| 字段 | 长度 | 用途 |
|---|---|---|
summary |
1 句话,约 50-80 字符 | 简洁的钩子——用于信息流、社交分享、SEO 元数据 |
description |
2-3 句话,约 100-200 字符 | 更丰富的上下文——用于文章预览、新闻简报摘要 |
原则:
- 向读者传达核心价值,而不仅仅是主题
- 使用具体细节(数字、结果、特定方法)而非模糊描述
summary应该简洁有力、自成一体;description可以扩展以提供支持细节- 如果 Frontmatter 已有
summary或description,则保留现有内容,仅生成缺失字段
禁止模式:
- “本文介绍了...”、“本文探讨了...”
- 纯粹的主题描述,没有价值主张
- 用不同词语重复标题
一旦标题在 Frontmatter 中,正文不应包含 H1(避免重复)。
步骤 4:格式化内容
根据步骤 2 的分析应用格式。目标是使内容可扫描,并使关键点一目了然。
格式化工具包:
| 元素 | 何时使用 | 格式 |
|---|---|---|
| 标题 | 自然的主题边界、章节分隔 | ##、### 层级 |
| 粗体 | 关键结论、重要术语、核心要点 | **粗体** |
| 无序列表 | 并行项、功能列表、示例 | - 项 |
| 有序列表 | 顺序步骤、排名项、程序 | 1. 项 |
| 表格 | 比较、结构化数据、选项矩阵 | Markdown 表格 |
| 代码 | 命令、文件路径、技术术语、变量名 | `行内代码` 或围栏代码块 |
| 引用块 | 著名引语、重要警告、引用文本 | > 引用 |
| 分隔符 | 主要主题转换 | --- |
格式化原则——不应做的事:
- 不要添加句子、解释或评论
- 不要删除或缩短任何内容
- 不要改写或重写作者的文字
- 不要添加带有主观评论的标题(例如,“惊人发现”——使用中性描述性标题)
- 不要过度格式化:并非每个句子都需要粗体,并非每个段落都需要标题
格式化原则——应做的事:
- 保留作者的语气、语调和每一个字
- 加粗关键结论和核心要点——读者会高亮的句子
- 仅当结构清晰时,才将散文中的并行项提取到列表中
- 在主题真正转换的地方添加标题——优先使用生动、具体的标题而非通用标题(例如,“3 天搞定 vs 传统方案”而非“方案对比”)
- 使用表格来表示散文中的比较或结构化数据
- 使用引用块来表示金句、令人难忘的陈述或重要警告
- 修正明显的拼写错误(基于步骤 2 的发现)
步骤 5:保存格式化文件
保存为 {original-filename}-formatted.md
备份现有文件:
if [ -f "{filename}-formatted.md" ]; then
mv "{filename}-formatted.md" "{filename}-formatted.backup-$(date +%Y%m%d-%H%M%S).md"
fi
步骤 6:执行排版脚本
在输出文件上运行格式化脚本:
${BUN_X} {baseDir}/scripts/main.ts {output-file-path} [options]
脚本选项:
| 选项 | 简称 | 描述 | 默认值 |
|---|---|---|---|
--quotes |
-q |
将 ASCII 引号替换为全角引号 "..." |
false |
--no-quotes |
不替换引号 | ||
--spacing |
-s |
通过自动更正添加 CJK/英文间距 | true |
--no-spacing |
不添加 CJK/英文间距 | ||
--emphasis |
-e |
修正 CJK 强调标点问题 | true |
--no-emphasis |
不修正 CJK 强调问题 |
示例:
# 默认:间距 + 强调启用,引号禁用
${BUN_X} {baseDir}/scripts/main.ts article.md
# 启用所有功能,包括引号替换
${BUN_X} {baseDir}/scripts/main.ts article.md --quotes
# 仅修正强调问题,跳过间距
${BUN_X} {baseDir}/scripts/main.ts article.md --no-spacing
脚本执行(根据选项):
- 修正 CJK 强调/粗体标点问题(默认:启用)
- 通过自动更正添加 CJK/英文混合文本间距(默认:启用)
- 将 ASCII 引号替换为全角引号(默认:禁用)
- 格式化 Frontmatter YAML(始终启用)
步骤 7:完成报告
显示总结所有更改的报告:
**格式化完成**
**文件:**
- 分析文件:{filename}-analysis.md
- 格式化文件:{filename}-formatted.md
**内容分析摘要:**
- 发现的亮点:X 个关键见解
- 金句:X 句令人难忘的句子
- 修正的格式问题:X 项
**应用的更改:**
- Frontmatter:[已添加/已更新](标题、slug、摘要)
- 添加的标题:X (##: N, ###: N)
- 添加的粗体标记:X
- 创建的列表:X(从散文转换为列表)
- 创建的表格:X
- 添加的代码标记:X
- 添加的引用块:X
- 修正的拼写错误:X [列出每个:“原始” → “更正后”]
**排版脚本:**
- CJK 间距:[已应用/已跳过]
- 强调修正:[已应用/已跳过]
- 引号替换:[已应用/已跳过]
调整报告以反映实际更改——省略未进行更改的类别。
注意事项
- 保留原始写作风格和语气
- 为代码块指定正确的语言(例如,
python、javascript) - 保持 CJK/英文间距标准
- 分析文件是工作文档——它有助于保持识别内容和格式化内容之间的一致性
扩展支持
通过 EXTEND.md 进行自定义配置。有关路径和支持选项,请参阅偏好设置部分。
Markdown Formatter
Transforms plain text or markdown into well-structured, reader-friendly markdown. The goal is to help readers quickly grasp key points, highlights, and structure — without changing any original content.
Core principle: Only adjust formatting and fix obvious typos. Never add, delete, or rewrite content.
User Input Tools
When this skill prompts the user, follow this tool-selection rule (priority order):
- Prefer built-in user-input tools exposed by the current agent runtime — e.g.,
AskUserQuestion,request_user_input,clarify,ask_user, or any equivalent. - Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
- Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.
Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.
Script Directory
Scripts in scripts/ subdirectory. {baseDir} = this SKILL.md's directory path. Resolve ${BUN_X} runtime: if bun installed → bun; if npx available → npx -y bun; else suggest installing bun. Replace {baseDir} and ${BUN_X} with actual values.
| Script | Purpose |
|---|---|
scripts/main.ts |
Main entry point with CLI options (uses remark-cjk-friendly for CJK emphasis) |
scripts/quotes.ts |
Replace ASCII quotes with fullwidth quotes |
scripts/autocorrect.ts |
Add CJK/English spacing via autocorrect |
Preferences (EXTEND.md)
Check EXTEND.md in priority order — the first one found wins:
| Priority | Path | Scope |
|---|---|---|
| 1 | .baoyu-skills/baoyu-format-markdown/EXTEND.md |
Project |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-format-markdown/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-format-markdown/EXTEND.md |
User home |
If none found, use defaults — no first-time setup required for this skill.
EXTEND.md supports:
| Setting | Values | Default | Description |
|---|---|---|---|
auto_select |
true/false |
false |
Skip both title and summary selection, auto-pick best |
auto_select_title |
true/false |
false |
Skip title selection only |
auto_select_summary |
true/false |
false |
Skip summary selection only |
| Other | — | — | Default formatting options, typography preferences |
Usage
The workflow has two phases: Analyze (understand the content) then Format (apply formatting). Claude performs content analysis and formatting (Steps 1-5), then runs the script for typography fixes (Step 6).
Workflow
Step 1: Read & Detect Content Type
Read the user-specified file, then detect content type:
| Indicator | Classification |
|---|---|
Has --- YAML frontmatter |
Markdown |
Has #, ##, ### headings |
Markdown |
Has **bold**, *italic*, lists, code blocks, blockquotes |
Markdown |
| None of above | Plain text |
If Markdown detected, use AskUserQuestion to ask:
Detected existing markdown formatting. What would you like to do?
1. Optimize formatting (Recommended)
- Analyze content, improve headings, bold, lists for readability
- Run typography script (spacing, emphasis fixes)
- Output: {filename}-formatted.md
2. Keep original formatting
- Preserve existing markdown structure
- Run typography script only
- Output: {filename}-formatted.md
3. Typography fixes only
- Run typography script on original file in-place
- No copy created, modifies original file directly
Based on user choice:
- Optimize: Continue to Step 2 (full workflow)
- Keep original: Skip to Step 5, copy file then run Step 6
- Typography only: Skip to Step 6, run on original file directly
Step 2: Analyze Content (Reader's Perspective)
Read the entire content carefully. Think from a reader's perspective: what would help them quickly understand and remember the key information?
Produce an analysis covering these dimensions:
2.1 Highlights & Key Insights
- Core arguments or conclusions the author makes
- Surprising facts, data points, or counterintuitive claims
- Memorable quotes or well-phrased sentences (golden quotes)
2.2 Structure Assessment
- Does the content have a clear logical flow? What is it?
- Are there natural section boundaries that lack headings?
- Are there long walls of text that could benefit from visual breaks?
2.3 Reader-Important Information
- Actionable advice or takeaways
- Definitions, explanations of key concepts
- Lists or enumerations buried in prose
- Comparisons or contrasts that would be clearer as tables
2.4 Formatting Issues
- Missing or inconsistent heading hierarchy
- Paragraphs that mix multiple topics
- Parallel items written as prose instead of lists
- Code, commands, or technical terms not marked as code
- Obvious typos or formatting errors
Save analysis to file: {original-filename}-analysis.md
The analysis file serves as the blueprint for Step 3. Use this format:
# Content Analysis: {filename}
## Highlights & Key Insights
- [list findings]
## Structure Assessment
- Current flow: [describe]
- Suggested sections: [list heading candidates with brief rationale]
## Reader-Important Information
- [list actionable items, key concepts, buried lists, potential tables]
## Formatting Issues
- [list specific issues with location references]
## Typos Found
- [list any obvious typos with corrections, or "None found"]
Step 3: Check/Create Frontmatter, Title & Summary
Check for YAML frontmatter (--- block). Create if missing.
| Field | Processing |
|---|---|
title |
See Title Generation below |
slug |
Infer from file path or generate from title |
summary |
One-sentence concise summary (see Summary Generation below) |
description |
Longer descriptive summary (see Summary Generation below) |
coverImage |
Check if imgs/cover.png exists in same directory; if so, use relative path |
Title Generation
Whether or not a title already exists, run the title optimization flow unless auto_select_title is set.
Preparation — read the full text and extract:
- Core argument (one sentence: "what is this article about?")
- Most impactful opinion or conclusion
- Reader pain point or curiosity trigger
- Most memorable metaphor or golden quote
Generate candidates using formulas from references/title-formulas.md:
- Select the 2-3 best-matching hook formulas based on the article's content, tone, and structure (see "When to pick each formula" in the reference)
- Generate 1-2 straightforward titles (descriptive or declarative, no formula — clear and accurate)
- If the user specifies a direction (e.g., "make it suspenseful"), prioritize that direction
- Total: 4-5 candidates
Present via AskUserQuestion:
Pick a title:
1. [Hook title A] — (recommended) [formula name]
2. [Hook title B] — [formula name]
3. [Hook title C] — [formula name]
4. [Straightforward title D] — straightforward
5. [Straightforward title E] — straightforward
Enter number, or type a custom title:
Put the strongest hook first and mark it (recommended). See references/title-formulas.md for principles and prohibited patterns.
If the first line is an H1, extract it to frontmatter and remove it from the body. If frontmatter already has a title, include it as context but still generate fresh candidates — the existing title may be weak.
Skip behavior: If auto_select: true or auto_select_title: true, skip the user prompt and use the top candidate directly.
Summary Generation
Generate two versions directly (no user selection), both stored in frontmatter:
| Field | Length | Purpose |
|---|---|---|
summary |
1 sentence, ~50-80 chars | Concise hook — for feeds, social sharing, SEO meta |
description |
2-3 sentences, ~100-200 chars | Richer context — for article previews, newsletter blurbs |
Principles:
- Convey core value to the reader, not just the topic
- Use concrete details (numbers, outcomes, specific methods) over vague descriptions
summaryshould be punchy and self-contained;descriptioncan expand with supporting details- If frontmatter already has
summaryordescription, keep the existing one and only generate the missing field
Prohibited patterns:
- "This article introduces...", "This article explores..."
- Pure topic description without value proposition
- Repeating the title in different words
Once the title is in frontmatter, the body should NOT contain an H1 (avoid duplication).
Step 4: Format Content
Apply formatting guided by the Step 2 analysis. The goal is making the content scannable and the key points impossible to miss.
Formatting toolkit:
| Element | When to use | Format |
|---|---|---|
| Headings | Natural topic boundaries, section breaks | ##, ### hierarchy |
| Bold | Key conclusions, important terms, core takeaways | **bold** |
| Unordered lists | Parallel items, feature lists, examples | - item |
| Ordered lists | Sequential steps, ranked items, procedures | 1. item |
| Tables | Comparisons, structured data, option matrices | Markdown table |
| Code | Commands, file paths, technical terms, variable names | `inline` or fenced blocks |
| Blockquotes | Notable quotes, important warnings, cited text | > quote |
| Separators | Major topic transitions | --- |
Formatting principles — what NOT to do:
- Do NOT add sentences, explanations, or commentary
- Do NOT delete or shorten any content
- Do NOT rephrase or rewrite the author's words
- Do NOT add headings that editorialize (e.g., "Amazing Discovery" — use neutral descriptive headings)
- Do NOT over-format: not every sentence needs bold, not every paragraph needs a heading
Formatting principles — what TO do:
- Preserve the author's voice, tone, and every word
- Bold key conclusions and core takeaways — the sentences a reader would highlight
- Extract parallel items from prose into lists only when the structure is clearly there
- Add headings where the topic genuinely shifts — prefer vivid, specific headings over generic ones (e.g., "3 天搞定 vs 传统方案" over "方案对比")
- Use tables for comparisons or structured data buried in prose
- Use blockquotes for golden quotes, memorable statements, or important warnings
- Fix obvious typos (based on Step 2 findings)
Step 5: Save Formatted File
Save as {original-filename}-formatted.md
Backup existing file:
if [ -f "{filename}-formatted.md" ]; then
mv "{filename}-formatted.md" "{filename}-formatted.backup-$(date +%Y%m%d-%H%M%S).md"
fi
Step 6: Execute Typography Script
Run the formatting script on the output file:
${BUN_X} {baseDir}/scripts/main.ts {output-file-path} [options]
Script Options:
| Option | Short | Description | Default |
|---|---|---|---|
--quotes |
-q |
Replace ASCII quotes with fullwidth quotes "..." |
false |
--no-quotes |
Do not replace quotes | ||
--spacing |
-s |
Add CJK/English spacing via autocorrect | true |
--no-spacing |
Do not add CJK/English spacing | ||
--emphasis |
-e |
Fix CJK emphasis punctuation issues | true |
--no-emphasis |
Do not fix CJK emphasis issues |
Examples:
# Default: spacing + emphasis enabled, quotes disabled
${BUN_X} {baseDir}/scripts/main.ts article.md
# Enable all features including quote replacement
${BUN_X} {baseDir}/scripts/main.ts article.md --quotes
# Only fix emphasis issues, skip spacing
${BUN_X} {baseDir}/scripts/main.ts article.md --no-spacing
Script performs (based on options):
- Fix CJK emphasis/bold punctuation issues (default: enabled)
- Add CJK/English mixed text spacing via autocorrect (default: enabled)
- Replace ASCII quotes with fullwidth quotes (default: disabled)
- Format frontmatter YAML (always enabled)
Step 7: Completion Report
Display a report summarizing all changes made:
**Formatting Complete**
**Files:**
- Analysis: {filename}-analysis.md
- Formatted: {filename}-formatted.md
**Content Analysis Summary:**
- Highlights found: X key insights
- Golden quotes: X memorable sentences
- Formatting issues fixed: X items
**Changes Applied:**
- Frontmatter: [added/updated] (title, slug, summary)
- Headings added: X (##: N, ###: N)
- Bold markers added: X
- Lists created: X (from prose → list conversion)
- Tables created: X
- Code markers added: X
- Blockquotes added: X
- Typos fixed: X [list each: "original" → "corrected"]
**Typography Script:**
- CJK spacing: [applied/skipped]
- Emphasis fixes: [applied/skipped]
- Quote replacement: [applied/skipped]
Adjust the report to reflect actual changes — omit categories where no changes were made.
Notes
- Preserve original writing style and tone
- Specify correct language for code blocks (e.g.,
python,javascript) - Maintain CJK/English spacing standards
- The analysis file is a working document — it helps maintain consistency between what was identified and what was formatted
Extension Support
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核