Converts Markdown articles to WeChat Official Account formatted HTML with inline CSS and optionally uploads to draft box. Supports two modes:
# Preview HTML (API mode, fast)
bash skills/md2wechat/scripts/run.sh convert article.md --preview
# Preview HTML (AI mode, themed)
bash skills/md2wechat/scripts/run.sh convert article.md --mode ai --theme autumn-warm --preview
# Upload to WeChat draft box
bash skills/md2wechat/scripts/run.sh convert article.md --draft --cover cover.jpg
You can also ask me to generate images using natural language:
"Help me generate a product concept image at the beginning of article.md"
"Add an image showing the product features after the second paragraph"
"Create a diagram for the comparison section in article.md"
I will:
"Generate an image of a cute cat sitting on a windowsill"
"Create a product concept image: modern smart home device, white design"
"Make a diagram showing the user flow"
I will:
You can also ask me to help write articles using creator styles:
"Write an article about self-discipline using Dan Koe style"
"Help me write a post about productivity with a sharp, grounded tone"
"Create a story-style article about my travel experience"
I will:
"Rewrite this article with a more engaging style"
"Polish my article.md with Dan Koe's writing style"
"Make this content more profound and sharp"
I will:
"Generate a cover image for my article about self-discipline"
"Create a Victorian woodcut style cover for my philosophy piece"
"Remove AI traces from this article: article.md"
"Humanize this text to make it sound more natural"
"Remove AI writing traces with gentle intensity"
"Rewrite this to sound less like AI generated"
I will:
Humanizer can be combined with writing styles:
"Write with Dan Koe style and remove AI traces"
"Use dan-koe style, then humanize the result"
"Show me all available writing styles"
"What writing styles can I use?"
Available Writing Styles:
Users can add custom styles in writers/ directory. See writers/README.md for details.
Copy this checklist to track progress:
Progress:
- [ ] Step 1: Analyze Markdown structure and images
- [ ] Step 2: Confirm conversion mode (API/AI) and theme
- [ ] Step 3: Generate HTML with inline CSS
- [ ] Step 4: Process images (upload to WeChat)
- [ ] Step 5: Replace image URLs in HTML
- [ ] Step 6: Preview or upload to draft
Read the markdown file and extract:
| Element | How to Extract |
|---|---|
| --------- | ---------------- |
| Title | First # heading or filename |
| Author | Look for Author: or 作者: in frontmatter |
| Digest | First paragraph or generate from content (max 120 chars) |
| Images | Collect all !alt references |
| Structure | Headings, lists, code blocks, quotes, tables |
Image Reference Types:
| Type | Syntax | Processing |
|---|---|---|
| ------ | -------- | ------------ |
| Local | !alt | Upload to WeChat |
| Online | !alt | Download then upload |
| AI Generate | !alt | Generate via AI then upload |
| Mode | Speed | Style | Best For |
|---|---|---|---|
| ------ | ------- | ------- | ---------- |
| API | Fast (seconds) | Clean, standard | Quick publishing, technical content |
| AI | Slower (10-30s) | Beautiful themed | Important articles, brand content |
| Theme | Description | Best For |
|---|---|---|
| ------- | ------------- | ---------- |
| autumn-warm | Warm orange tones, emotional, literary | Stories, lifestyle, essays |
| spring-fresh | Fresh green tones, natural, vibrant | Travel, nature, outdoor |
| ocean-calm | Calm blue tones, professional, rational | Tech articles, business analysis |
| custom | Use custom prompt | Brand customization |
| Theme | Description | Best For |
|---|---|---|
| ------- | ------------- | ---------- |
| default | Default theme, clean and professional | General content |
| bytedance | ByteDance style | Tech news |
| apple | Apple minimalist style | Product reviews |
| sports | Active sports style | Sports content |
| chinese | Traditional Chinese culture style | Cultural articles |
| cyber | Cyberpunk style | Frontier tech |
Ask the user: "Which mode and theme would you like?" - Only ask if the user doesn't specify in their request.
Default: Use API mode if user doesn't specify.
Read detailed style prompts from references/themes.md
Call md2wechat CLI:
bash skills/md2wechat/scripts/run.sh convert article.md --mode api
Read the selected style prompt from references/themes.md and generate HTML with inline CSS.
Important Rules:
style attributes), , etc.Safe HTML Tags:
,
, , , , to
,
, , , , , , , , , (with inline styles)Avoid:
, , - External CSS/JS references
- Complex positioning (fixed, absolute)
Critical for WeChat:
- Create a main
container immediately after to hold all global styles- Specify
color explicitly for each tag (WeChat resets to black otherwise) - Use two
tags for heading symbols: one with color+text-shadow, one with solid color
Step 4: Process Images
Image Generation Methods
There are three ways to generate AI images:
Method 1: Natural Language - For Article (Recommended)
Simply describe what you want in plain language:
User: "Generate a product concept image at the beginning of article.md"
User: "Add a comparison chart after the third paragraph"
User: "Create an image showing the workflow diagram in article.md"
How I process natural language requests:
- Understand the intent - Identify where to insert the image
- Read the article - Analyze context to create an appropriate prompt
- Insert the syntax - Add
!alt at the correct location - Show the prompt - Display the generated prompt for transparency
- Generate and upload - Call the conversion command to complete
Note: Proceed directly with generation. Only ask for confirmation if the prompt is complex or ambiguous.
Example conversation:
User: "Add a product image at the start of my article"
Claude: "I'll add a product concept image at the beginning of article.md.
Based on your article about 'Smart Home Hub', I'll use this prompt:
'A modern smart home hub device, sleek white design with LED indicator
lights, minimalist product photography on a clean white background'
I'll proceed with generating the image."
Method 2: Natural Language - Standalone Image
Generate an image without any article:
User: "Generate an image of a cute cat sitting on a windowsill"
User: "Create a product concept: modern smart home device"
User: "Make a diagram showing user signup flow"
I will:
- Create an appropriate prompt based on your description
- Call:
bash skills/md2wechat/scripts/run.sh generate_image "prompt" - Return the WeChat URL and media ID
Use when: You just need an image, not for any article.
Method 3: Manual Syntax
Write the image generation syntax directly in Markdown:

Syntax format: !alt text
Processing Images by Type
For each image reference in order:
Local Image
bash skills/md2wechat/scripts/run.sh upload_image "/path/to/image.png"
Response:
{"success": true, "wechat_url": "https://mmbiz.qpic.cn/...", "media_id": "xxx"}
Online Image
bash skills/md2wechat/scripts/run.sh download_and_upload "https://example.com/image.png"
AI Generated Image (via CLI)
# Generate with default size (2048x2048 square)
bash skills/md2wechat/scripts/run.sh generate_image "A cute cat sitting on a windowsill"
# Generate with 16:9 ratio for WeChat cover (recommended)
bash skills/md2wechat/scripts/run.sh generate_image --size 2560x1440 "prompt"
WeChat Cover Images: For article covers, use 16:9 horizontal ratio (2560x1440 recommended) as it displays better in WeChat's feed and article list. Square images (2048x2048) are cropped in preview.
Note: AI image generation requires IMAGE_API_KEY environment variable.
Image Processing Pipeline:
- If AI generation: Call image API → get URL
- If online: Download image to temp
- If local: Read file
- Compress if width > 1920px (configurable)
- Upload to WeChat material API
- Return
wechat_url and media_id - Store result for HTML replacement
Step 5: Replace Image URLs
Replace placeholders in HTML:
<!-- Before -->
<!-- IMG:0 -->
<!-- IMG:1 -->
<!-- After -->
<img src="https://mmbiz.qpic.cn/..." />
<img src="https://mmbiz.qpic.cn/..." />
Use the WeChat URLs returned from image processing.
Step 6: Preview or Upload
Ask user:
- Preview only - Show HTML for review
- Upload to draft - Create WeChat draft article
Preview Mode
Display HTML in markdown code block for user to copy.
Upload Mode
Create draft and run:
bash skills/md2wechat/scripts/run.sh convert article.md --draft --cover cover.jpg
Required for draft:
WECHAT_APPID environment variableWECHAT_SECRET environment variable- Cover image (use
--cover or first image in content)
Response:
{"success": true, "media_id": "draft_media_id", "draft_url": "https://mp.weixin.qq.com/..."}
Configuration
Required for WeChat API
Variable Description Required ---------- ------------- ---------- WECHAT_APPIDWeChat Official Account AppID Yes, for draft upload WECHAT_SECRETWeChat API Secret Yes, for draft upload
Optional for AI Features
Variable Description Required ---------- ------------- ---------- IMAGE_API_KEYImage generation API key For AI images IMAGE_API_BASEImage API base URL For AI images COMPRESS_IMAGESCompress images > 1920px (true/false) No, default true MAX_IMAGE_WIDTHMax width in pixels No, default 1920
How to Get AppID and Secret
- Visit WeChat Developer Platform
- Login and select your Official Account
- Go to Settings & Development → Basic Configuration
- Find in Developer ID section:
- Developer ID (AppID): Copy directly
- Developer Password (AppSecret): Click "Reset" to get
- Add these values to environment variables or config file
> Warning: AppSecret is very important, keep it secure!
Config File Location
~/.config/md2wechat/config.yaml # Global config
./md2wechat.yaml # Project config (higher priority)
Error Handling
Error Action ------- -------- Missing config Ask user to set environment variable or run md2wechat config init Image upload fails Log error, continue with placeholder WeChat API fails Show error message, return HTML for manual upload Markdown parse error Ask user to check file format IP not in whitelist Guide user to add IP to WeChat whitelist (see Troubleshooting)
Complete Examples
Example 1: Simple Article (No Images)
Input: simple.md
# My First Article
This is a simple article with no images.
Process:
- Generate HTML with API mode
- Skip image processing
- Ask: preview or upload?
- If upload → create draft
Example 2: Article with Local Images
Input: with-images.md
# Travel Diary
Day 1 in Paris:

Process:
- Analyze: 1 local image
- Generate HTML with
placeholder - Run:
upload_image "./photos/eiffel.jpg" - Replace placeholder with WeChat URL
- Preview or upload
Example 3: AI Mode with Theme
Input: story.md
# The Old Library
A story about memories...
Process:
- User selects AI mode + autumn-warm theme
- Read theme prompt from references/themes.md
- Generate themed HTML with inline CSS
- Preview or upload
Example 4: AI Image Generation via Natural Language
User Request:
"Help me add a product concept image at the beginning of article.md"
Process:
- Read article.md to understand the product
- Create an appropriate image prompt based on context
- Confirm with user: "I'll use this prompt: '...'"
- Insert
!Product Concept at line 2 - Run conversion command to generate and upload
Result: Image generated and uploaded to WeChat
Example 5: Article with Pre-written Image Syntax
Input: mixed.md
# Tech Review



Process:
- Process 3 images in order
- Each returns WeChat URL
- Replace all placeholders
- Final HTML with all WeChat-hosted images
References
- Style Themes - Detailed style prompts for AI themes
- HTML Guide - WeChat HTML constraints and best practices
- Image Syntax - Image reference syntax and generation
- Writing Guide - Writer style assistant documentation
- Humanizer - AI writing trace removal documentation 🆕
- WeChat API - API reference
Troubleshooting
Configuration Issues
Q: "AppID not configured" error
A: Set WECHAT_APPID and WECHAT_SECRET environment variables, or run:
bash skills/md2wechat/scripts/run.sh config init
Q: Config file not working
A: Check config file location. Supported locations:
./md2wechat.yaml (current directory, highest priority)~/.md2wechat.yaml~/.config/md2wechat/config.yaml
Image Issues
Q: Image upload fails with "invalid filetype"
A: WeChat supports JPG, PNG, GIF. Ensure image is in correct format:
# Convert using ImageMagick
convert input.tiff output.jpg
Q: Images not showing in draft
A: Images must use WeChat-hosted URLs (mmbiz.qpic.cn), not external URLs.
Q: AI image generation fails
A: Check IMAGE_API_KEY is set and API base URL is correct.
WeChat API Issues
Q: "IP not in whitelist" error
A: Add your server IP to WeChat whitelist:
- Get your public IP:
curl ifconfig.me
# or
curl ip.sb
- Add IP to WeChat:
- Visit WeChat Developer Platform
- Go to Settings & Development → Basic Configuration
- Find IP Whitelist section
- Click "Set" and add your IP
- Wait a few minutes for changes to take effect
Q: "access_token expired" error
A: Program auto-refreshes tokens. If persists:
# Check config
bash skills/md2wechat/scripts/run.sh config show
# Re-init if needed
bash skills/md2wechat/scripts/run.sh config init
Q: "create draft failed" error
A: Possible causes:
- Insufficient permissions - ensure account is verified
- Sensitive content - check article content
- Draft limit reached - check existing drafts
- Content size out of limit (errcode=45002) - article content exceeds WeChat API limit
Q: "content size out of limit" error (errcode=45002)
A: WeChat draft API has content limits:
- Characters: < 20,000 characters (中文算1个字符)
- Size: < 1 MB
If you encounter this error:
- Shorten your article content
- Reduce unnecessary formatting (inline CSS adds size)
- Consider splitting into multiple articles
- Use simpler themes with less inline styling
API mode generates more inline CSS which increases content size. For very long articles, consider manual editing or splitting.
Q: API rate limit exceeded
A: WeChat has API limits. Wait and retry:
# Wait 60 seconds
sleep 60
# Retry
bash skills/md2wechat/scripts/run.sh convert article.md --draft
HTML/Style Issues
Q: Styles not working in WeChat editor
A: Check:
- CSS uses inline
style attributes (not tags) - CSS properties are in allowed list (see HTML Guide)
- No syntax errors (unclosed tags, etc.)
Q: Background color lost in WeChat
A: WeChat strips styles. Use main container:
<div style="background-color: #faf9f5; padding: 40px 10px;">
<!-- All content here -->
</div>
Q: Text color not as expected
A: WeChat resets color to black. Always specify:
<p style="color: #4a413d;">Your text here</p>
Command Issues
Q: "command not found: md2wechat"
A: The run.sh script will auto-download the binary on first run. If you want to install manually:
# Use the script - it will handle installation
bash skills/md2wechat/scripts/run.sh --help
# Or download from releases
# Visit: https://github.com/geekjourneyx/md2wechat-skill/releases
Q: AI mode very slow
A: AI mode requires Claude API call and takes 10-30 seconds. For faster results, use API mode.
CLI Commands Reference
All commands go through the run.sh wrapper, which handles auto-installation:
# Show help
bash skills/md2wechat/scripts/run.sh --help
# Convert and preview
bash skills/md2wechat/scripts/run.sh convert article.md --preview
# Convert with AI theme
bash skills/md2wechat/scripts/run.sh convert article.md --mode ai --theme autumn-warm --preview
# Convert and upload to draft
bash skills/md2wechat/scripts/run.sh convert article.md --draft --cover cover.jpg
# Upload single image
bash skills/md2wechat/scripts/run.sh upload_image photo.jpg
# Download and upload online image
bash skills/md2wechat/scripts/run.sh download_and_upload https://example.com/image.jpg
# Generate AI image (requires IMAGE_API_KEY)
bash skills/md2wechat/scripts/run.sh generate_image "A cute cat sitting on a windowsill"
# Generate with 16:9 ratio for WeChat cover (recommended)
bash skills/md2wechat/scripts/run.sh generate_image --size 2560x1440 "prompt"
# Initialize config
bash skills/md2wechat/scripts/run.sh config init
# Show config
bash skills/md2wechat/scripts/run.sh config show
# List available writing styles
bash skills/md2wechat/scripts/run.sh write --list
# Write with creator style (interactive)
bash skills/md2wechat/scripts/run.sh write
# Write with specific style (via stdin/piped)
echo "你的想法或内容" | bash skills/md2wechat/scripts/run.sh write --style dan-koe
# Write with title and heredoc
bash skills/md2wechat/scripts/run.sh write --style dan-koe --title "文章标题" <<EOF
你的内容
EOF
# Write with specific style
bash skills/md2wechat/scripts/run.sh write --style dan-koe
# Generate cover prompt only
bash skills/md2wechat/scripts/run.sh write --style dan-koe --cover-only
# Remove AI writing traces (humanize)
bash skills/md2wechat/scripts/run.sh humanize article.md
# Humanize with intensity
bash skills/md2wechat/scripts/run.sh humanize article.md --intensity aggressive
# Write with humanize
bash skills/md2wechat/scripts/run.sh write --style dan-koe --humanize
# Create image post (小绿书/newspic)
bash skills/md2wechat/scripts/run.sh create_image_post -t "Title" --images photo1.jpg,photo2.jpg
# Extract images from Markdown
bash skills/md2wechat/scripts/run.sh create_image_post -t "Title" -m article.md
# With description and comments
bash skills/md2wechat/scripts/run.sh create_image_post -t "Title" -c "Description" --images photo.jpg --open-comment
# Preview mode (dry-run)
bash skills/md2wechat/scripts/run.sh create_image_post -t "Test" --images a.jpg,b.jpg --dry-run
Image Posts (小绿书/Newspic)
Create WeChat image-only posts (小绿书/图片消息) with up to 20 images.
Natural Language
"Create an image post titled 'Weekend Trip' with photos from ./photos/"
"Make a 小绿书 post with travel.md images"
"Upload these images as an image post: a.jpg, b.jpg, c.jpg"
Command Options
Flag Short Description ------ ------- ------------- --title-tPost title (required) --content-cDescription text --imagesComma-separated image paths --from-markdown-mExtract images from Markdown file --open-commentEnable comments --fans-onlyOnly fans can comment --dry-runPreview without uploading --output-oSave result to JSON file
Examples
# Basic image post
bash skills/md2wechat/scripts/run.sh create_image_post \
-t "Weekend Trip" \
--images photo1.jpg,photo2.jpg,photo3.jpg
# Extract images from article
bash skills/md2wechat/scripts/run.sh create_image_post \
-t "Travel Diary" \
-m article.md
# With description and comments enabled
bash skills/md2wechat/scripts/run.sh create_image_post \
-t "Food Blog" \
-c "Today's lunch" \
--images food.jpg \
--open-comment
# Read description from stdin
echo "Daily check-in" | bash skills/md2wechat/scripts/run.sh create_image_post \
-t "Daily" \
--images pic.jpg
# Preview mode
bash skills/md2wechat/scripts/run.sh create_image_post \
-t "Test" \
--images a.jpg,b.jpg \
--dry-run
Notes
- Image limit: Maximum 20 images per post
- Image format: JPG, PNG, GIF (same as regular articles)
- Content: Plain text only, not HTML
- Requires:
WECHAT_APPID and WECHAT_SECRET for upload
版本历史
共 1 个版本
-
v1.0.0
Initial release 当前
2026-04-19 20:55 安全 安全
🔗 相关推荐
content-creation
Marketing Skills
jchopard69 访问 23 个营销模块,提供转化率优化(CRO)、SEO、文案撰写、分析、发布、广告和社交媒体的清单、框架及可直接使用的交付物。
★ 144
📥 31,136
content-creation
Humanizer
biostartechnology 消除AI写作痕迹,使文本更自然真实。基于维基百科"AI写作特征"指南,识别并修正夸张象征、宣传用语、肤浅-ing分析、模糊归因、破折号滥用、三项排比、AI词汇、负面平行结构及冗长连接词等模式。
★ 914
📥 208,787
content-creation
humanizer-zh
liuxy951129-cpu 去除文本中的 AI 生成痕迹。适用于编辑或审阅文本,使其听起来更自然、更像人类书写。
基于维基百科的"AI 写作特征"综合指南。检测并修复以下模式:夸大的象征意义、
宣传性语言、以 -ing 结尾的肤浅分析、模糊的归因、破折号过度使用、三段
★ 63
📥 29,875