WeChat Pack
Quick start
Run from the skill root:
CODEBLOCK0
Outputs a publish folder with:
- -
source/ original input file - INLINECODE1 downloaded or extracted images
- INLINECODE2 optional cover image
- INLINECODE3
article.html ready to paste into WeChat editor - INLINECODE5 metadata (title, paths, asset count, cover variants)
Supported inputs
- -
.docx (requires pandoc installed) - INLINECODE8 / INLINECODE9
- INLINECODE10 /
.htm (treated as already-converted HTML)
Recommended workflow
- 1. Export the document from your editor to
.docx or .md. - Run
./wechat_pack <file>. - Open
wechat/article.html and paste into the WeChat editor.
Options
- -
--out <dir>: output directory (default: <basename>-wechat) - INLINECODE18 : insert a top-level title if missing
- INLINECODE19 : download or copy a cover image into INLINECODE20
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.
WeChat Pack
快速开始
在技能根目录下运行:
bash
./wechat_pack path/to/article.docx
./wechat_pack path/to/article.md
输出一个发布文件夹,包含:
- - source/ 原始输入文件
- assets/ 下载或提取的图片
- cover/ 可选封面图片
- wechat/ 可直接粘贴到微信编辑器的 article.html 文件
- meta.json 元数据(标题、路径、图片数量、封面变体)
支持的输入格式
- - .docx(需要安装 pandoc)
- .md / .markdown
- .html / .htm(视为已转换的HTML)
推荐工作流程
- 1. 从编辑器中导出文档为 .docx 或 .md 格式。
- 运行 ./wechat_pack <文件>。
- 打开 wechat/article.html 并粘贴到微信编辑器中。
选项
- - --out <目录>:输出目录(默认:<文件名>-wechat)
- --title <标题>:如果缺少顶级标题则插入一个
- --cover <路径或URL>:将封面图片下载或复制到 cover/ 目录
注意事项
- - 对于 .docx 转换,pandoc 必须存在于 PATH 环境变量中。
- 脚本会下载外部图片并将
标签重写为本地 assets/ 路径。 - 输出的HTML使用内联CSS样式,以便兼容微信编辑器。
- 如果安装了Pillow库,会在 cover/ 目录生成封面变体:cover-wide-2.35x1.jpg 和 cover-square-1x1.jpg。