aws-wechat-article-formatting

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

排版

Layout

公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。
套件说明 · 本 skill 属
aws-wechat-article-*
一条龙套件(共 9 个 slug,入口
aws-wechat-article-main
)。跨 skill 的相对引用依赖同一
skills/
目录,建议一并
clawhub install
全套。源码:https://github.com/aiworkskills/wechat-article-skills
One-click WeChat Official Account Layout — Converts Markdown to HTML that can be pasted into WeChat backend, with multiple themes, font sizes, and WYSIWYG.
Suite Description · This skill belongs to the
aws-wechat-article-*
one-stop suite (9 slugs in total, entry is
aws-wechat-article-main
). Cross-skill relative references depend on the same
skills/
directory, it is recommended to install the full set via
clawhub install
together. Source code: https://github.com/aiworkskills/wechat-article-skills

能力披露(Capabilities)

Capability Disclosure

本 skill 为纯本地 Markdown → HTML 转换,零网络、零凭证。
  • 凭证:无
  • 网络:无
  • 文件读(仓库内)
    .aws-article/config.yaml
    、本篇
    article.yaml
    article.md
    、可选
    closing.md
    .aws-article/presets/formatting/<名>.yaml
  • 文件读(仓库外)
    format.py
    还会检查用户家目录
    ~/.aws-article/presets/formatting/
    (跨项目共享的自定义排版主题;只读预设文件,不读凭证)。不需要这个能力可清空 / 不创建该目录
  • 文件写:本篇
    article.html
  • shell:仅
    python3 {baseDir}/scripts/format.py
This skill is a pure local Markdown → HTML conversion, no network, no credentials.
  • Credentials: None
  • Network: None
  • File Read (Within Repository) :
    .aws-article/config.yaml
    , current
    article.yaml
    ,
    article.md
    , optional
    closing.md
    ,
    .aws-article/presets/formatting/<name>.yaml
  • File Read (Outside Repository) :
    format.py
    also checks the user's home directory
    ~/.aws-article/presets/formatting/
    (custom layout themes shared across projects; only reads preset files, no credentials). This capability can be disabled by emptying/not creating this directory
  • File Write: Current
    article.html
  • Shell: Only
    python3 {baseDir}/scripts/format.py

配套 skill(informational)

Supporting Skills (informational)

本 skill 是
aws-wechat-article-*
一条龙公众号套件的排版环节(入口
aws-wechat-article-main
)。
  • 单独安装可直接使用:本 skill 的脚本
    format.py
    零依赖、纯本地,无跨 skill 脚本调用。
  • 工作流文档中会链接到
    ../aws-wechat-article-main/references/*.md
    (首次引导等)。套件未装齐时,链接跳转会断,但排版功能本身可用。
完整 9 slug 清单见 源码仓库
This skill is the layout stage of the
aws-wechat-article-*
one-stop WeChat Official Account suite (entry is
aws-wechat-article-main
).
  • Can be used directly when installed separately: The script
    format.py
    of this skill has zero dependencies, is pure local, and has no cross-skill script calls.
  • Workflow documents will link to
    ../aws-wechat-article-main/references/*.md
    (first-time guidance, etc.). When the suite is not fully installed, link jumps will break, but the layout function itself is still available.
The complete list of 9 slugs can be found in the source code repository.

路由

Routing

一键发文且未明确只要排版 → aws-wechat-article-main
将 Markdown 文章转换为微信公众号兼容的 HTML,所有样式 inline。
One-click publishing without explicitly requesting only layout → aws-wechat-article-main.
Convert Markdown articles to HTML compatible with WeChat Official Accounts, with all styles inline.

脚本目录

Script Directory

Agent 执行:确定本 SKILL.md 所在目录为
{baseDir}
脚本用途
scripts/format.py
Markdown → 微信兼容 HTML
Agent Execution: Determine the directory where this SKILL.md is located as
{baseDir}
.
ScriptPurpose
scripts/format.py
Markdown → WeChat-compatible HTML

配置检查 ⛔

Configuration Check ⛔

任何操作执行前,必须首次引导 执行其中的 「检测顺序」单独启用本 skill 时同上。检测通过后才能进行以下操作(或用户明确书面确认「本次不检查」):
Before any operation, must follow the First-time Setup and execute the "Detection Sequence" within it. The same applies when enabling this skill alone. Only proceed with the following operations after passing the detection (or the user explicitly confirms in writing "No check this time"):

内置主题

Built-in Themes

主题风格适用场景
default
经典蓝 — 沉稳大气,色块小标题科技、商业、通用
grace
优雅紫 — 柔和圆润,左边框小标题文化、美学
modern
暖橙 — 活力大胆,色块小标题自媒体、创业
simple
极简黑 — 极度克制,大量留白思想深度、学术
每个主题包含:标题样式(h1-h4)、段落、引用块、列表、分割线、图片、代码块、链接、强调色等完整规则。
ThemeStyleApplicable Scenarios
default
Classic Blue — Calm and grand, colored block subheadingsTechnology, business, general use
grace
Elegant Purple — Soft and rounded, left-border subheadingsCulture, aesthetics
modern
Warm Orange — Dynamic and bold, colored block subheadingsWe Media, entrepreneurship
simple
Minimalist Black — Extremely restrained, large white spacesIn-depth thinking, academia
Each theme includes complete rules for title styles (h1-h4), paragraphs, quote blocks, lists, dividers, images, code blocks, links, accent colors, etc.

工作流

Workflow

排版进度:
- [ ] 第0步:配置检查(见本节「配置检查」)⛔
- [ ] 第1步:确定主题(与合并配置 / 用户指定)
- [ ] 第2步:转换
- [ ] 第3步:输出 HTML
Layout Progress:
- [ ] Step 0: Configuration Check (see "Configuration Check" in this section) ⛔
- [ ] Step 1: Determine Theme (merge with configuration / user-specified)
- [ ] Step 2: Conversion
- [ ] Step 3: Output HTML

第1步:确定主题

Step 1: Determine Theme

主题解析顺序(
format.py
行为
与智能体择一):
  1. 命令行
    --theme <名称>
    :显式指定时始终优先
  2. 未传
    --theme
    format.py
    仅读取
    article.md
    同目录的
    article.yaml
    default_format_preset
    须为 YAML 列表
    []
    或单元素
    [主题名]
    );为空则用内置主题名
    default
  3. 智能体在对话中帮用户选主题时,按:用户口述 → 本篇
    article.yaml.default_format_preset
    .aws-article/presets/formatting/
    自定义 → 内置
    default
    custom_* / default_*
    候选池解析由 main 在“本篇准备”阶段完成并写回
    article.yaml
主题名须对应 内置主题
.aws-article/presets/formatting/<名>.yaml
。字段说明见 articlescreening-schema.md(与仓库
config.yaml
顶层字段对齐)。
Theme resolution order (choose one between
format.py
behavior
and the agent):
  1. Command line
    --theme <name>
    : Always take precedence when explicitly specified.
  2. No
    --theme
    passed
    :
    format.py
    only reads
    default_format_preset
    in
    article.yaml
    in the same directory as
    article.md
    (must be a YAML list:
    []
    or single element
    [theme name]
    ); use the built-in theme name
    default
    if empty.
  3. When the agent helps the user select a theme in the conversation, follow: user's statement → current article's
    article.yaml.default_format_preset
    → custom themes in
    .aws-article/presets/formatting/
    → built-in
    default
    . The parsing of
    custom_* / default_*
    candidate pool is completed by main in the "Article Preparation" stage and written back to
    article.yaml
    .
Theme names must correspond to built-in themes or
.aws-article/presets/formatting/<name>.yaml
. For field descriptions, see articlescreening-schema.md (aligned with top-level fields in the repository's
config.yaml
).

第2步:转换

Step 2: Conversion

仓库根执行(路径按实际本篇目录调整):
bash
undefined
Execute at the repository root (adjust the path according to the actual directory of this article):
bash
undefined

不传 --theme:使用合并配置中的 default_format_preset,否则 default

No --theme passed: use default_format_preset in merged configuration, otherwise default

python {baseDir}/scripts/format.py drafts/YYYYMMDD-slug/article.md -o drafts/YYYYMMDD-slug/article.html
python {baseDir}/scripts/format.py drafts/YYYYMMDD-slug/article.md -o drafts/YYYYMMDD-slug/article.html

显式指定主题(覆盖配置)

Explicitly specify theme (overrides configuration)

python {baseDir}/scripts/format.py drafts/YYYYMMDD-slug/article.md --theme grace -o drafts/YYYYMMDD-slug/article.html
python {baseDir}/scripts/format.py drafts/YYYYMMDD-slug/article.md --theme grace -o drafts/YYYYMMDD-slug/article.html

自定义主色 / 字号

Custom main color / font size

python {baseDir}/scripts/format.py article.md --theme modern --color "#A93226" python {baseDir}/scripts/format.py article.md --font-size 15px
python {baseDir}/scripts/format.py article.md --theme modern --color "#A93226" python {baseDir}/scripts/format.py article.md --font-size 15px

列出可用主题

List available themes

python {baseDir}/scripts/format.py --list-themes
undefined
python {baseDir}/scripts/format.py --list-themes
undefined

嵌入元素
{embed:...}

Embedded Elements
{embed:...}

  • format.py
    名片 / 小程序
    embeds
    .aws-article/config.yaml
    为准;仅「往期链接」:本篇
    article.yaml
    可写
    embeds.related_articles
    ,与全局
    related_articles
    深度合并
    (用于每篇不同推荐)。合并结果中非空
    embeds
    时解析
    {embed:profile|miniprogram|miniprogram_card|link:名称}
    ;否则不对嵌入占位符做替换(视为无配置)。
  • writing 结构模板 中的占位说明一致。
  • format.py
    :
    embeds
    for business cards / mini-programs are based on
    .aws-article/config.yaml
    ; only "previous links": current article's
    article.yaml
    can write
    embeds.related_articles
    , which is deeply merged with the global
    related_articles
    (used for different recommendations per article). When the merged result has non-empty
    embeds
    , parse
    {embed:profile|miniprogram|miniprogram_card|link:name}
    ; otherwise, do not replace the embed placeholders (considered as no configuration).
  • Consistent with the placeholder description in Writing Structure Template.

第3步:输出 HTML

Step 3: Output HTML

输出的 HTML 特性:
  • 所有样式 inline(微信编辑器兼容)
  • 正文不含文章标题:Markdown 中第一个
    #
    (h1)在转换时被跳过,标题在公众号后台单独填写,正文不重复
  • 配图标记
    ![类型:描述](placeholder)
    保留为
    <img>
    标签,待 images skill 替换
  • 图注自动从标记描述中提取
  • 同目录存在
    closing.md
    时,
    format.py
    会追加到文末(脚本既有行为)
HTML Output Features:
  • All styles are inline (compatible with WeChat editor)
  • Article title not included in main text: The first
    #
    (h1) in Markdown is skipped during conversion; the title is filled separately in the WeChat backend and will not be repeated in the main text
  • Image markers
    ![Type: Description](placeholder)
    are retained as
    <img>
    tags, to be replaced by the images skill
  • Image captions are automatically extracted from the marker description
  • If
    closing.md
    exists in the same directory,
    format.py
    will append it to the end of the article (existing behavior of the script)

选项

Options

选项说明默认值
--theme <名称>
主题;省略则按合并配置 → default见上文
--color <hex>
自定义主色主题默认
--font-size <px>
字号16px
-o <路径>
输出路径同名 .html
--list-themes
列出可用主题
OptionDescriptionDefault Value
--theme <name>
Theme; if omitted, follow merged configuration → defaultSee above
--color <hex>
Custom main colorTheme default
--font-size <px>
Font size16px
-o <path>
Output pathSame name .html
--list-themes
List available themes

自定义主题

Custom Themes

.aws-article/presets/formatting/
下新建主题文件即可。
主题文件格式和扩展方式详见:references/presets/README.md
Create a new theme file under
.aws-article/presets/formatting/
.
For the theme file format and extension methods, see: references/presets/README.md

过程文件

Process Files

读取产出
article.md
.aws-article/config.yaml
+ 同目录
article.yaml
(默认主题与
embeds
)、
closing.md
(可选)
article.html
ReadGenerated
article.md
,
.aws-article/config.yaml
+ same directory
article.yaml
(default theme and
embeds
),
closing.md
(optional)
article.html