geekjourneyx/md2wechat-skill

用 Markdown 写公众号文章,一键转换为精美排版并自动上传到微信草稿箱。支持 AI 多主题样式和批量发布,让公众号写作像发朋友圈一样简单。https://md2wechat.cn

License:UnknownLanguage:Go588
claude-skillsgolangmarkdown-converter技能wechat

Deep Analysis

Convert Markdown articles to beautifully formatted WeChat Official Account format with one click and auto-upload to WeChat drafts

Highly Recommended

Core Features

Convert Markdown documents to WeChat-compatible HTML format

Claude-assisted content creation supporting multiple theme styles

Auto-upload converted content to WeChat Official Account drafts

Support --preview parameter to preview conversion results

Support specifying cover image to upload together with draft

Technical Implementation

Architecture:Go-built CLI tool supporting API and AI modes, implementing auto draft upload via WeChat Official Account API
Execution Flow:

Key Components:
Go
WeChat Official Account API
Claude AI
Markdown Parser
Highlights
  • Truly solves Official Account formatting pain, lets creators focus on content not format
  • Supports AI multi-theme styles for one-click different visual effects
  • Cross-platform support for Windows/macOS/Linux
  • Deep integration with Claude Code
Use Cases
  • Tech bloggers write articles in Markdown, one-click publish to Official Account
  • Product managers quickly publish product announcements
  • AI-generated content directly pushed to Official Account drafts
  • Batch convert multiple articles with unified styling
Limitations
  • API mode requires API Key from official website
  • Requires configuring WeChat Official Account AppID and Secret
  • Depends on WeChat Official Account API, subject to platform policies
Tech Stack
Go微信公众号 APIClaude AIMarkdownHTML/CSS

md2wechat

用 Markdown 写公众号文章,像发朋友圈一样简单

Go Version
License
GitHub Release
Claude Code

快速开始Claude Code功能介绍使用说明常见问题


🚀 Claude Code 用户(推荐)

在 Claude Code 中运行以下命令即可使用:

/plugin marketplace add geekjourneyx/md2wechat-skill
/plugin install md2wechat@geekjourneyx-md2wechat-skill

然后直接对话:"请用秋日暖光主题将 article.md 转换为微信公众号格式"



✨ 这是什么?

md2wechat 是一个让你的微信公众号写作更高效的神器。

💡 一句话理解:用 Markdown 写文章 → 一键转换 → 自动发到微信草稿箱

适合谁用?

你是 痛点 md2wechat 帮你
📝 内容创作者 微信编辑器太难用,排版花时间 Markdown 写作,自动排版
💼 产品经理 要发公告,但不会 HTML 不用学代码,一行命令搞定
👨‍💻 程序员 习惯 Markdown,讨厌微信编辑器 保持你的写作习惯
🤖 AI 用户 用 AI 生成内容,但要手动复制粘贴 AI 生成 → 微信草稿,无缝衔接

🎯 核心功能

flowchart LR
    A[用 Markdown 写文章] --> B{选择模式}

    B -->|API 模式| C[调用 md2wechat.cn API]
    C --> D[获取 HTML]

    B -->|AI 模式 推荐| E[Claude AI 生成 HTML]
    E --> F[精美排版]

    D --> G[预览效果]
    F --> G

    G --> H{满意吗}
    H -->|不满意| B
    H -->|满意| I[上传图片]
    I --> J[发送到微信草稿箱]
    J --> K[完成]

    classDef nodeA fill:#e3f2fd,stroke:#2196f3,color:#0d47a1
    classDef nodeE fill:#fff3e0,stroke:#ff9800,color:#e65100
    classDef nodeJ fill:#e8f5e9,stroke:#4caf50,color:#1b5e20
    classDef nodeK fill:#c8e6c9,stroke:#4caf50,color:#1b5e20

    class A nodeA
    class E nodeE
    class J nodeJ
    class K nodeK

两种转换模式

模式 适合谁 特点 样式
API 模式 追求稳定、快速 调用 md2wechat.cn API,秒级响应 简洁专业
AI 模式 追求精美排版 Claude AI 生成,样式更丰富 秋日暖光 / 春日清新 / 深海静谧

完整工作流程

flowchart LR
    A1[Markdown 写作] --> A2[插入图片]
    A2 --> B1{选择模式}

    B1 -->|API| B2[md2wechat.cn]
    B1 -->|AI| B3[Claude AI]

    B2 --> B4[HTML 生成]
    B3 --> B4

    B4 --> C1[预览效果]
    C1 --> C2{满意吗}

    C2 -->|调整| B1
    C2 -->|OK| C3[上传图片]
    C3 --> C4[发送草稿]
    C4 --> C5[完成]

    classDef write fill:#e3f2fd,stroke:#2196f3,color:#0d47a1
    classDef ai fill:#fff3e0,stroke:#ff9800,color:#e65100
    classDef done fill:#e8f5e9,stroke:#4caf50,color:#1b5e20
    classDef success fill:#c8e6c9,stroke:#4caf50,color:#1b5e20

    class A1,A2 write
    class B3 ai
    class C4,C5 done

🚀 5分钟快速上手

第一步:下载软件

💡 最新版本:访问 Releases 页面 下载

你的系统 下载链接 安装位置
🪟 Windows 下载 .exe 任意文件夹(或 C:\Windows\System32\
🍎 Mac Intel 芯片 下载 /usr/local/bin/~/.local/bin/
🍎 Mac Apple Silicon (M1/M2/M3) 下载 /usr/local/bin/~/.local/bin/
🐧 Linux (Intel/AMD) 下载 /usr/local/bin/~/.local/bin/
🐧 Linux (ARM/树莓派) 下载 /usr/local/bin/~/.local/bin/

🔍 如何确认 Mac 芯片类型?

  • 点击屏幕左上角 苹果图标关于本机
  • 查看「芯片」或「处理器」信息:
    • 显示 Apple M1/M2/M3/M4 → 下载 Apple Silicon 版本
    • 显示 Intel → 下载 Intel 版本

安装步骤

Windows 安装方法
  1. 下载 md2wechat-windows-amd64.exe
  2. 重命名为 md2wechat.exe(可选)
  3. 放到任意文件夹,或复制到 C:\Windows\System32\(全局可用)
  4. 打开 CMD 或 PowerShell,输入 md2wechat --help 测试
Mac 安装方法

请根据你的芯片类型选择对应命令:

Apple Silicon (M1/M2/M3/M4):

# 下载并移动到系统目录
curl -Lo md2wechat https://github.com/geekjourneyx/md2wechat-skill/releases/latest/download/md2wechat-darwin-arm64
chmod +x md2wechat
sudo mv md2wechat /usr/local/bin/

# 测试
md2wechat --help

Intel 芯片:

# 下载并移动到系统目录
curl -Lo md2wechat https://github.com/geekjourneyx/md2wechat-skill/releases/latest/download/md2wechat-darwin-amd64
chmod +x md2wechat
sudo mv md2wechat /usr/local/bin/

# 测试
md2wechat --help

用户目录安装(无需 sudo):

# Apple Silicon
mkdir -p ~/.local/bin
curl -Lo ~/.local/bin/md2wechat https://github.com/geekjourneyx/md2wechat-skill/releases/latest/download/md2wechat-darwin-arm64
chmod +x ~/.local/bin/md2wechat

# Intel 芯片(将上面 URL 中的 arm64 改为 amd64)

# 添加到 PATH(如果还没有)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# 测试
md2wechat --help
Linux 安装方法

请根据你的架构选择对应命令:

Intel/AMD (x86_64):

# 下载并移动到系统目录
curl -Lo md2wechat https://github.com/geekjourneyx/md2wechat-skill/releases/latest/download/md2wechat-linux-amd64
chmod +x md2wechat
sudo mv md2wechat /usr/local/bin/

# 测试
md2wechat --help

ARM/树莓派 (aarch64):

# 下载并移动到系统目录
curl -Lo md2wechat https://github.com/geekjourneyx/md2wechat-skill/releases/latest/download/md2wechat-linux-arm64
chmod +x md2wechat
sudo mv md2wechat /usr/local/bin/

# 测试
md2wechat --help

用户目录安装(无需 sudo):

mkdir -p ~/.local/bin
# Intel/AMD 用 amd64,ARM 用 arm64
curl -Lo ~/.local/bin/md2wechat https://github.com/geekjourneyx/md2wechat-skill/releases/latest/download/md2wechat-linux-amd64
chmod +x ~/.local/bin/md2wechat

# 添加到 PATH(如果还没有)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc  # 或 ~/.zshrc
source ~/.bashrc

# 测试
md2wechat --help

⚠️ Mac 用户:下载后如果提示「无法打开」,右键点击 → 打开 → 仍要打开

第二步:配置微信(只需一次)

md2wechat config init

用记事本打开生成的配置文件(会显示路径),填入两个信息:

配置项 是什么 在哪获取
AppID 公众号唯一标识 mp.weixin.qq.com → 设置与开发 → 基本配置
Secret API 密钥 同上,需要管理员权限

第三步:开始使用

# 1. 用 Markdown 写好文章(假设文件叫 article.md)

# 2. 预览效果
md2wechat convert article.md --preview

# 3. 发送到微信草稿箱
md2wechat convert article.md --draft --cover cover.jpg

💡 小贴士:第一次使用时,命令会自动引导你完成配置。


📖 使用方法

基础命令

# 预览转换效果(不发送)
md2wechat convert article.md --preview

# 转换并保存为 HTML 文件
md2wechat convert article.md -o output.html

# 使用 AI 模式生成精美排版
md2wechat convert article.md --mode ai --theme autumn-warm --preview

完整发布流程

# 一步到位:转换 + 上传图片 + 发送草稿
md2wechat convert article.md --draft --cover cover.jpg

# 流程说明:
# 1. 将 Markdown 转换为微信格式 HTML
# 2. 上传封面图片到微信素材库
# 3. 创建草稿并推送到微信后台

AI 模式主题选择

主题名 命令 风格 适合内容
🟠 秋日暖光 --theme autumn-warm 温暖橙色调 情感故事、生活随笔
🟢 春日清新 --theme spring-fresh 清新绿色调 旅行日记、自然主题
🔵 深海静谧 --theme ocean-calm 专业蓝色调 技术文章、商业分析

API 模式主题选择

主题名 命令 风格 适合内容
默认 --mode api 或默认 简洁专业 通用内容
bytedance --theme bytedance 字节跳动风格 科技资讯
apple --theme apple Apple 极简风格 产品评测
sports --theme sports 运动活力风格 体育内容
chinese --theme chinese 中国传统文化风格 文化文章
cyber --theme cyber 赛博朋克风格 前沿科技

图片处理

# 上传单张图片到微信素材库
md2wechat upload_image photo.jpg

# 下载网络图片并上传
md2wechat download_and_upload https://example.com/image.jpg

# AI 生成图片并上传(需要配置 IMAGE_API_KEY)
md2wechat generate_image "A cute cat sitting on a windowsill"

AI 图片生成

在 Markdown 中使用特殊语法生成图片:

![产品概念图](__generate:现代智能家居设备,白色简约设计,LED指示灯__)

语法格式: ![描述](__generate:提示词__)

  • 支持中文和英文提示词
  • 生成的图片会自动上传到微信素材库
  • 需要配置图片生成服务(详见 图片服务配置文档)

在 Claude Code 中使用自然语言:

"帮我在文章开头生成一张产品概念图"
"在第三段后添加一张对比图"
"生成一张可爱的猫"(独立生成,不关联文章)

🤖 AI 模式详解

什么是 AI 模式?

AI 模式使用 Claude 大模型来生成精美的公众号排版,而不是简单的 API 转换。

┌─────────────────────────────────────────────────────────────┐
│                     AI 模式工作流程                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│   1. 你用 Markdown 写文章                                    │
│              ↓                                               │
│   2. md2wechat 提取文章结构                                  │
│              ↓                                               │
│   3. 构建专业的排版提示词 (Prompt)                           │
│              ↓                                               │
│   4. Claude AI 根据提示词生成 HTML                          │
│              ↓                                               │
│   5. 返回符合微信规范的 HTML                                 │
│                                                             │
└─────────────────────────────────────────────────────────────┘

AI 模式的优势

对比项 API 模式 AI 模式
响应速度 ⚡ 秒级 🐢 10-30秒
排版质量 👍 标准规范 🌟 精美多样
样式选择 2-3 种 无限可能
成本 使用 Claude AI
适合场景 日常文章 重要文章、品牌内容

在 Claude Code 中使用 AI 模式

如果你使用 Claude Code,AI 模式会自动调用内置的 Claude,无需额外配置:

# 在 Claude Code 中直接运行
md2wechat convert article.md --mode ai --theme autumn-warm

⚙️ 配置说明

配置文件位置

~/.config/md2wechat/config.yaml    # 全局配置(推荐)

配置项说明

# 微信公众号配置(必需)
wechat:
  appid: "你的AppID"
  secret: "你的Secret"

# API 配置
api:
  md2wechat_key: "md2wechat.cn 的 API Key"  # API 模式需要
  convert_mode: "api"                       # 默认模式:api 或 ai
  default_theme: "default"                  # 默认主题
  http_timeout: 30                          # 超时时间(秒)

# 图片处理配置
image:
  compress: true           # 自动压缩大图
  max_width: 1920         # 最大宽度
  max_size_mb: 5          # 最大文件大小(MB)

📁 项目结

Highly Recommended
agents

wshobson/agents

wshobson

Intelligent automation and multi-agent orchestration for Claude Code

The most comprehensive Claude Code plugin ecosystem, covering full-stack development scenarios with a three-tier model strategy balancing performance and cost.

25.6k2.8k3 days ago
Highly Recommended
awesome-claude-skills

ComposioHQ/awesome-claude-skills

ComposioHQ

A curated list of awesome Claude Skills, resources, and tools for customizing Claude AI workflows

The most comprehensive Claude Skills resource list; connect-apps is a killer feature.

19.9k2.0k3 days ago
Recommended
oh-my-opencode

code-yeongyu/oh-my-opencode

code-yeongyu

The Best Agent Harness. Meet Sisyphus: The Batteries-Included Agent that codes like you.

Powerful multi-agent coding tool, but note OAuth limitations.

17.5k1.2k3 days ago
Recommended
claude-mem

thedotmack/claude-mem

thedotmack

A Claude Code plugin that automatically captures everything Claude does during your coding sessions, compresses it with AI (using Claude's agent-sdk), and injects relevant context back into future sessions.

A practical solution for Claude's memory issues.

14.0k9143 days ago
Highly Recommended
planning-with-files

OthmanAdi/planning-with-files

OthmanAdi

Claude Code skill implementing Manus-style persistent markdown planning — the workflow pattern behind the $2B acquisition.

Context engineering best practices; an open-source implementation of Manus mode.

9.3k8113 days ago
Highly Recommended
Skill_Seekers

yusufkaraaslan/Skill_Seekers

yusufkaraaslan

Convert documentation websites, GitHub repositories, and PDFs into Claude AI skills with automatic conflict detection

An automation powerhouse for skill creation, dramatically improving efficiency.

6.8k6833 days ago