微信公众号发布器:自动化 Markdown 转微信公众号 - Openclaw Skills

作者:互联网

2026-03-29

AI教程

什么是 微信公众号发布器?

微信公众号发布器是专门为需要在本地 Markdown 工作流与微信公众号平台之间搭建桥梁的内容创作者和开发者设计的工具。通过集成 Openclaw Skills 系列中的这项技能,用户可以自动化处理上传内容、管理图片以及为微信生态系统格式化文章等繁琐过程。

该技能不仅限于简单的文本转换,还提供了一系列智能功能,如通过 Unsplash 自动选择封面图、内联图片 CDN 同步,以及针对引用和分段符的独特类 CSS 样式。它旨在处理复杂的发布需求,包括专业公众号管理所必需的多图文合并草稿。

下载入口:https://github.com/openclaw/skills/tree/main/skills/x402spark-jpg/wechat-multi-publisher

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install wechat-multi-publisher

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 wechat-multi-publisher。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

微信公众号发布器 应用场景

  • 将本地 Markdown 文件的技术文档批量发布到微信公众号。
  • 自动创建由一篇主文章和多篇次文章组成的每日新闻摘要。
  • 将微信内容投放集成到 CI/CD 流水中,实现自动化营销工作流。
  • 使用一致的金句高亮和渐变分割线,在团队内统一文章审美。
微信公众号发布器 工作原理
  1. 用户准备 Markdown 内容,可选择使用特定语法(如 &&)作为章节标题。
  2. 该技能使用通过环境变量或配置文件提供的安全凭证,通过微信公众号 API 进行身份验证。
  3. 解析内容以识别内联图片,这些图片会自动上传到微信 CDN 并替换为远程 URL。
  4. 根据关键词匹配,通过 Unsplash 或 12 张图片的轮换池为每篇文章选择智能封面图。
  5. 工具将主文章和任何可选的次文章组装成单个草稿结构。
  6. 完成后的草稿被推送到微信公众号草稿箱,并带有可选的立即发布标志。

微信公众号发布器 配置指南

# 安装核心依赖
npm install @wenyan-md/core

# 配置您的微信公众号凭证
export WECHAT_APP_ID=your_appid
export WECHAT_APP_SECRET=your_appsecret

# (可选) 设置平台作者名称
export WECHAT_AUTHOR="作者名称"

# 发布您的第一篇文章
node scripts/publish.mjs my-article.md

微信公众号发布器 数据架构与分类体系

元素 来源 / 类型 描述
内容 Markdown (.md) 支持特定分割线 (&&) 和金句触发。
凭证 环境变量 / JSON WECHAT_APP_ID, WECHAT_APP_SECRET。
封面图 Unsplash / 本地 自动匹配或 12 张图片轮换池。
内联图片 本地资产 PNG/JPG 文件自动同步到微信 CDN。
草稿结构 多图文 支持 1 篇主文章 + 最多 7 篇次文章。
name: wechat-mp-publisher
description: "Publish one or multiple Markdown articles to WeChat Official Account (公众号) draft box in a single API call. Supports multi-article combined drafts (main article + sub-articles), smart cover image selection with Unsplash auto-match + 12-image fallback rotation, custom styling (gold quote highlights, && section dividers, accent headings), inline image auto-upload to WeChat CDN, digest auto-extraction, and optional immediate publish. Activate when user wants to push Markdown files to WeChat MP, publish to 公众号草稿箱, schedule WeChat articles, or automate public account content delivery."

wechat-mp-publisher

Publish Markdown articles to WeChat Official Account draft box.

Key features

  • Multi-article push — main article + up to 7 sub-articles in one draft (unique vs single-article tools)
  • Smart cover images — keyword-matched Unsplash + 12-image fallback pool, each article gets a different cover
  • Custom styling — gold quote highlights, && section dividers, accent-colored headings
  • Inline images — local PNG/JPG auto-uploaded to WeChat CDN
  • Flexible credentials — env vars or ~/.config/wechat-mp/credentials.json

Quick start

# Install dependency
npm install @wenyan-md/core

# Set credentials
export WECHAT_APP_ID=your_appid
export WECHAT_APP_SECRET=your_appsecret

# Push to draft box
node scripts/publish.mjs main-article.md [sub-article.md ...]

See references/setup.md for full credential setup, IP whitelist, and cron automation.

Markdown conventions

Section divider (renders as gradient rule):

paragraph text

&&

next paragraph

Section header (renders as accented H2):

&& My Section Title

Gold quotes — automatically highlighted when text starts with:

  • 真正的... / 不是...而是... / 底层逻辑是... / 关键不是...

CLI reference

node scripts/publish.mjs  [sub1.md] [sub2.md] ...
  --dry-run        Render to /tmp/wechat-preview/ without uploading
  --publish        Also trigger freepublish after draft creation
  --media-id=xxx   Publish an existing draft by media_id

Author field

Set WECHAT_AUTHOR env var to customize the author name shown in WeChat.