跳到正文

宝玉:微信公众号内容准备与发布

将 Markdown、HTML 或图文资料整理为微信公众号内容,按原文使用 API 或浏览器完成明确授权的发布操作。

开源精选内容生产33 个文件26,681 Stars浏览次数 0JimLiu/baoyu-skills MIT版本 1567581
开始使用

下载前阅读 SKILL.md 中的使用条件,并确认所用工具支持对应能力。

输入资料
确认后的文章与图片 账号权限及发布授权 阅读本节完整说明
交付内容
公众号内容与排版 实际执行的发布记录 阅读本节完整说明
  1. 获取完整包,保留配套文件的目录结构。
  2. 按照原文准备所需工具、依赖与输入资料。
  3. 阅读对应使用步骤与输入输出说明,在自己的环境中验证结果。

使用提示摘自原文,配套文件保留来源版本;实际运行条件以各包说明为准。

正文

获取原文件

references/image-text-posting.md

Post image-text messages with multiple images to WeChat Official Account.

Note: WeChat has renamed "图文" to "贴图" in the Official Account menu (as of 2026).

Usage

# Post with images and markdown file (title/content extracted automatically)
${BUN_X} ./scripts/wechat-browser.ts --markdown source.md --images ./images/

# Post with explicit title and content
${BUN_X} ./scripts/wechat-browser.ts --title "标题" --content "内容" --image img1.png --image img2.png

# Save as draft
${BUN_X} ./scripts/wechat-browser.ts --markdown source.md --images ./images/ --submit

Parameters

Parameter Description
--markdown <path> Markdown file for title/content extraction
--images <dir> Directory containing images (sorted by name)
--title <text> Article title (max 20 chars, auto-compressed if too long)
--content <text> Article content (max 1000 chars, auto-compressed if too long)
--image <path> Single image file (can be repeated)
--submit Save as draft (default: preview only)
--profile <dir> Chrome profile directory

Auto Title/Content from Markdown

When using --markdown, the script:

  1. Parses frontmatter for title and author:

    ---
    title: 文章标题
    author: 作者名
    ---
    
  2. Falls back to H1 if no frontmatter title:

    # 这将成为标题
    
  3. Compresses title to 20 characters if too long:

    • Original: "如何在一天内彻底重塑你的人生"
    • Compressed: "一天彻底重塑你的人生"
  4. Extracts first paragraphs as content (max 1000 chars)

Image Directory Mode

When using --images <dir>:

  • All PNG/JPG files in directory are uploaded
  • Files are sorted alphabetically by name
  • Naming convention: 01-cover.png, 02-content.png, etc.

Constraints

Field Max Length Notes
Title 20 chars Auto-compressed if longer
Content 1000 chars Auto-compressed if longer
Images 9 max WeChat limit

Example Session

User: /post-to-wechat --markdown ./article.md --images ./xhs-images/

Claude:
1. Parses markdown meta:
   - Title: "如何在一天内彻底重塑你的人生" → "一天内重塑你的人生"
   - Author: from frontmatter or default
2. Extracts content from first paragraphs
3. Finds 7 images in xhs-images/
4. Opens Chrome, navigates to WeChat "图文" editor
5. Uploads all images
6. Fills title and content
7. Reports: "Image-text posted with 7 images."

Scripts

Script Purpose
wechat-browser.ts Main image-text posting script
cdp.ts Chrome DevTools Protocol utilities
copy-to-clipboard.ts Clipboard operations

CONTACT HAONAN

联系haonan

医疗 AI · 产品与独立开发

刘浩南

关注医疗 AI 从 demo 到真实落地,聚焦产品化、商业化与院内工作流效率提升。

12年医疗产研经验,大湾区头部医疗AI公司前产品总监,独立开发者

医疗 AI 产品化医疗 AI 商业化院内工作流效率
刘浩南的微信联系二维码
微信扫一扫,联系 haonan