Install
openclaw skills install wechat-html-publisher直接上传HTML富文本到微信公众号草稿箱。支持完整的HTML格式,无需Markdown转换。
openclaw skills install wechat-html-publisher直接上传HTML富文本到微信公众号草稿箱
与 wechat-publisher 不同,本skill直接上传HTML格式,无需Markdown转换。适合已经有完整HTML排版的文章。
确保环境变量已设置:
export WECHAT_APP_ID= YOU_WECHAT_APP_ID
export WECHAT_APP_SECRET= YOU_WECHAT_APP_SECRET
重要: 确保你的IP已添加到微信公众号后台的白名单!
HTML文件需要包含完整的样式(内联样式):
<section>
<h1 style="color: #333; font-size: 24px;">文章标题</h1>
<p style="line-height: 1.8;">文章内容...</p>
<img src="./images/photo.jpg" style="width: 100%;">
</section>
注意:
<style>标签或外部CSS使用脚本:
python scripts/publish_html.py \
--file article.html \
--title "文章标题" \
--cover ./cover.jpg
参数说明:
--file: HTML文件路径(必填)--title: 文章标题(必填)--cover: 封面图路径(必填)--author: 作者名称(可选)--digest: 文章摘要(可选)--source-url: 原文链接(可选)python scripts/publish_html.py \
--file my-article.html \
--title "2026年税务新政解读" \
--cover ./cover.jpg
python scripts/publish_html.py \
--file my-article.html \
--title "2026年税务新政解读" \
--cover ./cover.jpg \
--author "慧评税" \
--digest "详细解读2026年最新税务政策" \
--source-url "https://example.com/article"
python scripts/publish_html.py \
--file my-article.html \
--title "文章标题" \
--cover "https://example.com/cover.jpg"
<!-- ✅ 正确 -->
<p style="color: #333; font-size: 16px;">内容</p>
<!-- ❌ 错误 -->
<style>
p { color: #333; }
</style>
<p>内容</p>
<img src="./images/photo.jpg"><img src="/Users/user/photo.jpg"><img src="https://example.com/photo.jpg">所有图片会自动上传到微信图床并替换URL!
<section>
<section style="text-align: center;">
<h1 style="font-size: 24px; color: #333;">标题</h1>
</section>
<section style="margin: 20px 0;">
<p style="line-height: 1.8; color: #666;">正文内容...</p>
</section>
<section>
<img src="./image.jpg" style="width: 100%; display: block;">
</section>
</section>
| 特性 | wechat-publisher | wechat-html-publisher |
|---|---|---|
| 输入格式 | Markdown | HTML |
| 样式转换 | 自动应用主题 | 使用原有样式 |
| 适用场景 | 写作发布 | 已有HTML排版 |
| 依赖 | wenyan-cli | 仅Python |
错误: ip not in whitelist
解决:
curl ifconfig.me错误: invalid image
解决:
错误: invalid content
解决:
<style>标签MIT License