快速集成微信 Markdown 编辑器 API,实现自动化内容转换和批量处理
https://www.md2wechat.com/api
application/json
所有 API 请求都需要有效的 API Key。请在请求头中包含认证信息。
X-API-Key: wme_your_api_key_here
Authorization: Bearer wme_your_api_key_here
请联系极客杰尼获取 API Key。API Key 以 wme_
前缀开头, 请妥善保管,不要在客户端代码中暴露。
将 Markdown 文本转换为微信公众号格式的 HTML。
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
markdown | string | 必填 | 要转换的 Markdown 文本内容 |
theme | string | 可选 | 主题名称,默认为 "default" |
{ "markdown": "# Hello World\n\n这是一个**加粗**的文本。", "theme": "default" }
{ "code": 0, "msg": "success", "data": { "html": "<section style=\"...\">...</section>", "theme": "default", "wordCount": 156, "estimatedReadTime": 1 } }
curl -X POST "https://www.md2wechat.com/api/convert" \ -H "Content-Type: application/json" \ -H "X-API-Key: wme_your_api_key_here" \ -d '{ "markdown": "# 标题\n\n这是一个**加粗**文本的例子。", "theme": "default" }'
const response = await fetch('https://www.md2wechat.com/api/convert', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': 'wme_your_api_key_here' }, body: JSON.stringify({ markdown: '# 标题\n\n这是一个**加粗**文本的例子。', theme: 'default' }) }) const result = await response.json() if (result.code === 0) { console.log('转换成功:', result.data.html) } else { console.error('转换失败:', result.msg) }
import requests url = "https://www.md2wechat.com/api/convert" headers = { "Content-Type": "application/json", "X-API-Key": "wme_your_api_key_here" } data = { "markdown": "# 标题\n\n这是一个**加粗**文本的例子。", "theme": "default" } response = requests.post(url, headers=headers, json=data) result = response.json() if result["code"] == 0: print("转换成功:", result["data"]["html"]) else: print("转换失败:", result["msg"])
参数缺失或格式错误
API Key 无效或缺失
超出速率限制
内部处理异常
{ "code": 400, "msg": "Markdown content is required." }