MD to WeChat
Use md2wechat when the user wants to:
- convert Markdown into WeChat Official Account HTML
- preview or upload article drafts
- inspect live capabilities, providers, themes, and prompts
- generate covers, infographics, or other article images
- create image posts
- write in creator styles or remove AI writing traces
Defaults And Config
- Assume
md2wechat is already available on PATH.
- Draft upload and publish-related actions require
WECHAT_APPID and WECHAT_SECRET.
- Image generation may require extra provider config in
~/.config/md2wechat/config.yaml.
convert defaults to api mode unless the user explicitly asks for --mode ai.
- Check config in this order:
~/.config/md2wechat/config.yaml
- environment variables such as
MD2WECHAT_BASE_URL
- project-local
md2wechat.yaml, md2wechat.yml, or md2wechat.json
- If the user asks to switch API domain, change
api.md2wechat_base_url or MD2WECHAT_BASE_URL.
- Treat live CLI discovery output as the source of truth. Do not guess provider names, theme names, or prompt names from repository files alone.
Discovery First
Run these before selecting a provider, theme, or prompt:
md2wechat version --json
md2wechat capabilities --json
md2wechat providers list --json
md2wechat themes list --json
md2wechat prompts list --json
md2wechat prompts list --kind image --json
md2wechat prompts list --kind image --archetype cover --json
Inspect a specific resource before using it:
md2wechat providers show openrouter --json
md2wechat themes show autumn-warm --json
md2wechat prompts show cover-default --kind image --json
md2wechat prompts show cover-hero --kind image --archetype cover --tag hero --json
md2wechat prompts show infographic-victorian-engraving-banner --kind image --archetype infographic --tag victorian --json
md2wechat prompts render cover-default --kind image --var article_title='Example' --json
When choosing image presets, prefer the prompt metadata returned by prompts show --json, especially primary_use_case, compatible_use_cases, recommended_aspect_ratios, and default_aspect_ratio.
Core Commands
Configuration:
md2wechat config init
md2wechat config show --format json
md2wechat config validate
Conversion:
md2wechat convert article.md --preview
md2wechat convert article.md -o output.html
md2wechat convert article.md --draft --cover cover.jpg
md2wechat convert article.md --mode ai --theme autumn-warm --preview
md2wechat convert article.md --title "新标题" --author "作者名" --digest "摘要"
Image handling:
md2wechat upload_image photo.jpg
md2wechat download_and_upload https://example.com/image.jpg
md2wechat generate_image "A cute cat sitting on a windowsill"
md2wechat generate_image --preset cover-hero --article article.md --size 2560x1440
md2wechat generate_cover --article article.md
md2wechat generate_infographic --article article.md --preset infographic-comparison
md2wechat generate_infographic --article article.md --preset infographic-dark-ticket-cn --aspect 21:9
md2wechat generate_infographic --article article.md --preset infographic-handdrawn-sketchnote
Drafts and image posts:
md2wechat create_draft draft.json
md2wechat test-draft article.html cover.jpg
md2wechat create_image_post -t "Weekend Trip" --images photo1.jpg,photo2.jpg
md2wechat create_image_post -t "Travel Diary" -m article.md
echo "Daily check-in" | md2wechat create_image_post -t "Daily" --images pic.jpg
md2wechat create_image_post -t "Test" --images a.jpg,b.jpg --dry-run
Writing and humanizing:
md2wechat write --list
md2wechat write --style dan-koe
md2wechat write --style dan-koe --input-type fragment article.md
md2wechat write --style dan-koe --cover-only
md2wechat write --style dan-koe --cover
md2wechat write --style dan-koe --humanize --humanize-intensity aggressive
md2wechat humanize article.md
md2wechat humanize article.md --intensity aggressive
md2wechat humanize article.md --show-changes
md2wechat humanize article.md -o output.md
Article Metadata Rules
For convert, metadata resolution is:
- Title:
--title -> frontmatter.title -> first Markdown heading -> 未命名文章
- Author:
--author -> frontmatter.author
- Digest:
--digest -> frontmatter.digest -> frontmatter.summary -> frontmatter.description
Limits enforced by the CLI:
--title: max 32 characters
--author: max 16 characters
--digest: max 128 characters
Draft behavior:
- If digest is still empty when creating a draft, the draft layer generates one from article HTML content with a 120-character fallback.
- Creating a draft requires
--cover.
Agent Rules
- Start with discovery commands before committing to a provider, theme, or prompt.
- Prefer
generate_cover or generate_infographic over a raw generate_image "prompt" call when a bundled preset fits the task.
- Validate config before any draft, publish, or image-post action.
- If the user asks for AI conversion or style writing, be explicit that the CLI may return an AI request or prompt rather than final HTML or prose unless the workflow completes the external model step.
- Do not perform draft creation, publishing, or remote image generation unless the user asked for it.
References
- Theme examples and visual guidance:
references/themes.md
- WeChat draft and image-post API details:
references/wechat-api.md
- Markdown image syntax and AI placeholders:
references/image-syntax.md
- HTML conversion notes:
references/html-guide.md
- Writer-style workflow:
references/writing-guide.md
- Humanizer workflow:
references/humanizer.md
Safety And Transparency
- Reads local Markdown files and local images.
- May download remote images when asked.
- May call external image-generation services when configured.
- May upload HTML, images, drafts, and image posts to WeChat when the user explicitly requests those actions.
1---2name: md2wechat3description: Convert Markdown to WeChat Official Account HTML. Use this whenever the user wants WeChat article conversion, draft upload, image generation for articles, cover or infographic generation, image-post creation, writer-style drafting, AI trace removal, or needs to inspect supported providers, themes, and prompt templates before running the workflow.4---56# MD to WeChat78Use `md2wechat` when the user wants to:910- convert Markdown into WeChat Official Account HTML11- preview or upload article drafts12- inspect live capabilities, providers, themes, and prompts13- generate covers, infographics, or other article images14- create image posts15- write in creator styles or remove AI writing traces1617## Defaults And Config1819- Assume `md2wechat` is already available on `PATH`.20- Draft upload and publish-related actions require `WECHAT_APPID` and `WECHAT_SECRET`.21- Image generation may require extra provider config in `~/.config/md2wechat/config.yaml`.22- `convert` defaults to `api` mode unless the user explicitly asks for `--mode ai`.23- Check config in this order:24 1. `~/.config/md2wechat/config.yaml`25 2. environment variables such as `MD2WECHAT_BASE_URL`26 3. project-local `md2wechat.yaml`, `md2wechat.yml`, or `md2wechat.json`27- If the user asks to switch API domain, change `api.md2wechat_base_url` or `MD2WECHAT_BASE_URL`.28- Treat live CLI discovery output as the source of truth. Do not guess provider names, theme names, or prompt names from repository files alone.2930## Discovery First3132Run these before selecting a provider, theme, or prompt:3334```bash35md2wechat version --json36md2wechat capabilities --json37md2wechat providers list --json38md2wechat themes list --json39md2wechat prompts list --json40md2wechat prompts list --kind image --json41md2wechat prompts list --kind image --archetype cover --json42```4344Inspect a specific resource before using it:4546```bash47md2wechat providers show openrouter --json48md2wechat themes show autumn-warm --json49md2wechat prompts show cover-default --kind image --json50md2wechat prompts show cover-hero --kind image --archetype cover --tag hero --json51md2wechat prompts show infographic-victorian-engraving-banner --kind image --archetype infographic --tag victorian --json52md2wechat prompts render cover-default --kind image --var article_title='Example' --json53```5455When choosing image presets, prefer the prompt metadata returned by `prompts show --json`, especially `primary_use_case`, `compatible_use_cases`, `recommended_aspect_ratios`, and `default_aspect_ratio`.5657## Core Commands5859Configuration:6061- `md2wechat config init`62- `md2wechat config show --format json`63- `md2wechat config validate`6465Conversion:6667- `md2wechat convert article.md --preview`68- `md2wechat convert article.md -o output.html`69- `md2wechat convert article.md --draft --cover cover.jpg`70- `md2wechat convert article.md --mode ai --theme autumn-warm --preview`71- `md2wechat convert article.md --title "新标题" --author "作者名" --digest "摘要"`7273Image handling:7475- `md2wechat upload_image photo.jpg`76- `md2wechat download_and_upload https://example.com/image.jpg`77- `md2wechat generate_image "A cute cat sitting on a windowsill"`78- `md2wechat generate_image --preset cover-hero --article article.md --size 2560x1440`79- `md2wechat generate_cover --article article.md`80- `md2wechat generate_infographic --article article.md --preset infographic-comparison`81- `md2wechat generate_infographic --article article.md --preset infographic-dark-ticket-cn --aspect 21:9`82- `md2wechat generate_infographic --article article.md --preset infographic-handdrawn-sketchnote`8384Drafts and image posts:8586- `md2wechat create_draft draft.json`87- `md2wechat test-draft article.html cover.jpg`88- `md2wechat create_image_post -t "Weekend Trip" --images photo1.jpg,photo2.jpg`89- `md2wechat create_image_post -t "Travel Diary" -m article.md`90- `echo "Daily check-in" | md2wechat create_image_post -t "Daily" --images pic.jpg`91- `md2wechat create_image_post -t "Test" --images a.jpg,b.jpg --dry-run`9293Writing and humanizing:9495- `md2wechat write --list`96- `md2wechat write --style dan-koe`97- `md2wechat write --style dan-koe --input-type fragment article.md`98- `md2wechat write --style dan-koe --cover-only`99- `md2wechat write --style dan-koe --cover`100- `md2wechat write --style dan-koe --humanize --humanize-intensity aggressive`101- `md2wechat humanize article.md`102- `md2wechat humanize article.md --intensity aggressive`103- `md2wechat humanize article.md --show-changes`104- `md2wechat humanize article.md -o output.md`105106## Article Metadata Rules107108For `convert`, metadata resolution is:109110- Title: `--title` -> `frontmatter.title` -> first Markdown heading -> `未命名文章`111- Author: `--author` -> `frontmatter.author`112- Digest: `--digest` -> `frontmatter.digest` -> `frontmatter.summary` -> `frontmatter.description`113114Limits enforced by the CLI:115116- `--title`: max 32 characters117- `--author`: max 16 characters118- `--digest`: max 128 characters119120Draft behavior:121122- If digest is still empty when creating a draft, the draft layer generates one from article HTML content with a 120-character fallback.123- Creating a draft requires `--cover`.124125## Agent Rules126127- Start with discovery commands before committing to a provider, theme, or prompt.128- Prefer `generate_cover` or `generate_infographic` over a raw `generate_image "prompt"` call when a bundled preset fits the task.129- Validate config before any draft, publish, or image-post action.130- If the user asks for AI conversion or style writing, be explicit that the CLI may return an AI request or prompt rather than final HTML or prose unless the workflow completes the external model step.131- Do not perform draft creation, publishing, or remote image generation unless the user asked for it.132133## References134135- Theme examples and visual guidance: `references/themes.md`136- WeChat draft and image-post API details: `references/wechat-api.md`137- Markdown image syntax and AI placeholders: `references/image-syntax.md`138- HTML conversion notes: `references/html-guide.md`139- Writer-style workflow: `references/writing-guide.md`140- Humanizer workflow: `references/humanizer.md`141142## Safety And Transparency143144- Reads local Markdown files and local images.145- May download remote images when asked.146- May call external image-generation services when configured.147- May upload HTML, images, drafts, and image posts to WeChat when the user explicitly requests those actions.