Article Posting (文章发表)

Post markdown articles to WeChat Official Account with full formatting support.

Usage

# Post markdown article
npx -y bun ./scripts/wechat-article.ts --markdown article.md

# With theme
npx -y bun ./scripts/wechat-article.ts --markdown article.md --theme grace

# With explicit options
npx -y bun ./scripts/wechat-article.ts --markdown article.md --author "作者名" --summary "摘要"

Parameters

Parameter
Description

--markdown <path>

Markdown file to convert and post

--theme <name>

Theme: default, grace, or simple

--title <text>

Override title (auto-extracted from markdown)

--author <name>

Author name (default: 宝玉)

--summary <text>

Article summary

--html <path>

Pre-rendered HTML file (alternative to markdown)

--profile <dir>

Chrome profile directory

Markdown Format

Image Handling

  1. Parse: Images in markdown are replaced with [[IMAGE_PLACEHOLDER_N]]

  2. Render: HTML is generated with placeholders in text

  3. Paste: HTML content is pasted into WeChat editor

  4. Replace: For each placeholder:

    • Find and select the placeholder text

    • Scroll into view

    • Press Backspace to delete the placeholder

    • Paste the image from clipboard

Scripts

Script
Purpose

wechat-article.ts

Main article publishing script

md-to-wechat.ts

Markdown to HTML with placeholders

md/render.ts

Markdown rendering with themes

Example Session

Last updated