Install
openclaw skills install wechat-publish-proClawHub Security found sensitive or high-impact capabilities. Review the scan results before using.
Pure Python tool to convert Markdown to styled HTML and publish articles to WeChat official account drafts with AI-based content refinement and theme support.
openclaw skills install wechat-publish-pro微信公众号文章发布工具,完全独立实现,不依赖任何外部 CLI 工具。
当用户需要以下操作时自动触发:
# 从 GitHub 安装
pip install git+https://github.com/yuesf/wechat-publish-pro.git
export WECHAT_APP_ID=your_wechat_app_id
export WECHAT_APP_SECRET=your_wechat_app_secret
# 初始化配置
wechat-publish-pro config init
# 设置配置
wechat-publish-pro config set wechat.app_id <AppID>
wechat-publish-pro config set wechat.app_secret <AppSecret>
把运行机器的 IP 添加到微信公众号后台白名单:
在 OpenClaw 对话中直接说:
# 基本转换(默认绿色主题)
wechat-publish-pro convert article.md
# 指定蓝色主题
wechat-publish-pro convert article.md --theme blue
# 指定输出文件
wechat-publish-pro convert article.md -o output.html
# 发布 HTML 文件到草稿箱(需要指定账号,否则会卡在交互提示)
wechat-publish-pro publish article.html --account <账号标识>
# 指定标题和封面
wechat-publish-pro publish article.html --title "文章标题" --cover cover.jpg --account <账号标识>
常见问题:
--account 参数指定账号,避免交互式选择--cover 参数# 转换后直接发布
wechat-publish-pro convert article.md --theme blue -o /tmp/article.html
wechat-publish-pro publish /tmp/article.html --title "文章标题"
wechat-publish-pro test
wechat-publish-pro upload-image image.jpg
文件顶部可以包含 frontmatter(建议只用 cover,不用 title,避免重复):
<!--
title: 文章标题
---
cover: ./assets/cover.jpg
---
你的内容...
重要注意事项:
# 大标题——标题由命令行 -t 参数提供,正文里的 # 标题会导致标题重复输出--- 作为章节分隔线——wenyan-cli 会将其误解析为列表项 • --,用空行替代 ---title 会被输出到正文——如果同时在正文写了 # 标题,会导致两个标题重复;建议 frontmatter 的 title 用 <!-- --> 包裹,或完全不用 frontmatter 的 title,改由命令行 -t 提供标题推荐格式:
<!--
title: 文章标题(可选,用命令行 -t 更稳定)
cover: ./assets/cover.jpg
---
第一段内容(直接开始,不要用 `#` 标题)
## 章节标题(使用 ## ,不是 #)
内容...
(章节之间用空行分隔,不要用 ---)
| 主题 | 风格 |
|---|---|
| green | 清新自然(绿色,默认) |
| blue | 清新专业(蓝色) |
| purple | 优雅神秘(紫色) |
| orange | 温暖活力(橙色) |
| default | 简洁清爽 |
| simple | 极简风格 |
wechat-publish-pro/
├── src/wechat_publish_pro/
│ ├── cli.py # CLI 入口
│ ├── config.py # 配置管理
│ ├── converter/ # Markdown 转换模块
│ │ ├── wechat_style.py # 微信公众号样式转换器
│ │ ├── themes.py # 主题配置
│ │ └── theme_types.py # 主题数据类型
│ └── platforms/ # 平台适配器
│ └── wechat.py # 微信公众号 API
└── pyproject.toml
本项目参考了以下优秀项目的设计思路:
但本项目是完全独立实现的,不依赖任何外部代码。
yuesf
MIT