Skip to content
Back to search

mopai

MarketplaceWorks with Claude CodeGitHub

墨排:Markdown → 公众号排版 / 小红书卡片 / X 推文串

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/woodti--mopai/badge.svg)](/listings/woodti--mopai)

HTML

<a href="/listings/woodti--mopai"><img src="/api/listings/woodti--mopai/badge.svg" alt="findsafeskills safety rating" /></a>

Install

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 18 lines
  1. {
  2. "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
  3. "name": "mopai",
  4. "description": "墨排:Markdown → 公众号排版 / 小红书卡片 / X 推文串",
  5. "owner": {
  6. "name": "woodti",
  7. "url": "https://github.com/woodti"
  8. },
  9. "plugins": [
  10. {
  11. "name": "mopai",
  12. "description": "把 Markdown 或 GitHub 仓库变成公众号排版、小红书卡片和 X 推文串。包含写作指南 Skill 和 MCP 渲染工具。",
  13. "source": "./",
  14. "category": "productivity",
  15. "homepage": "https://github.com/woodti/mopai"
  16. }
  17. ]
  18. }
README.md · README · 204 lines
  1. <div align="center">
  2. # 墨排 Mopai
  3. **写一次 Markdown,同时发公众号、小红书和 X。**
  4. 一键复制到微信公众号,样式不丢;同一篇文章自动分页,导出小红书图文卡片;也能拆成 X(Twitter)推文串。
  5. 纯前端 · 不用注册 · 内容不上传 · MIT 开源
  6. **还能让 AI 直接用:** AI Skill + MCP + 命令行,一句话把文章或 GitHub 仓库变成全套推广素材。
  7. [在线使用](https://woodti.github.io/mopai/) · [English](#english)
  8. <a href="https://linux.do/"><img alt="LINUX DO" src="https://img.shields.io/badge/LINUX%20DO-%E6%96%B0%E7%9A%84%E7%90%86%E6%83%B3%E5%9E%8B%E7%A4%BE%E5%8C%BA-f8c12c"></a>
  9. </div>
  10. <p align="center"><img src="docs/demo.gif" alt="墨排演示:写 Markdown,切换主题,复制到公众号,生成小红书卡片,拆成 X 推文串" width="900"></p>
  11. ## 功能
  12. **公众号排版**
  13. - 所有样式写成内联样式,粘贴到公众号后台不丢格式
  14. - 5 套主题:简约、胶囊、雅致、马克笔、极客,主色随意换
  15. - 代码块语法高亮,可选 Mac 风格窗口和深色配色,换行和缩进粘贴后保留
  16. - 外链自动转为文末脚注(公众号正文里的外链点不开)
  17. - 支持表格、任务列表、引用、图片说明
  18. **小红书卡片**
  19. - 按卡片高度自动分页:长段落按句子拆开,长代码按行拆开,长列表和表格按项拆开,序号跨页连续
  20. - 第一个一级标题自动生成封面,下一行的短句作为副标题
  21. - 3:4、1:1、9:16 三种尺寸,导出 1080px 宽高清 PNG
  22. - 米白纸、纯白、方格本、主色浅底、夜读 5 种背景
  23. - 单独一行 `---` 手动分页
  24. - 单张下载或批量导出 ZIP
  25. **X 推文串**
  26. - 按 X 的计数规则拆条:中文和 emoji 算 2,链接固定算 23,每条不超过 280
  27. - 优先按段落拆,太长再按句子拆;标题和后面的正文放在同一条
  28. - 粗体、斜体转成 Unicode 粗体字符(英文和数字),X 上也能显示
  29. - 可以加 `1/n` 编号和首条 🧵,每条单独复制,已复制的打勾
  30. - Premium 用户可以切换成长推,不拆分
  31. ## 让 AI 帮你推广:Skill、MCP 和命令行
  32. <p align="center"><img src="docs/cli-demo.gif" alt="命令行一行生成仓库推广素材;接入 MCP 后一句话生成卡片;装上 Skill 后 AI 自己写文案、出图、检查" width="900"></p>
  33. ### AI Skill(推荐)
  34. 一个装好就能用的 Skill,教 AI 怎么给每个平台写文案(小红书封面钩子、每张卡片放多少内容、推文串怎么开头),再调用墨排出图。装好后直接说「帮我把 owner/repo 做成小红书推广卡片」就行。
  35. **Claude Code**:插件里同时包含 Skill 和 MCP,一条命令装好:
  36. ```
  37. /plugin install mopai --marketplace woodti/mopai
  38. ```
  39. 旧版本 Claude Code 分两步:`/plugin marketplace add woodti/mopai`,再 `/plugin install mopai@mopai`。
  40. **Cursor、Codex 等支持 Agent Skills 的工具**:
  41. ```bash
  42. npx skills add woodti/mopai
  43. ```
  44. Skill 内容见 [`skills/mopai/SKILL.md`](skills/mopai/SKILL.md)。
  45. ### 命令行
  46. ```bash
  47. # 一篇 Markdown → 公众号排版 + 小红书卡片 + X 推文串
  48. npx mopai-cli post.md
  49. # 一个 GitHub 仓库 → 全套推广素材(推广文案、卡片、推文串)
  50. npx mopai-cli repo owner/repo
  51. # 只要小红书卡片,换个主题和背景
  52. npx mopai-cli post.md --only xhs --theme marker --color orange --bg grid --author @你的名字
  53. ```
  54. 输出在 `./mopai-out/<标题>/` 下:
  55. | 文件 | 用法 |
  56. | --- | --- |
  57. | `wechat.html` | 用浏览器打开,点「复制到公众号」,去后台粘贴 |
  58. | `xiaohongshu/01.png …` | 小红书卡片,1080px 宽 |
  59. | `x-thread.txt` | 推文串,每条之间用分隔线隔开 |
  60. | `source.md` | `repo` 命令生成的推广文案,改完后可以用 `npx mopai-cli source.md` 重新生成 |
  61. Markdown 里的本地图片和网络图片都会自动嵌入,没有跨域问题。运行 `npx mopai-cli --help` 查看全部选项。
  62. ### MCP:在 Claude、Cursor 里直接用
  63. 只要工具、不要写作指南的话,可以单独接入 MCP(装了上面的 Claude Code 插件就不用再装)。
  64. Claude Code:
  65. ```bash
  66. claude mcp add mopai -- npx -y mopai-cli mcp
  67. ```
  68. Claude Desktop、Cursor 等客户端,在 MCP 配置里加上:
  69. ```json
  70. {
  71. "mcpServers": {
  72. "mopai": { "command": "npx", "args": ["-y", "mopai-cli", "mcp"] }
  73. }
  74. }
  75. ```
  76. 然后就可以直接说:
  77. > 读一下 woodti/mopai 这个仓库,写一篇口语化的小红书推广文案,生成卡片,再拆一版 X 推文串。
  78. | 工具 | 作用 |
  79. | --- | --- |
  80. | `get_github_repo` | 读取仓库信息、README 和推广草稿,AI 据此改写文案 |
  81. | `render_xiaohongshu_cards` | Markdown → 小红书卡片 PNG,同时返回封面预览 |
  82. | `render_wechat_article` | Markdown → 带复制按钮的公众号排版页面 |
  83. | `render_x_thread` | Markdown → X 推文串 |
  84. | `promote_github_repo` | 一步到位:仓库 → 全套推广素材 |
  85. **环境要求**:Node.js 18+。生成卡片和公众号排版需要本机装有 Chrome 或 Edge;都没有的话,运行 `npx playwright install chromium`,或者用环境变量 `MOPAI_CHROME` 指定浏览器路径。读取仓库时可以设置 `GITHUB_TOKEN`,避开 GitHub 接口每小时 60 次的限制。
  86. ## 本地运行
  87. 需要 Node.js 20 或更高版本。
  88. ```bash
  89. npm install
  90. npm run dev
  91. ```
  92. 构建产物在 `dist/`,可以部署到任意静态托管(GitHub Pages、Vercel、Netlify、Cloudflare Pages、EdgeOne)。仓库已经带了 GitHub Pages 的 Actions 配置,推送到 `main` 后会自动部署。启用方法:仓库的 Settings → Pages → Source 选 **GitHub Actions**。
  93. ## 代码结构
  94. | 文件 | 作用 |
  95. | --- | --- |
  96. | `src/markdown.ts` | Markdown → 带内联样式的 HTML:清理、代码高亮、脚注、公众号兼容处理 |
  97. | `src/themes.ts` | 主题样式表、代码配色 |
  98. | `src/cards.ts` | 小红书卡片分页引擎:在隐藏容器里实测高度,按块和句子拆分 |
  99. | `src/CardsView.tsx` | 卡片渲染与 PNG / ZIP 导出 |
  100. | `src/tweets.ts` | Markdown → X 推文串:加权计数、拆条、Unicode 粗体 |
  101. | `src/XView.tsx` | 推文串预览与逐条复制 |
  102. | `src/App.tsx` | 编辑器、预览、设置面板 |
  103. | `src/repo.ts` | GitHub 仓库 → 推广文案 |
  104. | `src/headless.tsx` | 无头渲染入口,命令行和 MCP 通过它调用排版引擎 |
  105. | `cli/` | 命令行、MCP 服务器、本地渲染(无头浏览器) |
  106. | `skills/mopai/SKILL.md` | AI Skill:各平台写作指南和使用流程 |
  107. | `.claude-plugin/` | Claude Code 插件和插件市场配置 |
  108. ## 加一套主题
  109. 在 `src/themes.ts` 的 `THEMES` 里加一项,再在 `buildStyles` 的 `switch` 里覆盖需要改的元素样式(`h1`、`h2`、`blockquote`、`strong` 等)。欢迎 PR。
  110. ## 已知限制
  111. - 小红书卡片里的网络图片需要图源允许跨域,否则导出时图片会缺失
  112. - 本地图片还不能直接粘贴到编辑器(在计划中)
  113. ## 路线图
  114. - [ ] 粘贴 / 拖入本地图片
  115. - [ ] 更多卡片模板
  116. - [ ] 自定义 CSS 主题
  117. - [ ] 数学公式、Mermaid 图表
  118. ---
  119. ## English
  120. **Mopai** turns one Markdown article into three outputs:
  121. - **WeChat Official Account**: rich text with every style inlined, so it survives pasting into the WeChat editor. Includes 5 themes, syntax-highlighted code blocks, and external links converted to footnotes.
  122. - **Xiaohongshu (RedNote) carousel cards**: content auto-paginated by measured height (paragraphs split by sentence, code by line, lists by item). Exports 1080px PNG files one at a time or as a ZIP.
  123. - **X (Twitter) threads**: split by X's weighted character count (CJK counts as 2, URLs as 23), with `1/n` numbering and Unicode bold, plus copy buttons for each tweet.
  124. Everything runs in the browser. Nothing is uploaded.
  125. **For AI agents and the command line**, Mopai also ships a CLI and an MCP server:
  126. ```bash
  127. npx mopai-cli post.md # WeChat HTML + Xiaohongshu PNG cards + X thread
  128. npx mopai-cli repo owner/repo # promo kit for any GitHub repository
  129. claude mcp add mopai -- npx -y mopai-cli mcp
  130. ```
  131. Agent skill: `/plugin install mopai --marketplace woodti/mopai` in Claude Code, or `npx skills add woodti/mopai` for other agents.
  132. MCP tools: `get_github_repo`, `render_xiaohongshu_cards`, `render_wechat_article`, `render_x_thread`, `promote_github_repo`. Rendering needs a local Chrome or Edge, or run `npx playwright install chromium`.
  133. ## 致谢
  134. 本项目分享于 [LINUX DO](https://linux.do/) —— 真诚、友善、团结、专业的技术社区。
  135. ## License
  136. [MIT](LICENSE)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.