A Claude Code skill for the full WeChat Official Account (公众号) publishing pipeline: Format → Cover (optional) → Publish — with 30 themes, a visual gallery picker, AI content enhancement, and one-click publishing to drafts.
- Markdown → WeChat HTML: Converts standard Markdown into inline-styled HTML that works in WeChat's editor (no
<style>tags, no classes — everything inline) - 30 Themes: From newspaper-style serif to neon cyberpunk, organized into 5 categories
- Visual Gallery: Preview 20 core themes with your actual article in a browser, then pick one
- AI Content Enhancement: Auto-detects dialogue, key quotes, and image sequences — wraps them in styled containers
- One-Click Publish: Uploads images to WeChat CDN and pushes the article to your drafts
# Install
cd ~/.claude/skills/
git clone https://github.com/xiaohuailabs/xiaohu-wechat-format.git
cp xiaohu-wechat-format/config.example.json xiaohu-wechat-format/config.json
pip3 install markdown requests
# Format an article (opens gallery in browser)
python3 scripts/format.py --input article.md --gallery
# Format with a specific theme
python3 scripts/format.py --input article.md --theme newspaper
# Publish to WeChat drafts
python3 scripts/publish.py --dir /tmp/wechat-format/article-name/ --cover cover.jpgJust say:
排版这篇文章 /path/to/article.md
Claude will:
- Read and analyze your article
- Auto-enhance content (add dialogue containers, callout blocks, etc.)
- Open the theme gallery in your browser
- You pick a theme, tell Claude the name
- Claude formats and optionally publishes to WeChat
| Theme | ID | Style |
|---|---|---|
| Terracotta | terracotta |
Warm orange, rounded headers |
| ByteDance | bytedance |
Blue-teal gradient, modern tech |
| Chinese | chinese |
Vermillion red, classical |
| Newspaper | newspaper |
NYT-style serif, serious |
| GitHub | github |
Developer-friendly, light code blocks |
| SSPAI | sspai |
Chinese tech media red |
| Bauhaus | bauhaus |
Primary colors, geometric |
| Ink | ink |
Pure black, minimal whitespace |
| Midnight | midnight |
Dark background, neon accents |
| Theme | ID | Style |
|---|---|---|
| Sports | sports |
Gradient stripes, energetic |
| Mint | mint-fresh |
Mint green, fresh |
| Sunset | sunset-amber |
Warm amber tones |
| Lavender | lavender-dream |
Purple dreamy |
| Coffee | coffee-house |
Brown warm tones |
| WeChat Native | wechat-native |
WeChat green |
| Magazine | magazine |
Extra whitespace, editorial |
4 layouts (Minimal / Focus / Elegant / Bold) × multiple color variants (Gold / Blue / Red / Green / Navy / Gray)
Enhance your Markdown with these containers before formatting:
:::dialogue[Interview Title]
Alice: Hello there
Bob: Hi, how are you?
:::
:::gallery[Screenshots]



:::
> [!important] Key Insight
> This is the important takeaway
> [!tip] Pro Tip
> A useful tip for readersEdit config.json:
{
"output_dir": "/tmp/wechat-format",
"vault_root": "/path/to/your/obsidian/vault",
"settings": {
"default_theme": "newspaper",
"auto_open_browser": true
},
"wechat": {
"app_id": "YOUR_APP_ID",
"app_secret": "YOUR_APP_SECRET",
"author": "Author Name"
},
"cover": {
"output_dir": "~/Documents/covers",
"image_generation_script": ""
}
}wechatsection is only needed for publishing; formatting works without itcoversection is only needed for cover image generation- Get AppID/AppSecret from: WeChat Official Account Admin → Settings → Basic Configuration
- Important: Add your public IP to the WeChat IP whitelist, otherwise API calls will fail with error 40164
After formatting, ask Claude to generate a cover image. The skill includes a built-in prompt template optimized for WeChat cover images (2.35:1 ratio, Notion illustration style).
You need an image generation tool configured in config.json → cover.image_generation_script, or simply use any AI image generator manually with the prompt from SKILL.md.
WeChat's editor strips <style> tags and CSS classes. This tool:
- CJK spacing fix: Auto-adds spaces between Chinese and English/numbers
- Bold punctuation fix: Moves Chinese punctuation outside bold markers (
**text,**→**text**,) - Writes all styles as inline
style="..."attributes on every element - Converts
<ul>/<ol>to<section>+ flexbox (WeChat mangles native lists) - Transforms external links
[text](url)into footnotes (WeChat blocks external links) - Processes
![[image.jpg]]Obsidian wiki-links and standardreferences - Renders callout blocks (
[!tip],[!important],[!warning]) with distinct colors - Converts dialogue blocks into chat-bubble layouts
- Python 3
markdownlibraryrequestslibrary (for publishing)
MIT

