wechat-publisher一键发布 Markdown 到微信公众号草稿箱。基于 wenyan-cli,支持多主题、代码高亮、图片自动上传。
Install via ClawdBot CLI:
clawdbot install 0731coderlee-sudo/wechat-publisher一键发布 Markdown 文章到微信公众号草稿箱
基于 wenyan-cli 封装的 OpenClaw skill。
wenyan-cli 需要全局安装:
npm install -g @wenyan-md/cli
验证安装:
wenyan --help
注意: publish.sh 脚本会自动检测并安装 wenyan-cli(如果未安装)
API 凭证已保存在 /Users/leebot/.openclaw/workspace/TOOLS.md
确保环境变量已设置:
export WECHAT_APP_ID=your_wechat_app_id
export WECHAT_APP_SECRET=your_wechat_app_secret
重要: 确保你的 IP 已添加到微信公众号后台的白名单!
配置方法:https://yuzhi.tech/docs/wenyan/upload
文件顶部必须包含完整的 frontmatter(wenyan 强制要求):
---
title: 文章标题(必填!)
cover: https://example.com/cover.jpg # 封面图(必填!)
---
# 正文开始
你的内容...
⚠️ 关键发现(实测):
title 和 cover 都是必填字段!推荐封面图来源:
# 方案1: 相对路径(推荐,便于分享)
cover: ./assets/default-cover.jpg
# 方案2: 绝对路径
cover: /Users/bruce/photos/cover.jpg
# 方案3: 网络图片
cover: https://your-cdn.com/image.jpg
💡 提示: 使用相对路径时,从 Markdown 文件所在目录开始计算。
方式 1: 使用 publish.sh 脚本
cd /Users/leebot/.openclaw/workspace/wechat-publisher
./scripts/publish.sh /path/to/article.md
方式 2: 直接使用 wenyan-cli
wenyan publish -f article.md -t lapis -h solarized-light
方式 3: 在 OpenClaw 中使用
"帮我发布这篇文章到微信公众号" + 附带 Markdown 文件路径
wenyan-cli 支持多种主题:
内置主题:
default - 默认主题lapis - 青金石(推荐)phycat - 物理猫代码高亮主题:
atom-one-dark / atom-one-lightdraculagithub-dark / githubmonokaisolarized-dark / solarized-light (推荐)xcode使用示例:
# 使用 lapis 主题 + solarized-light 代码高亮
wenyan publish -f article.md -t lapis -h solarized-light
# 使用 phycat 主题 + GitHub 代码高亮
wenyan publish -f article.md -t phycat -h github
# 关闭 Mac 风格代码块
wenyan publish -f article.md -t lapis --no-mac-style
# 关闭链接转脚注
wenyan publish -f article.md -t lapis --no-footnote
wenyan publish -f article.md -c /path/to/custom-theme.css
# 从本地文件安装
wenyan theme --add --name my-theme --path /path/to/theme.css
# 从网络安装
wenyan theme --add --name my-theme --path https://example.com/theme.css
# 使用已安装的主题
wenyan publish -f article.md -t my-theme
# 删除主题
wenyan theme --rm my-theme
wenyan theme -l
⚠️ 关键(实测结果):wenyan-cli 强制要求完整的 frontmatter!
---
title: 文章标题(必填!)
cover: 封面图片URL或路径(必填!)
---
示例 1:相对路径(推荐)
---
title: 我的技术文章
cover: ./assets/cover.jpg
---
# 正文...
示例 2:绝对路径
---
title: 我的技术文章
cover: /Users/bruce/photos/cover.jpg
---
# 正文...
示例 3:网络图片
---
title: 我的技术文章
cover: https://example.com/cover.jpg
---
# 正文...
❌ 错误示例(会报错):
# 只有 title,没有 cover
---
title: 我的文章
---
错误信息:未能找到文章封面
# 完全没有 frontmatter
# 我的文章
错误信息:未能找到文章封面
💡 重要发现:
所有图片会自动上传到微信图床!
`
python
def hello():
print("Hello, WeChat!")
`
会自动添加代码高亮和 Mac 风格装饰。
错误信息: ip not in whitelist
解决方法:
curl ifconfig.me错误信息: wenyan: command not found
解决方法:
npm install -g @wenyan-md/cli
错误信息: WECHAT_APP_ID is required
解决方法:
export WECHAT_APP_ID=your_wechat_app_id
export WECHAT_APP_SECRET=your_wechat_app_secret
或在 ~/.zshrc / ~/.bashrc 中永久添加。
错误信息: title is required in frontmatter
解决方法: 在 Markdown 文件顶部添加:
---
title: 你的文章标题
---
Apache License 2.0 (继承自 wenyan-cli)
Generated Mar 1, 2026
Ideal for bloggers who write technical articles and need to publish to WeChat Official Accounts. Automates Markdown conversion, image uploads, and code highlighting, saving time on formatting and manual uploads.
Useful for marketing professionals preparing promotional content for WeChat. Ensures consistent branding with themes and handles image uploads to WeChat's image hosting, streamlining the draft creation process.
Helps educators and institutions publish tutorials, course materials, or announcements on WeChat. Supports code blocks and multiple themes, making educational content visually appealing and easy to distribute.
Assists journalists in quickly converting investigative reports or news articles from Markdown to WeChat drafts. Automates image handling and maintains formatting integrity for timely publication.
Enables freelancers to manage multiple client articles efficiently by using standardized Markdown workflows. Reduces manual effort in image uploads and theme customization for professional output.
Offer the core skill for free while charging for advanced themes or custom CSS integrations. Generate revenue through theme marketplace subscriptions or one-time purchases for enhanced visual options.
Integrate this skill into a larger SaaS platform targeting marketing or editorial teams. Provide additional features like collaboration tools, analytics, and batch publishing, with tiered pricing based on usage.
Use the skill as part of a service offering for businesses needing WeChat content management. Charge for setup, customization, and ongoing support, bundling it with other digital marketing services.
💬 Integration Tip
Ensure environment variables for WeChat API credentials are set and IP whitelisting is configured in the WeChat backend to avoid upload failures.
iMessage/SMS CLI for listing chats, history, watch, and sending.
Use when you need to control Discord from Clawdbot via the discord tool: send messages, react, post or upload stickers, upload emojis, run polls, manage threads/pins/search, fetch permissions or member/role/channel info, or handle moderation actions in Discord DMs or channels.
Use when you need to control Slack from Clawdbot via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.
Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).
Build or update the BlueBubbles external channel plugin for Clawdbot (extension package, REST send/probe, webhook inbound).
OpenClaw skill for designing Telegram Bot API workflows and command-driven conversations using direct HTTPS requests (no SDKs).