md2wechat
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMD to WeChat Skill (AI Only)
MD 转微信工具(仅AI模式)
Convert Markdown to WeChat Official Account HTML with inline CSS (AI mode) and optionally upload to the draft box.
将Markdown转换为带内联CSS的微信公众号HTML(AI模式),支持可选上传到草稿箱。
Quick Commands
快速命令
bash
undefinedbash
undefinedRender AI-style HTML (theme) from Markdown
Render AI-style HTML (theme) from Markdown
python scripts/md_ai_render.py --md article.md --theme autumn-warm --out article.html
python scripts/md_ai_render.py --md article.md --theme autumn-warm --out article.html
Then publish
Then publish
python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpg
---python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpg
---Workflow
工作流
- Read the Markdown file and note title, images, and structure.
- Pick AI theme (see ).
references/themes.md - Render themed HTML and save it to file.
- If user wants one-click publish, upload images and create draft with the tool.
- 读取Markdown文件,记录标题、图片和结构。
- 选择AI主题(参考)。
references/themes.md - 渲染带主题的HTML并保存到文件。
- 如果用户需要一键发布,使用工具上传图片并创建草稿。
Render HTML
渲染HTML
bash
python scripts/md_ai_render.py --md article.md --theme autumn-warm --out article.htmlbash
python scripts/md_ai_render.py --md article.md --theme autumn-warm --out article.htmlDraft Upload (One-Click Publish)
草稿上传(一键发布)
bash
python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpgUse the first image as cover if the user does not provide one.
bash
python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpg如果用户未提供封面则使用第一张图片作为封面。
Fetch WeChat-Sanitized HTML
获取微信合规HTML
bash
python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpg --fetch-draft article.wechat.htmlbash
python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpg --fetch-draft article.wechat.htmlImages
图片
- Local/remote images are uploaded to WeChat by the tool during publish.
- For AI-generated images, insert in Markdown or ask in natural language.
 - For details, read .
references/image-syntax.md
- 发布过程中工具会自动将本地/远程图片上传到微信。
- 对于AI生成的图片,在Markdown中插入即可,也可通过自然语言要求生成。
 - 详情请阅读。
references/image-syntax.md
Standalone Image
独立图片
AI image generation is handled by Claude; no separate tool call.
AI图片生成由Claude处理,无需单独调用工具。
Configuration (Env File)
配置(环境变量文件)
Assume the user has an env file (e.g. ) configured with:
.envWECHAT_APPIDWECHAT_SECRET
Optional:
- (AI images)
IMAGE_API_KEY IMAGE_API_BASE
The publish tool loads by default; override with .
It also accepts / in the env file.
Draft title defaults to the Markdown filename (without ). Override with .
.env--envAppIDAppSecret.md--title假设用户已在环境变量文件(如)中配置了以下参数:
.envWECHAT_APPIDWECHAT_SECRET
可选参数:
- (AI图片生成)
IMAGE_API_KEY IMAGE_API_BASE
发布工具默认加载,可通过参数指定其他环境变量文件。
也支持从环境变量文件中读取/。
草稿标题默认使用Markdown文件名(不带后缀),可通过参数覆盖。
.env--envAppIDAppSecret.md--titleExamples
示例
Example 1: Basic Conversion
示例1:基础转换
Input (article.md):
markdown
undefined输入(article.md):
markdown
undefinedHello World
Hello World
This is a simple article.
- Item 1
- Item 2
**Command**:
```bash
python scripts/md_ai_render.py --md article.md --theme autumn-warm --out article.htmlOutput (article.html): WeChat-compatible HTML with inline CSS and autumn-warm theme styling.
This is a simple article.
- Item 1
- Item 2
**命令**:
```bash
python scripts/md_ai_render.py --md article.md --theme autumn-warm --out article.html输出(article.html): 适配微信、带内联CSS和autumn-warm主题样式的HTML。
Example 2: Publish to Draft
示例2:发布到草稿
Input: article.md + article.html + cover.jpg
Command:
bash
python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpgOutput:
json
{"success": true, "image_count": 2, "draft_media_id": "xxx"}输入: article.md + article.html + cover.jpg
命令:
bash
python scripts/wechat_publish.py --md article.md --html article.html --draft --cover cover.jpg输出:
json
{"success": true, "image_count": 2, "draft_media_id": "xxx"}References
参考文档
- (AI themes and prompts)
references/themes.md - (WeChat HTML rules)
references/html-guide.md - (image syntax)
references/image-syntax.md - (draft upload behavior)
references/wechat-api.md
- (AI主题和提示词)
references/themes.md - (微信HTML规则)
references/html-guide.md - (图片语法)
references/image-syntax.md - (草稿上传行为)
references/wechat-api.md