排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, stripped)\n # 版式组件::::name[参数] … :::\n directive = re.match(r'^:::([A-Za-z0-9_-]+)(?:\\[(.*)\\])?\\s*

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, stripped)\n if directive and components:\n name, arg = directive.group(1), (directive.group(2) or \"\")\n spec = components.get(name)\n end = None\n for look in range(line_idx + 1, len(lines)):\n if lines[look].strip() == \":::\":\n end = look\n break\n # 这里一度有条 :::highlight / :::note 的内置兜底,套主题的 highlight\n # 样式键。已删除:没有一套模版定义 highlight,兜底退回 blockquote,\n # 渲出来和普通引用块逐字相同——两个语义不同的东西长成一样,正是给\n # 导语单独做样式时要避开的那个问题。而且 ::: 语法写手已经不产出了,\n # 留着就是养一个假功能。真要提示框:放一个组件文件 highlight.yaml,\n # 走下面的通用组件路径即可。\n if spec and end is not None:\n flush_paragraph()\n close_list()\n close_blockquote()\n body = lines[line_idx + 1:end]\n html_parts.append(_render_component(spec, arg, body, styles))\n for skip_i in range(line_idx + 1, end + 1):\n lines[skip_i] = \"\"\n continue\n # 组件不存在或没有闭合,按原文走,别把内容吞掉\n if not spec:\n print(f\"[WARN] 未知版式组件 :::{name},按普通文本输出。\"\n f\"可用组件:{', '.join(sorted(components)) or '(无)'}\", file=sys.stderr)\n elif end is None:\n print(f\"[WARN] 组件 :::{name} 缺少结尾的 :::,按普通文本输出。\", file=sys.stderr)\n\n if heading_match:\n flush_paragraph()\n close_list()\n close_blockquote()\n # 样式只到 h4。五六级并进 h4——读者分不出 h5 和 h6,\n # 但一定分得出 `###### 六级` 这六个井号原样漏在正文里。\n level = min(len(heading_match.group(1)), 4)\n if level >= 2:\n seen_section = True\n if level == 2:\n section_no += 1\n # 跳过第一个 h1(文章标题),公众号后台单独填写标题,正文不再重复\n if level == 1 and not first_h1_skipped:\n first_h1_skipped = True\n continue\n text = _inline_format(heading_match.group(2), styles)\n tag = f\"h{level}\"\n style = styles.get(tag, \"\")\n heading = f'\u003c{tag} style=\"{style}\">{text}\u003c/{tag}>'\n # 标题装饰层:骨架目录里放一个 `h2-deco.yaml`(模板含 {content}),标题就被\n # 它包起来。这是给内联 SVG 开的口子——h2 的样式是一串 CSS,SVG 塞不进去,\n # 而 SVG 能做的形状(笔刷、括号、编号环)CSS 一个都做不出来。\n #\n # 只能放在标题的上方 / 下方 / 旁边,不能当「跟着字走的下划线」:375px 下\n # 标题经常折两行,而 SVG 不会跟着文字换行,宽度是写死的。\n deco = (components or {}).get(f\"{tag}-deco\") or {}\n if deco.get(\"template\"):\n heading = (_sub_theme_vars(str(deco[\"template\"]), styles)\n .replace(\"{n2}\", \"%02d\" % section_no)\n .replace(\"{nr}\", _roman(section_no))\n .replace(\"{nz}\", _cjk_numeral(section_no))\n .replace(\"{n}\", str(section_no))\n .replace(\"{content}\", heading))\n html_parts.append(heading)\n continue\n\n # CommonMark 的分隔线是 `-` `*` `_` 三种符号各三个以上,中间允许空格。\n # 此前只认 `---`,`***` 和 `___` 会原样漏进正文。\n if re.match(r'^ {0,3}((-[ \\t]*){3,}|(\\*[ \\t]*){3,}|(_[ \\t]*){3,})

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, stripped):\n flush_paragraph()\n close_list()\n close_blockquote()\n # 骨架目录里放 `hr-deco.yaml` 就用它替掉这条线。`---` 每篇出现两三次,\n # 是最适合放装饰的位置:纯装饰、无内容、作者不用多写一个字。\n hr_deco = (components or {}).get(\"hr-deco\") or {}\n if hr_deco.get(\"template\"):\n html_parts.append(_sub_theme_vars(str(hr_deco[\"template\"]), styles))\n else:\n html_parts.append(f'\u003chr style=\"{styles.get(\"hr\", \"\")}\" />')\n continue\n\n # Markdown 表格\n if re.match(r'^\\|.+\\|

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, stripped):\n flush_paragraph()\n close_list()\n close_blockquote()\n # 收集连续的表格行\n table_lines = [stripped]\n # 向前看后续行(通过索引)\n cur_idx = line_idx\n lookahead = cur_idx + 1\n while lookahead \u003c len(lines):\n next_s = lines[lookahead].strip()\n if re.match(r'^\\|.+\\|

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, next_s):\n table_lines.append(next_s)\n lookahead += 1\n else:\n break\n # 跳过已消费的行(通过替换为空行,后续循环会跳过)\n for skip_i in range(cur_idx + 1, lookahead):\n lines[skip_i] = \"\"\n # 解析表格\n tbl_style = styles.get(\"table\", \"\") or \"width:100%; border-collapse:collapse; margin:1em 0; font-size:14px;\"\n th_style = styles.get(\"th\", \"\") or \"background:#f5f5f5; padding:8px 14px; text-align:center; font-weight:bold;\"\n td_style = styles.get(\"td\", \"\") or \"padding:8px 14px; border:1px solid #EEE; text-align:center;\"\n rows = []\n for tl in table_lines:\n cells = [c.strip() for c in tl.strip(\"|\").split(\"|\")]\n rows.append(cells)\n # 过滤分隔行(|---|---|)\n data_rows = [r for r in rows if not all(re.match(r'^:?-+:?

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, c.strip()) for c in r)]\n if data_rows:\n table_html = f'\u003ctable style=\"{tbl_style}\">'\n for ri, row in enumerate(data_rows):\n table_html += \"\u003ctr>\"\n for cell in row:\n tag = \"th\" if ri == 0 else \"td\"\n st = th_style if ri == 0 else td_style\n cell_text = _inline_format(cell, styles)\n table_html += f'\u003c{tag} style=\"{st}\">{cell_text}\u003c/{tag}>'\n table_html += \"\u003c/tr>\"\n table_html += \"\u003c/table>\"\n html_parts.append(table_html)\n continue\n\n # 第三个分组是 markdown 原生的 title 参数,用来放图注:\n # ![信息图:画面指令给模型看](imgs/x.png \"图注给读者看\")\n img_match = re.match(r'^!\\[(.*?)\\]\\(\\s*(\\S+?)(?:\\s+[\"\\u201c\\u2018\\'](.*?)[\"\\u201d\\u2019\\'])?\\s*\\)

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, stripped)\n if img_match:\n flush_paragraph()\n alt = img_match.group(1)\n src = img_match.group(2)\n caption_text = (img_match.group(3) or \"\").strip()\n\n # 封面图不进正文 HTML(通过 API 单独上传)\n if (\"封面\" in alt) or alt.startswith(\"cover\"):\n continue\n\n alt_escaped = html_mod.escape(alt)\n img_style = styles.get(\"img\", \"\") or \"max-width:100%; border-radius:4px;\"\n img_html = (\n f'\u003cp style=\"text-align:center; margin:1.5em 0;\">'\n f'\u003cimg src=\"{src}\"{_image_dims(src, base_dir)} alt=\"{alt_escaped}\" style=\"{img_style}\" />'\n f'\u003c/p>'\n )\n # `img-deco.yaml`(模板含 {content})把图包起来。用来做四角标这类装饰:\n # 整框太重,四个角提示「这是一张图」就够。图片是正文里视觉最重的元素,\n # 又不需要作者多写任何东西,是装饰的好位置。\n img_deco = (components or {}).get(\"img-deco\") or {}\n if img_deco.get(\"template\"):\n img_html = _sub_theme_vars(str(img_deco[\"template\"]), styles).replace(\n \"{content}\", img_html)\n html_parts.append(img_html)\n # 图注只用显式写的 title 参数。alt 里冒号后那段是**给生图模型的画面指令**\n # (「开发者站在巨型 99.9 分数牌前,视线越过分数望向……」),拿它当图注等于\n # 把读者眼睛已经看见的东西复述一遍,零信息;图没生成出来时更会同一句话出现\n # 两次(一次破图 alt、一次图注)。没写 title 就不出图注——错的图注比没有更糟。\n if caption_text and _want_caption(alt, caption_style):\n caption = caption_text\n fc_style = styles.get(\"figcaption\", \"\") or (\n f'text-align:center; font-size:14px; '\n f'color:{styles[\"text-muted\"]}; margin-top:-0.8em; margin-bottom:1.5em;'\n )\n html_parts.append(\n f'\u003cp style=\"{fc_style}\">'\n f'{html_mod.escape(caption)}\u003c/p>'\n )\n continue\n\n if stripped.startswith(\">\"):\n flush_paragraph()\n close_list()\n # **位置决定语义**:第一个 `##` 之前的 `>` 是摘要(写作提示词就是这么要求的:\n # 「摘要(> 引用块,80-128字)」),之后的才是正文引用。真稿五篇实测,\n # 每一个 `>` 都落在第一个 `##` 之前、长度 102~123 字——全是摘要,一条正文\n # 引用都没有。给摘要套大引号是套错了:摘要不是引文。\n #\n # 摘要改走 `lead` 组件(导语)。这也让 lead 从标准 markdown 可达——\n # 此前它只能靠手写 `:::lead`,而那套语法已经不再教了。\n if not in_blockquote and not seen_section:\n lead = (components or {}).get(\"lead\") or {}\n if lead.get(\"template\"):\n buf = []\n j = line_idx\n while j \u003c len(lines) and lines[j].strip().startswith(\">\"):\n buf.append(lines[j].strip()[1:].strip())\n j += 1\n body = _inline_format(\" \".join(x for x in buf if x), styles)\n html_parts.append(\n _sub_theme_vars(str(lead[\"template\"]), styles)\n .replace(\"{content}\", body).replace(\"{arg}\", \"\"))\n skip_until = j\n continue\n # 正文位的引用若以破折号带出处收尾,那是**金句**,升级成金句卡。\n # 这不是推断语义——出处是作者自己写的,破折号也是他自己敲的,\n # 排版层只是把这个明确信号接住。所以不需要扩展 markdown 标记。\n #\n # 破折号收三种写法:中文正规的 `——`、单个 `—`、以及英文习惯的 `--`。\n #\n # ⚠️ 出处上限 25 字符(`[^—]{0,24}`),是卡片版式撑得下的长度。这条判据\n # 与 write.py 的 QUOTE_CARD_RE **逐字相同**,改一处必须同改两处——两边一\n # 分叉就会出现「写的时候报合格、排的时候不成卡」,而作者看不出来。\n if not in_blockquote and (components or {}).get(\"quote-card\", {}).get(\"template\"):\n buf, j = [], line_idx\n while j \u003c len(lines) and lines[j].strip().startswith(\">\"):\n buf.append(lines[j].strip()[1:].strip())\n j += 1\n whole = \" \".join(x for x in buf if x)\n m = re.match(r\"^(.*?)\\s*(?:——|—|--)\\s*([^\\s—][^—]{0,24})$\", whole)\n if m and m.group(1).strip():\n card = components[\"quote-card\"]\n html_parts.append(\n _sub_theme_vars(str(card[\"template\"]), styles)\n .replace(\"{content}\", _inline_format(m.group(1).strip(), styles))\n .replace(\"{arg}\", _inline_format(m.group(2).strip(), styles)))\n skip_until = j\n continue\n\n if not in_blockquote:\n # 大引号原先只给了 `:::quote-card`,而真稿里从来没人写那个语法——\n # 每篇实际出现的是普通的 `>` 引用。骨架放 `quote-mark.yaml`\n # (纯装饰、无占位符)就在引用块前面补一个引号。\n mark = (components or {}).get(\"quote-mark\") or {}\n if mark.get(\"template\"):\n html_parts.append(_sub_theme_vars(str(mark[\"template\"]), styles))\n html_parts.append(f'\u003cblockquote style=\"{styles.get(\"blockquote\", \"\")}\">')\n in_blockquote = True\n quote_text = stripped[1:].strip()\n if not quote_text:\n # 引用块内的空行(单独一个 >):保持引用块打开\n continue\n text = _inline_format(quote_text, styles)\n html_parts.append(\n f'\u003cp style=\"margin:0.3em 0; font-size:{styles[\"font-size\"]}; '\n f'line-height:{styles[\"line-height\"]};\">{text}\u003c/p>'\n )\n continue\n elif in_blockquote:\n close_blockquote()\n\n # 列表项检测(支持嵌套:通过缩进层级判断)\n # CommonMark 的无序标记有 - * + 三种,有序有 `1.` 和 `1)` 两种。\n # 此前只认 - * 和 `1.`,写 + 或 `1)` 的会整行当成普通段落漏出去。\n ul_match = re.match(r'^( *)[-*+]\\s+', line)\n ol_match = re.match(r'^( *)\\d+[.)]\\s+', line)\n if ul_match or ol_match:\n flush_paragraph()\n close_blockquote()\n indent = len((ul_match or ol_match).group(1))\n # 缩进层级:每 2 个空格(或 1 个 tab)为一级\n level = indent // 2\n # 缩进跳级(如直接 4 空格)时只加深一层,避免产生空的嵌套容器\n if level > list_depth + 1:\n level = list_depth + 1\n list_type = \"ul\" if ul_match else \"ol\"\n\n ul_style = styles.get(\"ul\", \"\") or f'margin:0.8em 0; padding-left:1.5em; color:{styles[\"text-color\"]};'\n ol_style = styles.get(\"ol\", \"\") or f'margin:0.8em 0; padding-left:1.5em; color:{styles[\"text-color\"]};'\n li_style = styles.get(\"li\", \"\") or (\n f'margin:0.4em 0; font-size:{styles[\"font-size\"]}; '\n f'line-height:{styles[\"line-height\"]};'\n )\n\n # 需要更深的嵌套\n while level > list_depth:\n tag = list_type\n st = ul_style if tag == \"ul\" else ol_style\n # 子列表不需要外边距\n if list_depth >= 0:\n st = re.sub(r'margin:[^;]+;?', '', st).strip()\n if not st:\n st = f'padding-left:1.5em; color:{styles[\"text-color\"]};'\n html_parts.append(f'\u003c{tag} style=\"{st}\">')\n list_stack.append(tag)\n list_depth += 1\n\n # 需要回退到更浅的层级\n while level \u003c list_depth:\n if list_stack:\n html_parts.append(f'\u003c/{list_stack.pop()}>')\n list_depth -= 1\n\n # 同层级但列表类型变了\n if list_stack and list_stack[-1] != list_type:\n html_parts.append(f'\u003c/{list_stack.pop()}>')\n st = ul_style if list_type == \"ul\" else ol_style\n html_parts.append(f'\u003c{list_type} style=\"{st}\">')\n list_stack.append(list_type)\n\n # 第一层还没开始\n if not list_stack:\n st = ul_style if list_type == \"ul\" else ol_style\n html_parts.append(f'\u003c{list_type} style=\"{st}\">')\n list_stack.append(list_type)\n list_depth = 0\n\n if ul_match:\n raw_text = re.sub(r'^[-*+]\\s+', '', stripped).strip()\n else:\n raw_text = re.sub(r'^\\d+[.)]\\s+', '', stripped).strip()\n if not raw_text:\n continue\n # 「**标签**:说明」是真稿里最常见的列表形态——五篇稿 34 个列表项里 21 个\n # 是这个样子(62%),4/5 篇文章有。它现在只是一个普通 li 里加粗了几个字。\n # 骨架放 `li-label.yaml`({c0}=标签,{c1}=说明)就能把标签在视觉上提出来。\n #\n # 只认形态,不推断语义。有序列表在 markdown 里只表示「枚举」,不表示「顺序」,\n # 所以不能因为看见 1. 2. 3. 就渲染成「第一步 第二步」——那是替作者断言了一个\n # 他没说的顺序。真稿实测:三组多项有序列表里,只有一组真有先后,另外两组\n # (配置台的五个板块、三个要问自己的问题)都是并列的。\n # GFM 任务列表 `- [ ]` / `- [x]`。不处理的话方括号原样漏进正文。\n # 图标直接取 checklist 组件 row_map 里的三态图标——那是同一个语义,\n # 一份来源,四套骨架各自的方言(面 / 线 / 发丝线 / 中文单字)自动跟上。\n task = re.match(r'^\\[([ xX])\\]\\s+(.*)

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, raw_text)\n if task:\n icons = (((components or {}).get(\"checklist\") or {}).get(\"row_map\")\n or {}).get(\"c0\") or {}\n mark = icons.get(\"done\" if task.group(1).lower() == \"x\" else \"todo\", \"\")\n html_parts.append(\n f'\u003cli style=\"{li_style}; list-style:none; display:flex; '\n f'align-items:flex-start;\">'\n f'\u003csection style=\"flex:0 0 auto; width:24px;\">'\n f'{_sub_theme_vars(str(mark), styles)}\u003c/section>'\n f'\u003csection style=\"flex:1;\">'\n f'{_inline_format(task.group(2), styles)}\u003c/section>\u003c/li>')\n in_list = list_type\n continue\n\n label = _load_components and (components or {}).get(\"li-label\") or {}\n m = re.match(r\"^\\*\\*([^*]+)\\*\\*[::]?\\s*(.*)$\", raw_text, re.S)\n if label.get(\"template\") and m and m.group(2).strip():\n row = _sub_theme_vars(str(label[\"template\"]), styles)\n html_parts.append(\n row.replace(\"{c0}\", _inline_format(m.group(1).strip(), styles))\n .replace(\"{c1}\", _inline_format(m.group(2).strip(), styles)))\n else:\n html_parts.append(f'\u003cli style=\"{li_style}\">'\n f'{_inline_format(raw_text, styles)}\u003c/li>')\n in_list = list_type\n continue\n\n close_list()\n close_blockquote()\n # 收集原始行而不是 stripped:CommonMark 的硬换行信号就是「行尾两个空格」,\n # strip 过就没了。左侧空白仍然去掉,缩进不影响段落。\n paragraph_lines.append(line.rstrip(\"\\n\").lstrip()\n if line.rstrip(\"\\n\").rstrip().endswith(\"\\\\\")\n or line.rstrip(\"\\n\").endswith(\" \") else stripped)\n\n flush_paragraph()\n close_list()\n close_blockquote()\n\n # 文末记号。文章现在是戛然而止——最后一段完了就没了。骨架放 `article-end.yaml`\n # (纯装饰、无占位符)就在正文末尾补一个收束。每篇一次,最不会过量的位置。\n end = (components or {}).get(\"article-end\") or {}\n if end.get(\"template\"):\n html_parts.append(_sub_theme_vars(str(end[\"template\"]), styles))\n\n if footnotes:\n # 微信删 id,锚点跳不动,所以不做跳转链接,只列注解表——纸质书的做法。\n muted = styles.get(\"text-muted\", \"#6B7078\")\n items = \"\".join(\n f'\u003csection style=\"margin:0 0 8px; font-size:13px; line-height:1.75; '\n f'color:{muted};\">\u003csup>[{i + 1}]\u003c/sup> {_inline_format(txt, styles)}\u003c/section>'\n for i, (_, txt) in enumerate(footnotes))\n html_parts.append(\n f'\u003csection style=\"margin:44px 0 0; padding-top:14px; '\n f'border-top:1px solid #E8EAED;\">{items}\u003c/section>')\n return \"\".join(html_parts)\n\n\ndef _inline_format(text: str, styles: dict) -> str:\n r\"\"\"行内格式:加粗、斜体、删除线、行内代码、链接、自动链接、转义。\n\n 链路是「markdown 语法 → LLM 按语法输出 → 渲染器排版」。LLM 写的是**标准**\n markdown,所以渲染器认不认标准写法就是渲染器的责任,不能反过来要求 LLM 只用\n 我们实现了的那个子集。\n\n 此前只认 `**b**` `*i*` 一种写法,而 `__b__` `_i_` 同样是 CommonMark 的合法写法、\n 也是 LLM 最常输出的形式——结果是下划线原样漏进正文,读者直接看见 `__加粗__`。\n 裸 URL 和 `\u003curl>` 同理。这类问题不报错、渲染照常完成,只有读者会看见。\n\n 行内代码先抽出来占位,内容做 HTML 转义,且不参与后续任何替换——否则\n `` `a_b_c` `` 里的下划线会被当成斜体。转义符 `\\*` 也走同一套占位机制。\n \"\"\"\n code_style = styles.get(\"code\", \"\")\n if not code_style:\n code_style = (\n f'background:{styles.get(\"bg-light\", \"#F7F7F7\")}; padding:2px 6px; '\n f'border-radius:3px; font-size:0.9em; color:{styles.get(\"primary-color\", \"#333\")};'\n )\n code_spans: list[str] = []\n\n def _stash_code(m: re.Match) -> str:\n code_spans.append(\n f'\u003ccode style=\"{code_style}\">{html_mod.escape(m.group(1))}\u003c/code>'\n )\n return f\"\\x00C{len(code_spans) - 1}\\x00\"\n\n text = re.sub(r'`([^`\\n]+)`', _stash_code, text)\n\n # 反斜杠转义。`\\*不是斜体\\*` 里的星号必须原样留下,且不能参与后面的斜体匹配,\n # 所以和行内代码一样先抽成占位符,最后再还原。\n escapes: list[str] = []\n\n def _stash_escape(m: re.Match) -> str:\n escapes.append(html_mod.escape(m.group(1)))\n return f\"\\x00E{len(escapes) - 1}\\x00\"\n\n text = re.sub(r'\\\\([\\\\`*_{}\\[\\]()#+\\-.!~>|])', _stash_escape, text)\n\n # strong\n strong_style = styles.get(\"strong\", \"\")\n if not strong_style:\n strong_color = styles.get(\"strong-color\", styles.get(\"primary-color\", \"#333\"))\n strong_style = f\"color:{strong_color}; font-weight:bold;\"\n text = re.sub(\n r'\\*\\*(.+?)\\*\\*',\n rf'\u003cstrong style=\"{strong_style}\">\\1\u003c/strong>',\n text,\n )\n # __加粗__ 同样是 CommonMark 合法写法。要求两侧不是单词字符,避免把\n # snake_case 的标识符(`my__var`)误判成加粗。\n text = re.sub(\n r'(?\u003c![\\w*])__(?!\\s)(.+?)(?\u003c!\\s)__(?![\\w*])',\n rf'\u003cstrong style=\"{strong_style}\">\\1\u003c/strong>',\n text,\n )\n # em\n em_style = styles.get(\"em\", \"\")\n em_open = f'\u003cem style=\"{em_style}\">' if em_style else \"\u003cem>\"\n text = re.sub(r'\\*(?!\\s)(.+?)(?\u003c!\\s)\\*', rf'{em_open}\\1\u003c/em>', text)\n # _斜体_ 同样合法。同样要求两侧不是单词字符——`file_name_here` 不能变斜体。\n text = re.sub(r'(?\u003c![\\w_])_(?!\\s)([^_\\n]+?)(?\u003c!\\s)_(?![\\w_])', rf'{em_open}\\1\u003c/em>', text)\n # strikethrough ~~text~~\n del_style = styles.get(\"del\", \"\") or \"text-decoration:line-through; color:#999;\"\n text = re.sub(r'~~(.+?)~~', rf'\u003cdel style=\"{del_style}\">\\1\u003c/del>', text)\n # link(排除行内图片语法 ![alt](src))\n a_style = styles.get(\"a\", \"\")\n if not a_style:\n a_style = f'color:{styles.get(\"link-color\", \"#576B95\")}; text-decoration:none;'\n text = re.sub(\n r'(?\u003c!!)\\[(.+?)\\]\\((.+?)\\)',\n rf'\u003ca style=\"{a_style}\" href=\"\\2\">\\1\u003c/a>',\n text,\n )\n # \u003chttps://…> 自动链接\n text = re.sub(r'<(https?://[^\\s\u003c>]+)>|\u003c(https?://[^\\s\u003c>]+)>',\n lambda m: f'\u003ca style=\"{a_style}\" href=\"{m.group(1) or m.group(2)}\">'\n f'{m.group(1) or m.group(2)}\u003c/a>', text)\n # 裸 URL。必须排在 \u003ca href=\"…\"> 已经生成之后,所以先把已有的 a 标签抽走占位,\n # 否则会把 href 里的地址再包一层 a。行尾的中文标点不算 URL 的一部分。\n links: list[str] = []\n\n def _stash_link(m: re.Match) -> str:\n links.append(m.group(0))\n return f\"\\x00L{len(links) - 1}\\x00\"\n\n text = re.sub(r'\u003ca\\s[^>]*>.*?\u003c/a>', _stash_link, text, flags=re.S)\n text = re.sub(r'(?\u003c![\\w\"\\'=/])(https?://[^\\s\u003c>\"\\',。、)】」]+)',\n lambda m: f'\u003ca style=\"{a_style}\" href=\"{m.group(1)}\">{m.group(1)}\u003c/a>', text)\n text = re.sub(r\"\\x00L(\\d+)\\x00\", lambda m: links[int(m.group(1))], text)\n\n # 还原行内代码与转义字符\n text = re.sub(r\"\\x00C(\\d+)\\x00\", lambda m: code_spans[int(m.group(1))], text)\n text = re.sub(r\"\\x00E(\\d+)\\x00\", lambda m: escapes[int(m.group(1))], text)\n return text\n\n\ndef _setext_to_atx(md: str) -> str:\n \"\"\"`标题\\n====` → `# 标题`。CommonMark 的 Setext 写法,LLM 偶尔会用。\n\n 只处理 `=`(一级)。`-` 那种不碰——`---` 同时也是分隔线的写法,按 CommonMark\n 要看上一行是不是段落才能区分,规则微妙而收益很小,不值得为它引入歧义。\n \"\"\"\n out, lines = [], md.split(\"\\n\")\n i = 0\n while i \u003c len(lines):\n nxt = lines[i + 1] if i + 1 \u003c len(lines) else \"\"\n if lines[i].strip() and re.match(r\"^ {0,3}=+\\s*$\", nxt):\n out.append(\"# \" + lines[i].strip())\n i += 2\n continue\n out.append(lines[i])\n i += 1\n return \"\\n\".join(out)\n\n\ndef _resolve_ref_links(md: str) -> str:\n \"\"\"把 `[文字][ref]` + `[ref]: https://…` 折成行内链接 `[文字](https://…)`。\n\n 不解析的话,`[文字][ref]` 会原样漏进正文,而底部那行 `[ref]: …` 会变成一个\n 莫名其妙的段落。`[文字][]` 与 `[文字]`(简写引用)也一并支持。\n \"\"\"\n defs = {}\n\n def _take(m: re.Match) -> str:\n defs[m.group(1).lower()] = m.group(2).strip()\n return \"\"\n\n md = re.sub(r'^ {0,3}\\[([^\\]]+)\\]:\\s*(\\S+).*

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, _take, md, flags=re.M)\n if not defs:\n return md\n\n def _sub(m: re.Match) -> str:\n label = (m.group(2) or m.group(1)).strip().lower()\n url = defs.get(label)\n return f\"[{m.group(1)}]({url})\" if url else m.group(0)\n\n md = re.sub(r'(?\u003c!!)\\[([^\\]]+)\\]\\[([^\\]]*)\\]', _sub, md)\n return re.sub(r'(?\u003c!!)(?\u003c!\\])\\[([^\\]^][^\\]]*)\\](?![\\(\\[:])', _sub, md)\n\n\ndef _extract_footnotes(md: str) -> tuple[str, list[tuple[str, str]]]:\n \"\"\"抽出 `[^1]: 注解`,正文里的 `[^1]` 换成上标序号。\n\n 微信会删掉 `id` 属性,所以脚注**跳不动**——锚点链接在公众号里是死的。\n 因此不做跳转,只做「上标编号 + 文末注解表」这种纸质书的做法。\n 不处理的话,`[^1]` 会原样漏进正文,定义行还会变成一个孤立段落。\n \"\"\"\n notes: dict[str, str] = {}\n\n def _take(m: re.Match) -> str:\n notes[m.group(1)] = m.group(2).strip()\n return \"\"\n\n md = re.sub(r'^ {0,3}\\[\\^([^\\]]+)\\]:\\s*(.+)

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…

, _take, md, flags=re.M)\n if not notes:\n return md, []\n order: list[tuple[str, str]] = []\n\n def _mark(m: re.Match) -> str:\n key = m.group(1)\n if key not in notes:\n return m.group(0)\n if key not in [k for k, _ in order]:\n order.append((key, notes[key]))\n return f'\u003csup>[{[k for k, _ in order].index(key) + 1}]\u003c/sup>'\n\n md = re.sub(r'\\[\\^([^\\]]+)\\]', _mark, md)\n return md, order\n\n\n\ndef _wrap_document(body_html: str, styles: dict) -> str:\n \"\"\"包装为 HTML section。\"\"\"\n # 行长(左右留白)必须由容器统一控制。此前是在 p 上打 padding:0 12px,\n # 标题、引用、表格都不跟随,于是标题比正文宽出 12px——一条一直没被发现的对齐 bug。\n style = (\n f'font-family:{styles.get(\"font-family\", \"sans-serif\")}; '\n f'font-size:{styles[\"font-size\"]}; '\n f'line-height:{styles[\"line-height\"]}; '\n f'color:{styles[\"text-color\"]}; '\n f'padding:16px {styles.get(\"page-padding\", \"16px\")}; text-align:left;'\n )\n # 整篇深色模版靠这一条:容器本身给底色,正文所有颜色都相对它设定\n if styles.get(\"page-background\"):\n style += f' background:{styles[\"page-background\"]};'\n return f'\u003csection style=\"{style}\">\\n{body_html}\\n\u003c/section>'\n\n\n# ── CLI ──────────────────────────────────────────────────────\n\ndef main():\n parser = argparse.ArgumentParser(\n description=\"公众号文章排版工具\",\n formatter_class=argparse.RawDescriptionHelpFormatter,\n epilog=__doc__,\n )\n parser.add_argument(\"input\", nargs=\"?\", help=\"Markdown 文件路径\")\n parser.add_argument(\n \"--theme\",\n default=None,\n help=f\"主题名;省略则仅读取本篇 article.yaml 的 default_format_preset,再无则内置默认模版 {DEFAULT_THEME}\",\n )\n parser.add_argument(\"--scheme\", help=\"配色方案名(主题 schemes 里的 name);省略则读本篇 article.yaml 的 default_format_scheme,再无则用主题默认色\")\n parser.add_argument(\"--color\", help=\"覆盖主色(如 #0F4C81)\")\n parser.add_argument(\"--font-size\", help=\"覆盖字号(如 16px)\")\n parser.add_argument(\"-o\", \"--output\", help=\"输出路径(默认同名 .html)\")\n parser.add_argument(\"--no-preformat\", action=\"store_true\", help=\"跳过 Markdown 预格式化\")\n parser.add_argument(\"--list-themes\", action=\"store_true\", help=\"列出可用模版:长相、适合什么、每套配色的色值与口径\")\n parser.add_argument(\n \"--preview\",\n nargs=\"?\",\n const=\"\",\n metavar=\"模版名\",\n help=\"把样张渲成对照页并写文件:给模版名则并列它的每套配色,不给则并列所有模版的默认色\",\n )\n parser.add_argument(\n \"--export-theme\",\n metavar=\"主题名\",\n help=\"以 YAML 导出主题(合并默认变量与样式),可重定向到 .aws-article/presets/formatting/\u003c名>.yaml 后修改\",\n )\n\n args = parser.parse_args()\n\n if args.list_themes:\n print(\"可用模版(选模版看「适合」,选配色看色值后面那句):\\n\")\n for t in _list_themes():\n label = f\" ({t['label']})\" if t[\"label\"] and t[\"label\"] != t[\"name\"] else \"\"\n print(f\"■ {t['name']}{label} [{t['source']}]\")\n if t[\"description\"]:\n print(f\" 长相:{t['description']}\")\n if t.get(\"when_to_use\"):\n print(f\" 适合:{_indent_lines(t['when_to_use'])}\")\n if t.get(\"when_not_to_use\"):\n print(f\" 不适合:{_indent_lines(t['when_not_to_use'])}\")\n schemes = t.get(\"schemes\") or []\n default_i = _default_scheme_index(t)\n for i, sc in enumerate(schemes):\n mark = \"默认\" if i == default_i else \" \"\n color = f\" {sc['color']}\" if sc[\"color\"] else \"\"\n print(f\" 配色 [{mark}] {sc['name']}{color} {sc['description']}\")\n if schemes:\n print(f\" 预览:format.py --preview {t['name']}\"\n + (f\" 或 {PREVIEW_BASE}/{t['skeleton']}/{max(default_i, 0)}.html\"\n if t[\"skeleton\"] else \"\"))\n print()\n return\n\n if args.preview is not None:\n _write_preview(args.preview, args.output)\n return\n\n if args.export_theme:\n _export_theme(args.export_theme)\n return\n\n if not args.input:\n parser.print_help()\n sys.exit(0)\n\n input_path = Path(args.input).resolve()\n if not input_path.exists():\n _err(f\"文件不存在: {input_path}\")\n\n draft_dir = input_path.parent\n article_ctx = _load_article_context(draft_dir)\n\n if args.theme is None:\n preset = _coerce_single_preset(\"default_format_preset\", article_ctx.get(\"default_format_preset\"))\n theme_name = preset if preset else DEFAULT_THEME\n if preset:\n _info(f\"主题来自本篇 article.yaml 的 default_format_preset: {theme_name}\")\n else:\n theme_name = args.theme\n\n md_text = input_path.read_text(encoding=\"utf-8\")\n\n if not args.no_preformat:\n md_text = _preformat_markdown(md_text)\n _info(\"Markdown 预格式化完成(中英文间距、引号、空行)\")\n\n theme = _load_theme(theme_name)\n\n scheme_name = args.scheme\n if scheme_name is None:\n raw = article_ctx.get(\"default_format_scheme\")\n scheme_name = _coerce_single_preset(\"default_format_scheme\", raw) if isinstance(raw, (list, tuple)) else (str(raw).strip() if raw else \"\")\n if scheme_name:\n _info(f\"配色来自本篇 article.yaml 的 default_format_scheme: {scheme_name}\")\n if scheme_name:\n theme = _apply_scheme(theme, scheme_name)\n _info(f\"配色: {scheme_name}\")\n\n overrides = {}\n if args.color:\n overrides[\"primary-color\"] = args.color\n if args.font_size:\n overrides[\"font-size\"] = args.font_size\n\n _info(f\"主题: {theme_name}\")\n styles = _build_styles(theme, overrides)\n caption_style = str(_merge_format_context(draft_dir).get(\"caption_style\") or CAPTION_ALWAYS)\n skeleton = str(theme.get(\"skeleton\") or \"\").strip()\n components = _load_components(skeleton)\n if components:\n _info(f\"已加载版式组件 {len(components)} 个\"\n + (f\"(骨架 {skeleton})\" if skeleton else \"\")\n + f\": {', '.join(sorted(components))}\")\n body_html = _md_to_html(md_text, styles, caption_style=caption_style, components=components)\n\n embeds = _resolve_embeds_config(draft_dir)\n if embeds:\n body_html = _resolve_embeds(body_html, embeds)\n _info(\"嵌入元素已替换(名片/小程序/小程序卡片/链接)\")\n\n # 每篇专属文末:若同目录存在 closing.md,则将其转换为 HTML 并追加到文末\n closing_md_path = input_path.parent / \"closing.md\"\n if closing_md_path.exists():\n closing_md = closing_md_path.read_text(encoding=\"utf-8\")\n # 不对 closing.md 进行预格式化,避免意外更改作者自定义的链接与排版\n closing_html = _md_to_html(closing_md, styles, skip_first_h1=False, caption_style=caption_style, components=components)\n # 以段落分隔以避免直接黏连\n body_html = f\"{body_html}\\n\\n\u003cdiv style=\\\"margin-top:1.5em\\\">\u003c/div>\\n{closing_html}\"\n _info(f\"已追加文末区块: {closing_md_path}\")\n\n full_html = _wrap_document(body_html, styles)\n\n output_path = Path(args.output) if args.output else input_path.with_suffix(\".html\")\n output_path.parent.mkdir(parents=True, exist_ok=True)\n output_path.write_text(full_html, encoding=\"utf-8\")\n _ok(f\"已保存: {output_path}\")\n\n\nif __name__ == \"__main__\":\n main()\n","content_type":"text/x-python; charset=utf-8","language":"python","size":94992,"content_sha256":"054ac8338d01947e41017220ebfdbaff227d0c5cf221af6901bb677f262bd0ed"},{"filename":"skill.json","content":"{\n \"name\": \"aws-wechat-article-formatting\",\n \"version\": \"0.4.0\",\n \"author\": \"aiworkskills\",\n \"description\": \"给公众号文章排版,转换为可直接粘贴到微信后台的格式,支持多套主题。\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/aiworkskills/wechat-article-skills\",\n \"tags\": [\"wechat\", \"公众号\", \"formatting\", \"html\"],\n \"permissions\": [\"filesystem\", \"shell\"],\n \"entryPoint\": {\n \"type\": \"natural\",\n \"path\": \"SKILL.md\"\n }\n}\n","content_type":"application/json; charset=utf-8","language":"json","size":475,"content_sha256":"f293962a62e3b9667a0c7629b4cbd9467e2c894c8e5054d9795ca85c884e3d29"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"排版","type":"text"}]},{"type":"paragraph","content":[{"text":"公众号一键排版","type":"text","marks":[{"type":"strong"}]},{"text":" —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"套件说明","type":"text","marks":[{"type":"strong"}]},{"text":" · 本 skill 属 ","type":"text"},{"text":"aws-wechat-article-*","type":"text","marks":[{"type":"code_inline"}]},{"text":" 一条龙套件(共 9 个 slug,入口 ","type":"text"},{"text":"aws-wechat-article-main","type":"text","marks":[{"type":"code_inline"}]},{"text":")。跨 skill 的相对引用依赖同一 ","type":"text"},{"text":"skills/","type":"text","marks":[{"type":"code_inline"}]},{"text":" 目录,建议一并 ","type":"text"},{"text":"clawhub install","type":"text","marks":[{"type":"code_inline"}]},{"text":" 全套。源码:","type":"text"},{"text":"https://github.com/aiworkskills/wechat-article-skills","type":"text","marks":[{"type":"link","attrs":{"href":"https://github.com/aiworkskills/wechat-article-skills","title":null}}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"能力披露(Capabilities)","type":"text"}]},{"type":"paragraph","content":[{"text":"本 skill 为","type":"text"},{"text":"纯本地","type":"text","marks":[{"type":"strong"}]},{"text":" Markdown → HTML 转换,零网络、零凭证。","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"凭证","type":"text","marks":[{"type":"strong"}]},{"text":":无","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"网络","type":"text","marks":[{"type":"strong"}]},{"text":":无","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"文件读(仓库内)","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":".aws-article/config.yaml","type":"text","marks":[{"type":"code_inline"}]},{"text":"、本篇 ","type":"text"},{"text":"article.yaml","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"article.md","type":"text","marks":[{"type":"code_inline"}]},{"text":"、可选 ","type":"text"},{"text":"closing.md","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":".aws-article/presets/formatting/\u003c名>.yaml","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"文件读(仓库外)","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"~/.aws-article/presets/formatting/","type":"text","marks":[{"type":"code_inline"}]},{"text":"(跨项目共享的自定义主题;","type":"text"},{"text":"只读预设文件,不读凭证","type":"text","marks":[{"type":"strong"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"文件写","type":"text","marks":[{"type":"strong"}]},{"text":":本篇 ","type":"text"},{"text":"article.html","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"shell","type":"text","marks":[{"type":"strong"}]},{"text":":仅 ","type":"text"},{"text":"{python} {baseDir}/scripts/format.py","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"paragraph","content":[{"text":"单独安装可直接使用","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"format.py","type":"text","marks":[{"type":"code_inline"}]},{"text":" 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 ","type":"text"},{"text":"../aws-wechat-article-main/references/*.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" 的链接在套件未装齐时会断,但排版功能本身可用。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"路由","type":"text"}]},{"type":"paragraph","content":[{"text":"一键发文且未明确只要排版 → ","type":"text"},{"text":"aws-wechat-article-main","type":"text","marks":[{"type":"link","attrs":{"href":"../aws-wechat-article-main/SKILL.md","title":null}}]},{"text":"。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"配置检查 ⛔","type":"text"}]},{"type":"paragraph","content":[{"text":"任何操作前先按 ","type":"text"},{"text":"首次引导 · 检测顺序","type":"text","marks":[{"type":"link","attrs":{"href":"../aws-wechat-article-main/references/first-time-setup.md","title":null}},{"type":"strong"}]},{"text":" 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"内置模版","type":"text"}]},{"type":"paragraph","content":[{"text":"排版 = ","type":"text"},{"text":"模版","type":"text","marks":[{"type":"strong"}]},{"text":"(骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× ","type":"text"},{"text":"配色","type":"text","marks":[{"type":"strong"}]},{"text":"(一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"模版","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"适合","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"不适合","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"配色(第一个是默认)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"亲和","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"教程、职场、面向新手的解释性长文","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"严肃议题、极简冷硬的品牌","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"黛紫 / 松绿 / 靛蓝","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"资讯","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"快讯、评测、行业观察","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"抒情散文、碎片化短段","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"墨绿 / 绛红 / 藏青","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"书卷","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"人文、读书、历史、深度长文","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"工程文档、数据密集的评测","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"朱砂 / 黛蓝 / 苍绿","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"杂志","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"品牌故事、人物访谈、生活方式","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"没有配图的稿子、信息型短文","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"石青 / 驼褐 / 铁锈","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"不传 ","type":"text","marks":[{"type":"strong"}]},{"text":"--theme","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":" 时的内置默认是 ","type":"text","marks":[{"type":"strong"}]},{"text":"亲和","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":"。","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"另外四套不随 skill 内置,在 aiworkskills.cn 选好模版和配色后随 ","type":"text"},{"text":".aws","type":"text","marks":[{"type":"code_inline"}]},{"text":" 预设包下发到 ","type":"text"},{"text":".aws-article/presets/formatting/","type":"text","marks":[{"type":"code_inline"}]},{"text":"(见 ","type":"text"},{"text":"assets skill","type":"text","marks":[{"type":"link","attrs":{"href":"../aws-wechat-article-assets/SKILL.md","title":null}}]},{"text":"):","type":"text"},{"text":"活力","type":"text","marks":[{"type":"code_inline"}]},{"text":"(产品发布、增长复盘)、","type":"text"},{"text":"手账","type":"text","marks":[{"type":"code_inline"}]},{"text":"(个人笔记、复盘)、","type":"text"},{"text":"硬朗","type":"text","marks":[{"type":"code_inline"}]},{"text":"(观点、宣言)、","type":"text"},{"text":"技术","type":"text","marks":[{"type":"code_inline"}]},{"text":"(工程实践、代码讲解)。网站上选的配色会烘进 YAML 顶层 ","type":"text"},{"text":"variables","type":"text","marks":[{"type":"code_inline"}]},{"text":",落地后不需要额外配置。","type":"text"}]},{"type":"paragraph","content":[{"text":"选之前先跑一次","type":"text","marks":[{"type":"strong"}]},{"text":",判据、色值、每套配色的口径都在输出里,别只按名字猜:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"{python} {baseDir}/scripts/format.py --list-themes","type":"text"}]},{"type":"paragraph","content":[{"text":"说不清就看","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"--preview","type":"text","marks":[{"type":"code_inline"}]},{"text":" 把样张渲成并列对照页(每栏 375px,与真机同宽),用浏览器打开。","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"{python} {baseDir}/scripts/format.py --preview 亲和 -o preview.html # 该模版的每套配色并列\n{python} {baseDir}/scripts/format.py --preview -o preview.html # 所有模版的默认色并列","type":"text"}]},{"type":"paragraph","content":[{"text":"线上同一批预览:","type":"text"},{"text":"https://aiworkskills.cn/format-previews/\u003c骨架>/\u003c配色序号>.html","type":"text","marks":[{"type":"code_inline"}]},{"text":",骨架名见 ","type":"text"},{"text":"--list-themes","type":"text","marks":[{"type":"code_inline"}]},{"text":"。","type":"text"}]},{"type":"paragraph","content":[{"text":"换配色","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"--scheme \u003c配色名>","type":"text","marks":[{"type":"code_inline"}]},{"text":",或本篇 ","type":"text"},{"text":"article.yaml","type":"text","marks":[{"type":"code_inline"}]},{"text":" 写 ","type":"text"},{"text":"default_format_scheme: [松绿]","type":"text","marks":[{"type":"code_inline"}]},{"text":"(单元素列表,由 main 的本篇预设落盘步骤写入)。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"图注只认显式写的 title ⛔","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"![信息图:画面指令给生图模型看](imgs/x.png \"图注给读者看\")","type":"text"}]},{"type":"paragraph","content":[{"text":"括号里路径之后引号中的才是图注。","type":"text"},{"text":"alt 冒号后那段是画面指令,不会显示给读者。","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"早先的实现拿画面指令兼任图注,产出过这种东西:图上画着一个人站在 99.9 的牌子前望向远方,图注写「开发者站在巨型 99.9 分数牌前,视线越过分数望向复杂而开放的城市与工作现场」——把读者眼睛已经看见的复述一遍,零信息;图没生成出来时更会同一句话出现两次(破图 alt 一次、图注一次)。","type":"text"}]},{"type":"paragraph","content":[{"text":"没写 title 就不出图注","type":"text","marks":[{"type":"strong"}]},{"text":",这是有意的:绝大多数图不需要图注,错的图注比没有更糟。图注该补充画面之外的东西——数据出处、一句判断、反常识的细节。","type":"text"}]},{"type":"paragraph","content":[{"text":"出不出图注还受合并配置的 ","type":"text"},{"text":"caption_style","type":"text","marks":[{"type":"code_inline"}]},{"text":" 控制:","type":"text"},{"text":"有图注","type":"text","marks":[{"type":"code_inline"}]},{"text":" 全出、","type":"text"},{"text":"无图注","type":"text","marks":[{"type":"code_inline"}]},{"text":" 全不出、","type":"text"},{"text":"关键图有","type":"text","marks":[{"type":"code_inline"}]},{"text":" 只有信息位的图(信息图 / 实证)出。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"从标准 markdown 认形态(主路径)","type":"text"}]},{"type":"paragraph","content":[{"text":"写作侧只产出标准 markdown","type":"text","marks":[{"type":"strong"}]},{"text":",识别结构是排版层的事。让写手同时掌握标准 markdown 和一套私有语法就是耦合,而且那套语法只有本套件认得,稿子换个工具就废了。","type":"text"}]},{"type":"paragraph","content":[{"text":"渲染器会认这些形态,作者不用写任何特殊语法:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"作者写的标准 markdown","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"排版层做的事","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"**加粗**","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"上本模版的重点色或荧光底——正文里唯一的扫读落点","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"- **标签**:说明","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"标签在视觉上提出来(真稿里 62% 的列表项是这个形状)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"- [ ]","type":"text","marks":[{"type":"code_inline"}]},{"text":" / ","type":"text"},{"text":"- [x]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"换成该骨架的三态图标","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"> 金句。 —— 出处","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"排成金句卡(正文位、带破折号出处的引用)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"> 引文","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"前面补一个大引号","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"![图](x.png \"图注\")","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"四角标 + 图注","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"---","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"装饰分隔","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"##","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"标题装饰(笔锋 / 折角块)","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"只认形态,不推断语义。","type":"text","marks":[{"type":"strong"}]},{"text":" 有序列表在 markdown 里只表示「枚举」不表示「顺序」,所以不会因为看见 ","type":"text"},{"text":"1. 2. 3.","type":"text","marks":[{"type":"code_inline"}]},{"text":" 就渲染成「第一步 第二步」——那是替作者断言一个他没说的顺序。真稿实测:三组多项有序列表里只有一组真有先后。","type":"text"}]},{"type":"paragraph","content":[{"text":":::","type":"text","marks":[{"type":"code_inline"}]},{"text":" 组件语法排版侧仍然认,但","type":"text"},{"text":"写手不再产出","type":"text","marks":[{"type":"strong"}]},{"text":"——细则见 ","type":"text"},{"text":"branches.md「一」","type":"text","marks":[{"type":"link","attrs":{"href":"references/branches.md","title":null}}]},{"text":"。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"工作流","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"排版进度:\n- [ ] 第0步:⛔ 配置检查\n- [ ] 第1步:确定模版与配色\n- [ ] 第2步:转换\n- [ ] 第3步:核对输出","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第1步:确定模版与配色","type":"text"}]},{"type":"paragraph","content":[{"text":"--theme","type":"text","marks":[{"type":"code_inline"}]},{"text":" 显式指定最优先;不传则读本篇 ","type":"text"},{"text":"article.yaml","type":"text","marks":[{"type":"code_inline"}]},{"text":" 的 ","type":"text"},{"text":"default_format_preset","type":"text","marks":[{"type":"code_inline"}]},{"text":"(单元素列表),再无则内置默认 ","type":"text"},{"text":"亲和","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":"。完整解析顺序与配色的同套规则见 ","type":"text"},{"text":"branches.md「二」","type":"text","marks":[{"type":"link","attrs":{"href":"references/branches.md","title":null}}]},{"text":"。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第2步:转换","type":"text"}]},{"type":"paragraph","content":[{"text":"在","type":"text"},{"text":"仓库根","type":"text","marks":[{"type":"strong"}]},{"text":"执行(路径按实际本篇目录调整):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 不传 --theme:读本篇 default_format_preset,否则 亲和\n{python} {baseDir}/scripts/format.py drafts/YYYYMMDD-slug/article.md -o drafts/YYYYMMDD-slug/article.html\n\n# 显式指定模版 / 配色(覆盖配置)\n{python} {baseDir}/scripts/format.py drafts/YYYYMMDD-slug/article.md --theme 资讯 --scheme 绛红 -o drafts/YYYYMMDD-slug/article.html\n\n# 自定义主色 / 字号\n{python} {baseDir}/scripts/format.py article.md --color '#C0392B'\n{python} {baseDir}/scripts/format.py article.md --font-size 15px","type":"text"}]},{"type":"paragraph","content":[{"text":"文末 ","type":"text"},{"text":"{embed:…}","type":"text","marks":[{"type":"code_inline"}]},{"text":" 的合并规则见 ","type":"text"},{"text":"branches.md「四」","type":"text","marks":[{"type":"link","attrs":{"href":"references/branches.md","title":null}}]},{"text":"——","type":"text"},{"text":"占位符与配置对不上会直接失败","type":"text","marks":[{"type":"strong"}]},{"text":"。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第3步:核对输出","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"正文","type":"text"},{"text":"不含","type":"text","marks":[{"type":"strong"}]},{"text":"文章标题(","type":"text"},{"text":"article.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" 的首个 ","type":"text"},{"text":"#","type":"text","marks":[{"type":"code_inline"}]},{"text":" 被跳过,标题在后台单独填)。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"配图标记还是 ","type":"text"},{"text":"placeholder","type":"text","marks":[{"type":"code_inline"}]},{"text":" 时保留为 ","type":"text"},{"text":"\u003cimg>","type":"text","marks":[{"type":"code_inline"}]},{"text":",等 ","type":"text"},{"text":"images skill","type":"text","marks":[{"type":"link","attrs":{"href":"../aws-wechat-article-images/SKILL.md","title":null}}]},{"text":" 替换——终审前必须全部换成真实路径。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"其余输出特性(","type":"text"},{"text":"closing.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" 追加、预格式化范围、表格对齐)见 ","type":"text"},{"text":"branches.md「五」","type":"text","marks":[{"type":"link","attrs":{"href":"references/branches.md","title":null}}]},{"text":"。","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"选项","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"选项","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"说明","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"默认值","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--theme \u003c名称>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"模版;省略则按本篇配置 → 内置 ","type":"text"},{"text":"亲和","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"亲和","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--scheme \u003c配色名>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"模版的配色(见 ","type":"text"},{"text":"--list-themes","type":"text","marks":[{"type":"code_inline"}]},{"text":");省略则读本篇 ","type":"text"},{"text":"default_format_scheme","type":"text","marks":[{"type":"code_inline"}]},{"text":",再无则模版默认色","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"模版默认","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--color \u003chex>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"自定义主色","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"主题默认","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--font-size \u003cpx>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"正文字号(同时覆盖主题 p / li 里的字号)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"16px","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"-o \u003c路径>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"输出路径","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"同名 .html","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--list-themes","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"列出模版:长相、适合/不适合、每套配色的色值与口径","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph"}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--preview [模版名]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"渲成并列对照页(给模版名则并列它的每套配色,不给则并列所有模版)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph"}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--export-theme \u003c名称>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"以 YAML 导出主题,可作为自定义主题起点","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph"}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"--no-preformat","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"跳过 Markdown 预格式化","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"分支与细则","type":"text"}]},{"type":"paragraph","content":[{"text":":::","type":"text","marks":[{"type":"code_inline"}]},{"text":" 组件与查找顺序、主题解析完整顺序、自定义主题、","type":"text"},{"text":"{embed:…}","type":"text","marks":[{"type":"code_inline"}]},{"text":" 合并规则、输出细节、设计新版式前的微信 HTML 限制 → ","type":"text"},{"text":"references/branches.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/branches.md","title":null}}]},{"text":"。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"过程文件","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"读取","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"产出","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"article.md","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":".aws-article/config.yaml","type":"text","marks":[{"type":"code_inline"}]},{"text":" + 同目录 ","type":"text"},{"text":"article.yaml","type":"text","marks":[{"type":"code_inline"}]},{"text":"(默认模版与 ","type":"text"},{"text":"embeds","type":"text","marks":[{"type":"code_inline"}]},{"text":")、","type":"text"},{"text":"closing.md","type":"text","marks":[{"type":"code_inline"}]},{"text":"(可选)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":null},"content":[{"type":"paragraph","content":[{"text":"article.html","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]}]},"metadata":{"url":"https://github.com/aiworkskills/wechat-article-skills","date":"2026-06-05","name":"aws-wechat-article-formatting","author":"@skillopedia","source":{"stars":53,"repo_name":"wechat-article-skills","origin_url":"https://github.com/aiworkskills/wechat-article-skills/blob/HEAD/skills/aws-wechat-article-formatting/SKILL.md","repo_owner":"aiworkskills","body_sha256":"01876ea04b729651d524a405f2e013085f3a975f3bbbc1273cdca20a5182c670","cluster_key":"6e79abee4375dbdb3534cdff10f0280e694fa291cfd6d18f7099a7737f722a57","refresh_tag":"upstream-refresh-2026-11","clean_bundle":{"format":"clean-skill-bundle-v1","source":"aiworkskills/wechat-article-skills/skills/aws-wechat-article-formatting/SKILL.md","bundle_sha256":"0e5642627c51ce04dd30905985dbff4d005293ef9ae912421d301e429ad60408","attachment_count":79,"text_attachments":79,"attachment_storage":"skill_attachments","binary_attachments":0},"cluster_size":1,"refreshed_at":"2026-11-02T23:11:18.402Z","skill_md_path":"skills/aws-wechat-article-formatting/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"devops-infrastructure","category_label":"DevOps"},"upstream_commit":"ca036f75f4bac4fcefe6eaedd8d22d97bf8c92ca","exact_dupes_collapsed_into_this":0},"version":"v1","category":"devops-infrastructure","homepage":"https://aiworkskills.cn","metadata":{"openclaw":{"requires":{"env":[],"bins":["python3"]}}},"import_tag":"clean-skills-v1","description":"公众号排版|Markdown 转 HTML|排版主题|段落样式 — 公众号一键排版工具,Markdown 文稿转微信后台可粘贴 HTML,多主题、多字号、段落样式切换,所见即所得。面向公众号编辑、独立作者、排版岗。触发词:「排版」「版式」「美化」「格式化」「字号」「段落样式」「换个排版主题」「换个版式」「转 HTML」「弄好看点」「调整格式」。换预设包/品牌包/整套主题配色请走 aws-wechat-article-assets;需要多环节串联(写+审+排+配图+发)请走 aws-wechat-article-main。"}},"renderedAt":1794104902117}

排版 公众号一键排版 —— Markdown 转微信后台可粘贴 HTML,多主题、多字号、所见即所得。 套件说明 · 本 skill 属 一条龙套件(共 9 个 slug,入口 )。跨 skill 的相对引用依赖同一 目录,建议一并 全套。源码:<https://github.com/aiworkskills/wechat-article-skills 能力披露(Capabilities) 本 skill 为 纯本地 Markdown → HTML 转换,零网络、零凭证。 - 凭证 :无 - 网络 :无 - 文件读(仓库内) : 、本篇 、 、可选 、 - 文件读(仓库外) : (跨项目共享的自定义主题; 只读预设文件,不读凭证 ) - 文件写 :本篇 - shell :仅 单独安装可直接使用 : 零依赖、纯本地,无跨 skill 脚本调用。文档里指向 的链接在套件未装齐时会断,但排版功能本身可用。 路由 一键发文且未明确只要排版 → aws-wechat-article-main。 配置检查 ⛔ 任何操作前先按 首次引导 · 检测顺序 执行,通过后才继续(或用户明确书面确认「本次不检查」)。单独启用本 skill 时同样。 内置模版 排版 = 模版 (骨架:标题装饰、导语、金句卡、图片处理、分隔、文末)× 配色 (一组主色/次色,派生色自动重算)。名字即用途,选之前先看「适合」…