技能图谱SKILLSGROVE
技能图谱/短视频与自媒体/brycewang-stanford/md2/md2

md2

安装

$npx skills add https://github.com/brycewang-stanford/md2 --skill md2
$git clone --depth 1 https://github.com/brycewang-stanford/md2.git /tmp/md2 && mkdir -p ~/.claude/skills && cp -r /tmp/md2/skills/md2 ~/.claude/skills/md2
请帮我安装这个 Agent Skill:https://github.com/brycewang-stanford/md2/tree/5107ccf2088535db441fb8eeec42beb67a1c712f/skills/md2 ,先阅读它的 SKILL.md 和脚本,确认安全后再安装到我的技能目录。

简介

原文描述 · MITTurn a Markdown article into platform-ready output — WeChat Official Account (公众号) rich text or draft, Zhihu (知乎) article HTML, Xiaohongshu (小红书) 3:4 image cards with caption, an X/Twitter thread, and cover images in every platform size. Use when the user wants to publish, format, typeset (排版), or convert Markdown for 公众号 / 知乎 / 小红书 / X / Twitter, make a 封面 / cover, or split an article into a thread.
以下 SKILL.md 内容转载自 brycewang-stanford/md2(提交 5107ccf),依据 MIT 许可证转载正文(文字未改动;仅省略文件头元数据、将图片显示为链接,超长内容会截断);版权归 2026 Bryce Wang and md2 contributors 所有。许可证:LICENSE。仅展示说明文件,附带脚本请在原仓库查看。

md2 — Markdown → 公众号 · 知乎 · 小红书 · X

md2 is a CLI (npm package md2all) and an MCP server. Prefer the CLI from a shell:

md2 <command> ...   # after `npm link` in packages/cli; or: node <repo>/packages/cli/dist/cli.js <command>

Pick the command

Goal Command
WeChat rich text on the clipboard md2 wechat post.md --copy -t claude
WeChat HTML file md2 wechat post.md -o out/wechat.html
Create a WeChat draft (uploads images + cover) md2 publish wechat post.md (needs MD2_WECHAT_APPID, MD2_WECHAT_SECRET, whitelisted IP)
Zhihu rich text on the clipboard md2 zhihu post.md --copy
XHS 1080×1440 cards + caption.txt md2 xhs post.md -o out/xhs -s clean -a "@name"
Thread for X / Threads / Bluesky / Mastodon / LinkedIn md2 thread post.md -p x (-p linkedin for one long post, --limit 25000 for X Premium, --json)
One tall image (长图) md2 long post.md -t claude -o long.png
AI copy (needs ANTHROPIC_API_KEY or MD2_AI_*) `md2 ai xhs
Cover image md2 cover post.md -s wechat -t aurora -o cover.png
See every theme / style / template / size md2 themes

Image commands (xhs, long, cover, Mermaid diagrams, generated covers in publish) need Chrome, Edge, or npx playwright install chromium. Fine-tuning flags work on wechat / xhs / long: --indent --justify --line-height 1.9 --para-spacing 1.4 --css extra.css.

Front matter md2 understands

---
title: 文章标题            # falls back to the first H1
subtitle: 副标题           # covers
author: 作者
tags: [AI, 效率]           # XHS hashtags, X hashtags, cover chips
description: 摘要          # WeChat digest, X hook
cover: ./cover.png        # WeChat draft cover (else first image, else generated)
xhs:
  title: ≤20 字的小红书标题
  body: 自定义小红书正文(可选)
---

Writing tips that render well everywhere

  • > [!TIP] / [!NOTE] / [!WARNING] / [!IMPORTANT] / [!CAUTION] → styled callouts.
  • $inline$ and $$block$$ math → SVG on WeChat, native formulas on Zhihu.
  • Footnotes [^1] → numbered references (Zhihu: native 参考文献).
  • External links become numbered references on WeChat automatically (WeChat blocks outside links).
  • --- starts a new XHS card. Keep XHS titles ≤ 20 chars, body ≤ 1000.
  • ```mermaid diagrams become inline SVG (WeChat-safe); Zhihu keeps them as code.

Themes (choose by tone)

claude (warm, serif), linear (product), geist (mono B/W), apple (big type), editorial (long-read serif), swiss (grid, red), brutal (neo-brutalism), bento (soft cards), aurora (gradients), midnight (dark), matcha, wabi (Japanese calm), distill (academic), coral (lifestyle), stripe (dev docs), song (Chinese serif). Override the accent with --color "#hex"; code themes via --code-theme.

MCP

md2 mcp exposes md2_wechat, md2_zhihu, md2_thread, md2_xhs_cards, md2_long_image, md2_cover, md2_ai, md2_publish_wechat_draft, md2_list_styles. Publishing only ever creates a draft; never claim an article was published publicly.

查看许可证全文(MIT)
MIT License

Copyright (c) 2026 Bryce Wang and md2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
查看 NOTICE 声明
md2 — Markdown → WeChat / Zhihu / Xiaohongshu / X
Copyright (c) 2026 Bryce Wang and md2 contributors. Licensed under MIT.

Acknowledgements
----------------
- The list of code-block languages Zhihu recognises (packages/core/src/platforms/zhihu.ts)
  is adapted from marsggbo/markdown2anything (MIT License,
  https://github.com/marsggbo/markdown2anything).
- Ideas from doocs/md (WTFPL) and the wider Markdown-to-WeChat community informed the
  WeChat rendering approach (inline styles, SVG formulas, link footnotes). No code copied.
- Code colour palettes follow the public palettes of GitHub Primer, Vitesse (Anthony Fu),
  Tokyo Night (enkia), Catppuccin and Rosé Pine (all MIT).

Bundled / runtime dependencies keep their own licenses: unified/remark/rehype (MIT),
MathJax (Apache-2.0), highlight.js via lowlight (BSD-3-Clause), PostCSS (MIT),
CodeMirror (MIT), React (MIT), html-to-image (MIT), JSZip (MIT/GPLv3 dual — used under MIT),
Playwright (Apache-2.0), Model Context Protocol SDK (MIT).