360 Secure SkillHub
360 安全技能中心

wechat-pack

将本地 .docx、Markdown 或 HTML 转换为适合微信公众号编辑器的内联样式 HTML,并生成包含源文件、提取或下载的图片、可选封面和 meta.json 的发布文件夹;.docx 转换依赖 pandoc,封面变体生成依赖 Pillow。

rockbotclub
rockbotclub
热度 60.60
最近更新 2026-05-17 12:59:38
分类:营销依赖:代码执行 / 读写文件应用场景:社交媒体 / 文件转换 / 工作流 / 模板

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add wechat-pack
Metadata
name
wechat-pack
description
Convert local .docx or Markdown files into WeChat-ready HTML and generate a publish folder (source/assets/cover/wechat). Use when packaging documents for WeChat public account publishing with local assets and copy-paste HTML output. 当用户要求打包微信文章、转换文章为微信格式、微信公众号排版、生成微信推文 HTML、或将 Markdown/Word 转成微信可粘贴的格式时触发。

WeChat Pack

Quick start

Run from the skill root:

./wechat_pack path/to/article.docx
./wechat_pack path/to/article.md

Outputs a publish folder with:

  • source/ original input file
  • assets/ downloaded or extracted images
  • cover/ optional cover image
  • wechat/ article.html ready to paste into WeChat editor
  • meta.json metadata (title, paths, asset count, cover variants)

Supported inputs

  • .docx (requires pandoc installed)
  • .md / .markdown
  • .html / .htm (treated as already-converted HTML)

Recommended workflow

  1. Export the document from your editor to .docx or .md.
  2. Run ./wechat_pack <file>.
  3. Open wechat/article.html and paste into the WeChat editor.

Options

  • --out <dir>: output directory (default: <basename>-wechat)
  • --title <title>: insert a top-level title if missing
  • --cover <path-or-url>: download or copy a cover image into cover/

Notes

  • For .docx conversion, pandoc must be available in PATH.
  • The script downloads external images and rewrites <img> to local assets/ paths.
  • Output HTML is styled with inline CSS to be friendly to the WeChat editor.
  • If Pillow is available, cover variants are generated in cover/: cover-wide-2.35x1.jpg and cover-square-1x1.jpg.