wechat-mp-publish
Skill0 starsChanged yesterdayApache-2.0View on GitHub
把 Markdown 文章变成能直接发到微信公众号的成品。转换时全部内联样式(微信会剥离 style 和 class),并把正文图片逐张上传到微信图床换成 mmbiz.qpic.cn 地址——这是图片发出去不消失的关键。支持两条出口:生成可粘贴 HTML 走人工粘贴,或直接调用官方接口把文章推进草稿箱。当用户说"发公众号""排版公众号文章""把这篇 md 发到公众号""图片上传后不显示""公众号草稿箱"时使用。不适用于其他平台(小红书、知乎)的排版,也不代用户点发布。
- Reads credentials
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- ykjshenzhen2008-ship-it/commercial-real-estate-skillstheir own version, first seen Oct 20, 2026
- ffffhx/skillstheir own version, first seen Oct 20, 2026
- xingtu1996/xingtu-skillstheir own version, first seen Sep 7, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- ffffhx/skills★ 1same name
- xingtu1996/xingtu-skills★ 0same name
- ykjshenzhen2008-ship-it/commercial-real-estate-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- skills/components/components-build/AGENTS.mdAGENTS.md
- ui-design-skillsSkill
- assistant-uiSkill
- baoyu-designSkill
- bootstrapSkill
- canvas-designSkill
- components-buildSkill
- cult-uiSkill
- ecommerce-image-workflowSkill
- hatch-petSkill
- icon-systemSkill
- image-enhancerSkill
- lieflat-chartsSkill
- luobo-designSkill
- mockup-device-3dSkill
- ricoui-blocksSkill
- shader-devSkill
- spotkitSkill
- threejsSkill
- admin-form-schemaSkill
- admin-ia-patternsSkill
- dashboardSkill
- enterprise-adminSkill
- iga-pagesSkill
- live-dashboardSkill
- a11y-rulesSkill
- ai-chat-patternsSkill
- art-directionSkill
- brand-extractSkill
- brand-guidelinesSkill
- brandkitSkill
- design-md-librarySkill
- design-vocabularySkill
- emil-design-engSkill
- flexoki-paletteSkill
- frontend-specSkill
- hallmarkSkill
- motion-craftSkill
- motion-promptsSkill
- oil-uiSkill
- reference-design-contractSkill
- review-animationsSkill
- ui-ux-pro-maxSkill
- unslopSkill
- web-design-guidelinesSkill
- mobile-appSkill
- mobile-design-specSkill
- mobile-onboardingSkill
- agent-browserSkill
- chrome-devtoolsSkill
- html-to-pdfSkill
- json-canvasSkill
- markdown-renderer-fixSkill
- card-xiaohongshuSkill
- docs-pageSkill
- faq-pageSkill
- frontend-designSkill
- html-skill-effectivenessSkill
- image-to-codeSkill
- magazine-posterSkill
- The first 60 shown.
The file
Files
wechat-mp-publish — Markdown 进,草稿箱出
一句话总纲:AI 负责写和排,人负责两件事——审稿,以及点发布。
要解决的真问题
公众号发布卡人的地方不是排版,是图片。
Markdown 里写 ,粘进公众号编辑器,图全丢,只剩一个裂开的图标或链接。原因有三层,缺一层都不行:
| 层 | 发生了什么 | 解法 |
| 本地路径 | images/cover.png 在微信编辑器里无法解析 | 图片必须先有公网地址 |
| 外链地址 | 微信会过滤非自家域名的图片,还有 Referer 防盗链 | 域名必须是 mmbiz.qpic.cn |
| 自定义图床 | 挂到 Gitee、OSS 上也不认 | 只能先传到微信自己的图床 |
所以 .html 文件传不上去、图片粘过去消失,都不是操作问题,是链路问题。这个 Skill 把链路补全:每张图先走 media/uploadimg 换成微信地址,再写进正文。
四步流程,两个人工闸门
AI 写稿(md) ──► [人审稿] ──► AI 排版+传图 ──► [人发布]
闸门1 闸门2闸门一:审稿。 内容没定就别排版。排完再改稿,图片要重传一遍。
闸门二:发布。 工具只把文章送进草稿箱,永远不替你点发布。这条是硬规则,不是能力限制。
命令
只依赖 Python 3.8+ 标准库,不用 pip install。
# 1) 看排版效果,不联网、不需要凭据
python scripts/wmp.py convert article.md -o 公众号版.html --theme qing
python scripts/wmp.py check 公众号版.html
# 2) 只搬图片:把 md / html / 目录里的图全换到微信图床
python scripts/wmp.py upload article.md --rewrite
# 3) 先干跑一遍,确认图片和字段都没问题
python scripts/wmp.py push article.md --cover cover.png --author Yardon --dry-run
# 4) 真推草稿箱(需要 .env 里的 AppID / AppSecret)
python scripts/wmp.py push article.md --cover cover.png --author Yardon --digest "摘要"
# 5) 凭据和连通性自检
python scripts/wmp.py doctorconvert 产出的是可粘贴 HTML,图片保留原地址;push 才会上传图片换成微信地址。
怎么保证图片一定在图床
三处卡口,任何一处不过就不算完成:
| 卡口 | 做什么 | 什么时候 |
| 上传 | 逐张调 media/uploadimg,把本地路径或外链换成 mmbiz.qpic.cn 地址 | push 内置,或单独跑 upload |
| 校验 | 扫 HTML 里每个 <img src>,不是 mmbiz 域名就报警告 | convert / check 每次都会跑 |
| 落盘 | --rewrite 生成替代版文件,原文件不动,人工核对后再用 | upload 加参数时 |
只想要图在床、不想发文章,就用 upload:它可以在 md、html、图片目录上跑,输出一份「原地址 → mmbiz 地址」的清单,加 --rewrite 还会把地址替换好写进副本。
upload 的输出长这样:
目标:article.md(Markdown,3 张)
images/cover.png 93 KB
images/filter-diagram.png 161 KB
✓ images/cover.png
→ http://mmbiz.qpic.cn/mmbiz_png/xxxx/0
已生成替换版:article.wechat.md
原文件没动,核对无误后再拿它去发布。
RESULT: PASS两条出口怎么选
| 情况 | 走哪条 |
| 想省掉手工粘贴,愿意配 AppID/AppSecret | push → 后台草稿箱看一眼 → 点发布 |
| 不想把 AppSecret 交给脚本 | convert → 浏览器打开 → 全选复制 → 粘到编辑器 |
| 只要图片进图床,文章自己贴 | upload --rewrite → 用替换版去粘贴 |
| 只想要稳定样式,不在乎自动化 | convert + 固定主题,粘贴 |
convert 出来的 HTML 粘贴时图片会跟着走(浏览器会把图像数据放进剪贴板),但样式可能被微信改写一两处;push 没有这个问题,因为 HTML 是直接从服务端写进草稿的。
主题
assets/themes.json 里三个:qing(青竹,深青)、ink(墨黑)、blue(经典蓝)。
改这个 JSON 就能加新主题,不用动代码。换主题只影响配色和字号,不影响结构。
微信的字段上限
写稿阶段就要守住,别等接口拒绝:
| 字段 | 上限 | 超了会怎样 |
| 标题 | 32 字 | 接口报错 |
| 作者 | 16 字 | 接口报错 |
| 摘要 | 128 字 | 45004 |
| 正文 | 20000 字 | 40008 |
| 正文单图 | 1MB,仅 jpg/png | 上传失败 |
| 封面 | 10MB,建议 2.35:1(900×383) | 上传失败 |
脚本会在推送前替你卡这几项。
排错
| 现象 | 原因 | 处置 |
40164 | 调用 IP 不在白名单 | 后台「设置与开发 → 基本配置 → IP白名单」加当前公网 IP。运营商 NAT 的 IP 会变,建议跑在固定 IP 的机器上 |
40007 | 封面用了临时素材 | 封面只能走 material/add_material,不能用 media/upload |
48001 | 接口未授权 | 草稿箱、素材、正文图这三个接口,实测报告显示个人未认证号也能调;真报这个错再回退到 convert 粘贴,别急着下结论 |
40008 | 正文过长 | 拆篇,或压缩代码块 |
45004 | 摘要超 128 字 | 删短 |
| 草稿里图片裂开 | 正文图不是 mmbiz.qpic.cn | 走 push,别手工拼外链 |
| Mermaid 变成一堆代码 | 微信不渲染 Mermaid | 先导出 png,再用  引用。convert 会直接报错拦住 |
| 代码块挤成一行 | <pre> 的换行样式被剥离 | 脚本已用 <section> + <br> 分行,不要改回 <pre> |
关于发布接口
freepublish/submit 是真正把文章发出去的接口。2025 年 7 月起,个人主体和未认证企业号的发布权限已被回收,只有认证的服务号/订阅号能调用。
所以本 Skill 的定位是明确的:机器负责生产与入库,人负责放行。这不是妥协,草稿箱本身就是个安全缓冲区——进去了还能改、能预览、能挑时间。
不做的事
- 不代替用户点发布,也不做定时群发
- 不做小红书、知乎等平台的排版(各家过滤规则不同,混做会两头不讨好)
- 不替你写稿。写稿交给写作类 Skill,这里只管把稿子送到位
- 不在没有审稿的情况下推送。
push之前人必须看过convert的产物
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

