Skip to content

aiworkskills/wechat-article-skills / skills/aws-wechat-article-formatting

aws-wechat-article-formatting

Verified

公众号排版|Markdown 转 HTML|排版主题|段落样式 — 公众号一键排版工具,Markdown 文稿转微信后台可粘贴 HTML,多主题、多字号、段落样式切换,所见即所得。面向公众号编辑、独立作者、排版岗。触发词:「排版」「版式」「美化」「格式化」「字号」「段落样式」「换个排版主题」「换个版式」「转 HTML」「弄好看点」「调整格式」。换预设包/品牌包/整套主题配色请走 aws-wechat-article-assets;需要多环节串联(写+审+排+配图+发)请走 aws-wechat-article-main。

FileKindSize
SKILL.mdskill md9.7 KB
references/branches.mdmarkdown6.6 KB
references/components/bao/article-end.yamlconfig149 B
references/components/bao/checklist.yamlconfig1.0 KB
references/components/bao/lead.yamlconfig211 B
references/components/bao/li-label.yamlconfig200 B
references/components/bao/quote-card.yamlconfig379 B
references/components/cai/article-end.yamlconfig200 B
references/components/cai/checklist.yamlconfig1.0 KB
references/components/cai/h2-deco.yamlconfig160 B
references/components/cai/img-deco.yamlconfig223 B
references/components/cai/lead.yamlconfig317 B
references/components/cai/li-label.yamlconfig202 B
references/components/cai/quote-card.yamlconfig392 B
references/components/checklist.yamlconfig2.1 KB
references/components/closing.yamlconfig1.7 KB
references/components/compare.yamlconfig2.0 KB
references/components/gou/article-end.yamlconfig512 B
references/components/gou/checklist.yamlconfig1012 B
references/components/gou/h2-deco.yamlconfig459 B
references/components/gou/hr-deco.yamlconfig353 B
references/components/gou/img-deco.yamlconfig298 B
references/components/gou/lead.yamlconfig589 B
references/components/gou/li-label.yamlconfig196 B
references/components/gou/quote-card.yamlconfig727 B
references/components/kuai/article-end.yamlconfig270 B
references/components/kuai/checklist.yamlconfig1.0 KB
references/components/kuai/lead.yamlconfig218 B
references/components/kuai/li-label.yamlconfig202 B
references/components/kuai/quote-card.yamlconfig332 B
references/components/layers.yamlconfig1.5 KB
references/components/lead.yamlconfig1.4 KB
references/components/ma/article-end.yamlconfig307 B
references/components/ma/checklist.yamlconfig1.0 KB
references/components/ma/h2-deco.yamlconfig322 B
references/components/ma/lead.yamlconfig426 B
references/components/ma/li-label.yamlconfig197 B
references/components/ma/quote-card.yamlconfig422 B
references/components/quote-card.yamlconfig1.5 KB
references/components/section-title.yamlconfig1.5 KB
references/components/shou/article-end.yamlconfig488 B
references/components/shou/checklist.yamlconfig1.0 KB
references/components/shou/h2-deco.yamlconfig526 B
references/components/shou/hr-deco.yamlconfig678 B
references/components/shou/img-deco.yamlconfig508 B
references/components/shou/lead.yamlconfig313 B
references/components/shou/li-label.yamlconfig265 B
references/components/shou/quote-card.yamlconfig559 B
references/components/shu/article-end.yamlconfig188 B
references/components/shu/checklist.yamlconfig1.0 KB
references/components/shu/h2-deco.yamlconfig360 B
references/components/shu/hr-deco.yamlconfig183 B
references/components/shu/img-deco.yamlconfig265 B
references/components/shu/lead.yamlconfig301 B
references/components/shu/li-label.yamlconfig195 B
references/components/shu/quote-card.yamlconfig609 B
references/components/stat.yamlconfig2.0 KB
references/components/steps.yamlconfig2.2 KB
references/components/yi/article-end.yamlconfig403 B
references/components/yi/checklist.yamlconfig1.0 KB
references/components/yi/h2-deco.yamlconfig377 B
references/components/yi/hr-deco.yamlconfig281 B
references/components/yi/lead.yamlconfig631 B
references/components/yi/li-label.yamlconfig200 B
references/components/yi/quote-card.yamlconfig491 B
references/presets/README.mdmarkdown5.6 KB
references/presets/_sample-image-2.svgother1.0 KB
references/presets/_sample-image.svgother1.6 KB
references/presets/_sample.mdmarkdown2.7 KB
references/presets/templates/README.mdmarkdown1.3 KB
references/presets/templates/手账.yamlconfig2.9 KB
references/presets/templates/技术.yamlconfig3.8 KB
references/presets/templates/活力.yamlconfig3.3 KB
references/presets/templates/硬朗.yamlconfig3.1 KB
references/presets/themes/书卷.yamlconfig3.7 KB
references/presets/themes/亲和.yamlconfig3.2 KB
references/presets/themes/杂志.yamlconfig2.9 KB
references/presets/themes/资讯.yamlconfig3.1 KB
references/wechat-html-constraints.mdmarkdown20.8 KB
scripts/brush_svg.pyscript7.4 KB
scripts/format.pyscript92.8 KB
skill.jsonconfig475 B

references/branches.md

View on GitHub
# 排版的分支与细则

SKILL.md 只写主路径:选模版 → 跑 `format.py` → 得 `article.html`。本文件是**主路径之外才要读的东西**,主路径在对应位置用一行指过来。

---

## 一、`:::` 版式组件(手写可用,写手不产出)

**写作提示词里不再有 `:::` 语法**(`write.py::build_components_block` 已移除),writing SKILL 明令禁止写手输出它。排版侧仍然认——存量草稿不会废,用户手写也有效。

代价是 `stat`(大数字对)和 `layers`(层级图)这两个 markdown 表达不了的组件,**除非手写否则不会出现**。这是「写作侧只产出标准 markdown」这个取舍明确付出的成本,不是遗漏。

主题只能给标签配内联样式,表达不了结构——而微信没有伪元素,「标题前的角标」「引用块的大引号」必须**真的插元素**。组件补的就是这一层:

```
:::section-title[01]
同一个模型,两个分数
:::

:::quote-card[AWS 团队]
基准分数衡量的是你缺哪个 harness,不是模型的能力上限。
:::
```

`lead`(导语)与 `closing`(文末区块)几乎每篇都该有——实测本账号 7/7 篇开头都有导语、结尾都有互动引导与署名,此前一律是裸文本或借用引用块的样式。导语**刻意不做成带底色的卡片**,就是为了和 `blockquote` 分开:作者的开场白和引用别人的话语义不同,此前共用样式导致长得一模一样。

### 查找顺序

内置组件在 [components/](components/),用户自定义放 `.aws-article/presets/components/<名>.yaml`。组件还可**按骨架整套替换**:`components/<骨架名>/<组件名>.yaml`。

查找顺序:**内置基础版 → 骨架专属 → 用户自定义**,后者覆盖前者。

每个组件 YAML 里带 `when_to_use` / `when_not_to_use` / `anti_pattern`——**选组件前先读这三项**,它们和配图方法里的判据是同一个作用:拦住「因为好看所以用」。

模板里的 `{primary-color}` `{text-color}` 等占位符从当前主题取值,所以组件与任何主题组合都不会脱节。未知组件名或缺少结尾 `:::` 时按原文输出并告警,**不吞内容**。

### `:::highlight` / `:::note` 已删除

曾有一条内置兜底,套主题里的 `highlight` 样式键。**没有一套模版定义过 `highlight`**,兜底一路退回 `blockquote`,渲出来和普通引用块逐字相同——两个语义不同的东西长成一样,正是给导语单独做样式时要避开的问题。加上 `:::` 写手已经不产出,留着就是养一个假功能。

现在 `:::highlight` 走上面的「未知组件」路径:告警 + 按原文输出,不吞内容。**真要提示框**,放一个 `highlight.yaml` 组件文件(内置或用户目录都行),走通用组件路径即可。

---

## 二、主题解析的完整顺序

`format.py` 自己的行为只有两条:

1. 命令行 `--theme <名称>` 显式指定时**始终优先**。
2. 未传 `--theme` 时,**只读**与 `article.md` 同目录的 `article.yaml` 的 `default_format_preset`(**须为 YAML 列表**:`[]` 或单元素 `[主题名]`,多候选会报错);为空则用内置默认模版 **`亲和`**。

脚本**不直接读** `.aws-article/config.yaml`——全局的 `custom_format_preset` / `default_format_preset` 候选池由 main 在「本篇准备」阶段收敛后写回 `article.yaml`。

智能体在对话里帮用户选主题时按:用户口述 → 本篇 `article.yaml.default_format_preset` → `.aws-article/presets/formatting/` 自定义 → 内置 `亲和`。

主题名须对应内置模版或 `.aws-article/presets/formatting/<名>.yaml`。字段说明见 [articlescreening-schema.md](../../aws-wechat-article-main/references/articlescreening-schema.md)。

配色同理:`--scheme` 优先,其次本篇 `default_format_scheme`(单元素列表),再无则用模版 YAML 里 `schemes` 的默认项(由 `default_scheme` 字段声明)。

---

## 三、自定义主题

在 `.aws-article/presets/formatting/` 下新建主题文件即可。快速起步是导出一套现成的改:

```bash
{python} {baseDir}/scripts/format.py --export-theme 亲和 > .aws-article/presets/formatting/my-brand.yaml
```

`format.py` 还会检查用户家目录 `~/.aws-article/presets/formatting/`(跨项目共享的自定义主题,**只读预设文件,不读凭证**)。不需要这个能力可清空 / 不创建该目录。

主题文件格式与扩展方式详见 [presets/README.md](presets/README.md)。

---

## 四、嵌入元素 `{embed:…}` 的合并规则

- **名片 / 小程序**的 `embeds` 以 `.aws-article/config.yaml` 为准。
- **仅「往期链接」例外**:本篇 `article.yaml` 可写 `embeds.related_articles`,与全局 `related_articles` **深度合并**(用于每篇不同的推荐)。
- 合并结果中 `embeds` 非空时才解析 `{embed:profile|miniprogram|miniprogram_card|link:名称}`;否则不对占位符做替换(视为无配置)。

占位符由 [review 第 5 步](../../aws-wechat-article-review/SKILL.md) 写入 `article.md`,与 [writing 结构模板](../../aws-wechat-article-writing/references/structure-template.md) 的说明一致。**占位符与配置对不上时排版阶段会失败**。

---

## 五、输出 HTML 的细节

- 所有样式 inline(微信编辑器兼容)。
- **正文不含文章标题**:`article.md` 的第一个 `#`(h1)在转换时被跳过,标题在公众号后台单独填,正文不重复。
- 配图标记 `![类型:描述](placeholder)` 保留为 `<img>` 标签,待 images skill 替换。
- 同目录存在 **`closing.md`** 时会追加到文末;`closing.md` 自己的首个 `#` 会保留,**只有 `article.md` 的首个 `#`** 被当作文章标题跳过。
- **预格式化**(中英文间加空格、ASCII 引号转「」、合并空行)只作用于正文文字:围栏代码块、行内代码、链接/图片目标、`{embed:…}`、原生 HTML 标签与裸 URL 原样保留,行内代码内容做 HTML 转义。不需要时加 `--no-preformat`。
- 表格支持 `|:---:|` 这类对齐行。

---

## 六、设计新版式前必读 ⛔

微信正文只认**内联样式**,没有伪元素、没有伪类,`position` 与 `id` 会被整条删掉。这决定了「装饰必须作为真实元素插进 HTML」,而不能靠 CSS 变出来。

能用什么、什么会被剥离,见 [wechat-html-constraints.md](wechat-html-constraints.md)。

另:微信 `draft/add` 偶发把 `style=""` 清空,**非确定性**——同样的内容重新上传一次通常就好了。不要据此反推「某个标签的样式不被支持」。
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall