v0.6.0 · Open Source · MIT License

The Missing Pipeline for
微信公众号 Publishing

Write in Markdown. Publish with one command. Your article arrives in the draft box — styled, images uploaded, cover generated, ready to send.

Serving the 23 million+ WeChat Official Accounts that reach 1.3 billion monthly active users — the world's largest content ecosystem with no modern publishing tools.

publish-md-to-wechat
$ ./install.sh
✓ Dependencies installed, .venv ready
$ python3 scripts/wechat_publisher.py --md article.md --style swiss
⟳ Parsing Markdown (mistune AST)...
⟳ Uploading 3 images to WeChat CDN...
⟳ Generating cover (swiss style)...
✓ Draft created! media_id: Gf8x...kQ2w
# → Open WeChat MP → 草稿箱 → Preview → Publish 🎉
Market Opportunity

The World's Largest Content Platform Has No Modern Tools

WeChat is not just a messaging app — it's a content distribution ecosystem bigger than WordPress, Medium, and Substack combined.

1.3B
Monthly Active Users
WeChat total user base
23M+
Official Accounts
Brands, creators, enterprises
3.6M
Articles Published Daily
Each needing formatting work
30 min
Wasted Per Article
On manual formatting alone
🎯

Underserved Market

WordPress has 60,000+ plugins. Substack raised $85M. Medium has rich APIs. WeChat's publishing ecosystem? Still stuck with a basic web editor from 2014. Every serious publisher is looking for a better workflow.

🚀

Wedge Strategy

Start with the power users — developers, technical writers, content teams — who already think in Markdown. Expand to visual editors, team workflows, and enterprise content ops. The CLI is the wedge; the platform is the play.

The Problem

WeChat's editor is a formatting nightmare

You write great content in Markdown. Then you spend 30 minutes fighting WeChat's editor to make it look decent — copy-pasting, re-uploading images, fixing broken formatting.

  • 😤 Formatting destroyed on paste — code blocks, tables, nested lists all break
  • 🖼️ Images re-uploaded manually — one by one, every single time
  • 🎨 Every article looks the same — no way to apply professional typography
  • ⏱️ 30+ minutes wasted per article on formatting instead of writing

With publish-md-to-wechat:

1
Write in Markdown (Obsidian, VS Code, any editor)
2
Run one command — pick a style
3
Article in draft box — styled, images uploaded, cover ready
4
Preview → Publish 🎉
Features

Everything you need, nothing you don't

From Markdown parsing to WeChat draft creation — handled end-to-end.

🧩

AST-Powered Rendering

mistune 3.x parses complex Markdown — nested lists, tables, code blocks, footnotes — into pixel-perfect HTML.

🎨

11 Visual Styles

3 timeless classics + 7 extended presets + unlimited custom styles. Professional typography, battle-tested on WeChat.

🔁

Style Replication

See a WeChat article you love? Paste its URL. We extract the visual DNA and save it as your custom preset.

🖼️

Smart Image Upload

Local files, external URLs, Obsidian ![[WikiLinks]] — all auto-uploaded to WeChat CDN with caching.

🎭

Auto Cover Generation

Pillow-powered branded PNG covers from your title + style accent colors. No design tools needed.

📋

YAML Frontmatter

Auto-extracts title, author, description. Works with Obsidian, Jekyll, Hugo, and any frontmatter-based workflow.

👀

Dry Run Preview

Generate styled HTML locally without any API calls. Review your article before publishing.

🔐

Flexible Credentials

Project .env, global config, or shell vars. Multi-level priority, never hardcoded, always secure.

🎬

Video URL Detection

YouTube & Bilibili links rendered as clean text links, not broken image placeholders.

Style System

The Classic Trio

Three timeless styles covering 90% of content needs. Each rooted in a century-old design tradition.

Swiss

Swiss International Style

White canvas, red accents, grid-driven precision. Born from Müller-Brockmann's grid system, refined through Apple's design language.

↳ Technical articles · Reports · Announcements

Editorial

Magazine Heritage

Warm cream paper, serif typography, generous spacing. A century of print journalism distilled — The New Yorker, in WeChat.

↳ Opinion pieces · Analysis · Personal brands

Ink · 水墨

Eastern Calligraphy Tradition

Warm white ground, deep crimson accent, maximal line-height. Chinese calligraphy meeting modern digital publishing.

↳ Humanities · Culture · Deep writing

+7 extended styles for specific scenarios:

notebook geometry botanical terminal bold cyber voltage
Style Replication

See a style you love? Clone it.

Analyze any WeChat article, extract its visual DNA, and save it as your own reusable preset.

🔗

Paste a URL

Point to any WeChat article with a style you admire.

styles.py --url https://mp.weixin.qq.com/s/xxx
🧬

Auto-Extract

Colors, fonts, spacing, borders — all extracted and saved as JSON.

→ custom-kimi.json saved

Publish with it

Use your custom style just like any built-in preset.

--style custom-kimi
Architecture

A Modular Pipeline

Every stage is independent, testable, and extensible.

📄

Markdown → AST

mistune 3.x parses your Markdown into a structured Abstract Syntax Tree. Handles nested lists, tables, code blocks, frontmatter, and Obsidian WikiLinks.

🎨

Style Engine

Applies one of 11+ visual styles as inline CSS — the only way to style WeChat articles. Custom styles from JSON presets or URL extraction.

🖼️

Image Processor

Local files, external URLs, and WikiLinks — all resolved, uploaded to WeChat CDN, and replaced with permanent media URLs.

🎭

Cover Generator

Pillow-based branded PNG cover from your title + style accent colors. Automatic or custom override.

📡

WeChat API Client

Upload media, create draft, handle token refresh. Auto-retry with exponential backoff. Error handling for all known WeChat API edge cases.

Get Started

Up and running in 60 seconds

Python 3, one script, one .env file. That's it.

1

Install dependencies

git clone https://github.com/walk4rever/publish-md-to-wechat && cd publish-md-to-wechat && ./install.sh
2

Add your WeChat credentials

cp env.example .env # fill in WECHAT_APP_ID & WECHAT_APP_SECRET
3

Publish your first article

python3 scripts/wechat_publisher.py --md article.md --style swiss
View on GitHub →

Stop Fighting the Editor.
Start Publishing.

Join the publishers who write in Markdown and let the pipeline handle the rest. Free, open source, MIT licensed.

Get Started Free → ⭐ Star on GitHub