← ClaudeAtlas

hkr-renderlisted

WeChat Official Account (微信公众号) publishing pipeline: format Markdown or plain text into WeChat-compatible inline-style HTML with 7 polished themes (dark mode and mobile font sizes tuned), optionally generate a cover image with brightness check and auto-darkening, and push one or many articles to the WeChat draft box (多图文). Use when the user wants to format, typeset or publish a WeChat article, or says 排版, 微信排版, 公众号排版, 公众号发布, 格式化文章, format, /format. Requires a config.json with WeChat AppID/Secret (see SKILL.md).
hanzhangzzz/agent-skills-zh · ★ 1 · AI & Automation · score 73
Install: claude install-skill hanzhangzzz/agent-skills-zh
# xiaohu-wechat-format 公众号一键排版技能。把任意文本内容(Markdown、纯文本、格式粗糙的笔记)转成微信公众号兼容的排版 HTML,AI 自动理解内容结构并增强排版,可视化选择主题后一键复制粘贴到微信后台。可选生成封面图、推送草稿箱。 ## Skill Description For Claude 公众号完整管线:排版 → 封面(可选)→ 推送(可选)。把 Markdown 文章转为微信公众号兼容的内联样式 HTML,支持纯文本输入,AI 自动补充结构和排版增强。当用户说"排版""微信排版""格式化文章""format"时使用。 ## 脚本目录 `{baseDir}` = 本 SKILL.md 所在目录。执行脚本时用 `{baseDir}/scripts/xxx.py` 替换为实际绝对路径。 | 脚本 | 用途 | |------|------| | `scripts/format.py` | 排版:Markdown → 微信兼容 HTML | | `scripts/publish.py` | 推送:HTML → 公众号草稿箱 | | `scripts/comment_reply.py` | 评论自动回复(可选) | ## 配置 首次使用需创建 `config.json`(参考 `config.example.json`): ```json { "output_dir": "/tmp/wechat-format", "vault_root": "/path/to/your/obsidian/vault", "settings": { "default_theme": "newspaper", "auto_open_browser": true }, "wechat": { "app_id": "YOUR_APP_ID", "app_secret": "YOUR_APP_SECRET", "author": "作者名" }, "cover": { "output_dir": "~/Documents/covers", "image_generation_script": "" } } ``` - `wechat` 部分仅推送时需要,纯排版可不填 - `cover` 部分仅生成封面时需要 - `config.json` 已在 `.gitignore` 中,不会被提交 ## Instructions ### 触发条件 用户说以下任何一种: - `/format 文件路径` - `排版这篇文章` - `微信排版` - `格式化为公众号格式` - `把这篇转成微信格式` ### 完整工作流 #### 第 1 步:确认文章 1. 如果用户给了文件路径,直接读取 2. 如果没给路径,问用户要文章路径 3. 读取文章内容,确认标题和字数 #### 第 1.5 步:结构化预处理(仅在需要时) 读取文章后,先检测输入内容的 Markdown 结构完整度,决定是否需要 AI 结构化预处理。 **检测方法**:扫描全文,统计 `##` 标题、`**加粗**`、`- 列表`、`> 引用`、`` ` 代码 ` `` 等格式标记的数量。 **判断规则**: - 有 `##` 标题且格式标记分布合理 → **跳过**,直接进入第 2 步 - 缺少 `##` 标题,或几乎没有格式标记(纯文本/粗糙笔记)→ **执行结构化**