Skip to content
Productivity
Skill

/wechat-publisher

【公众号发布助手】将 WPS 笔记排版并导出为微信公众号 HTML。 当用户说"发公众号""排版公众号""导出到公众号""我要发布了""文章排版""发一下""排版这篇文章"时使用。 这是创作流程的最后一步:内容已完成,需要排版发布到公众号。 核心能力:1)自动套用排版模板 2)占位符标签转样式 3)生成可直接粘贴的 HTML。 输入:WPS 笔记 ID(内容已完成的笔记)。输出:带内联样式的 HTML 文件。 不要用于创作内容,只用于已完成的排版发布。

BOOST
From plugin
wpsnote-skills
18037 skills
Install
$ npx -y skills add wpsnote/wpsnote-skills --skill wechat-publisher --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/wechat-publisher

Context preview

The summary Claude sees to decide when to auto-load this skill.

【公众号发布助手】将 WPS 笔记排版并导出为微信公众号 HTML。 当用户说"发公众号""排版公众号""导出到公众号""我要发布了""文章排版""发一下""排版这篇文章"时使用。 这是创作流程的最后一步:内容已完成,需要排版发布到公众号。 核心能力:1)自动套用排版模板 2)占位符标签转样式 3)生成可直接粘贴的 HTML。 输入:WPS 笔记 ID(内容已完成的笔记)。输出:带内联样式的 HTML 文件。 不要用于创作内容,只用于已完成的排版发布。

SKILL.md

wechat-publisher.SKILL.md
name: wechat-publisher
description: |
  【公众号发布助手】将 WPS 笔记排版并导出为微信公众号 HTML。
  当用户说"发公众号""排版公众号""导出到公众号""我要发布了""文章排版""发一下""排版这篇文章"时使用。
  这是创作流程的最后一步:内容已完成,需要排版发布到公众号。
  核心能力:1)自动套用排版模板 2)占位符标签转样式 3)生成可直接粘贴的 HTML。
  输入:WPS 笔记 ID(内容已完成的笔记)。输出:带内联样式的 HTML 文件。
  不要用于创作内容,只用于已完成的排版发布。
metadata:
  version: "1.1.0"
  category: publishing
  tags: [wechat, publishing, html-export, content-formatting]
  dependencies: [wps-note]

WeChat Publisher - 公众号发布助手

将已完成的 WPS 笔记内容,一键排版并导出为微信公众号 HTML 格式。这是创作流程的最后一步:内容已完成,只需排版发布。

使用场景

**典型工作流**: 1. 用 `content-creator` 创作文章内容 2. 保存到 WPS 笔记 3. **用本 skill 导出排版好的 HTML** ← 你在这里 4. 粘贴到公众号后台直接发布

---

Contract(契约)

Input Contract

**触发条件**:

  • "发公众号"
  • "排版公众号"
  • "导出到公众号"
  • "我要发布了"
  • "文章排版"
  • "生成公众号 HTML"
  • "这篇可以发了"
  • "帮我排版一下"

**输入类型**: 1. **WPS 笔记 ID**(必填):内容已完成的笔记 2. **模板名称**(可选):`default`/`minimal`/`elegant`,默认 `blue-theme` 3. **输出路径**(可选):默认生成 `{标题}_formatted.html`

**前置条件**:

  • 笔记内容已完成(不是空笔记)
  • 笔记已保存并同步到云端
  • 内容建议 < 20000 字符

Output Contract

| 文件 | 说明 | |------|------| | `{标题}_formatted.html` | 带内联样式的公众号排版文件,可直接粘贴到公众号编辑器 |

**排版特性**:

  • WPS 笔记 XML **直接转 HTML**(无 Markdown 中间层,样式精度更高)
  • WPS 预设颜色(fontColor / fontHighlightColor)完整映射到内联样式
  • 代码块语法高亮
  • 图片自适应处理
  • 移动端阅读优化

Error Contract

| 错误场景 | 错误码 | 处理方式 | |---------|--------|----------| | 笔记不存在 | `NOTE_NOT_FOUND` | 检查 note_id 是否正确 | | 笔记为空 | `EMPTY_CONTENT` | 提示先完成内容创作 | | 内容过长 | `CONTENT_TOO_LONG` | 建议拆分为多篇发布 | | 图片处理失败 | `IMAGE_ERROR` | 检查图片链接有效性 |

---

工具优先级策略

**优先使用 CLI,降级到 MCP**:

检查 wpsnote-cli 是否可用
    ↓ 可用(推荐路径)
wpsnote-cli current / find  → 获取笔记 ID
wpsnote-cli read --note_id <id> --json → 获取笔记内容(XML)
    ↓ CLI 不可用(命令不存在 / 认证失败)
[降级] MCP: get_current_note / search_notes
[降级] MCP: read_note

**AI 操作决策树**:

用户触发「排版发布」
    │
    ├─ 检测 wpsnote-cli
    │       ↓ 可用
    │   ① 无 note_id → wpsnote-cli current --json
    │     有 note_id → 直接跳到 ③
    │       ↓ 不可用
    │   ① 无 note_id → MCP: get_current_note()
    │
    ├─ ② 搜索确认(用户给了关键词)
    │     CLI:  wpsnote-cli find --keyword "xxx" --json
    │     MCP:  search_notes({ keyword: "xxx" })
    │
    ├─ ③ 读取笔记内容
    │     CLI:  wpsnote-cli read --note_id <id> --json
    │     MCP:  read_note({ note_id: <id> })
    │
    └─ ④ 执行导出脚本
          python scripts/export-to-html.py --note-id <id>
          → 生成 "{标题}_formatted.html"

---

快速开始

方式一:CLI 读取 + 脚本转换(推荐)

# 获取当前笔记并导出
python scripts/export-to-html.py --current

# 通过 note_id 直接导出
python scripts/export-to-html.py --note-id "abc123"

# 指定模板风格
python scripts/export-to-html.py --note-id "abc123" --template "elegant"

# 搜索笔记并导出
python scripts/export-to-html.py --search "文章标题"

Python API

from scripts.export_to_html import WPSNoteExporter

exporter = WPSNoteExporter()
exporter.export(
    note_id="abc123",
    template_name="default",
    output_path="./article.html"
)

方式二:MCP 工具方式(CLI 不可用时降级)

通过 `wps-note` SKILL 的 MCP 工具读取笔记内容,再转换为 HTML:

# 1. 搜索并获取笔记
search_notes({ keyword: "文章标题" }) → note_id

# 2. 读取笔记内容
read_note({ note_id }) → xml_content

# 3. 转换为 HTML(本地脚本处理)
python scripts/export-to-html.py --note-id <id>

完整 MCP 工作流示例

# 步骤 1:获取当前笔记(或搜索)
get_current_note()
→ { note_id: "abc123", title: "AI 工具介绍", word_count: 3500 }

# 步骤 2:读取笔记内容(根据大小选择方式)
get_note_outline({ note_id: "abc123" })
→ blocks: [...]

read_note({ note_id: "abc123" })
→ xml_content: "<h1>AI 工具介绍</h1><p>...</p>"

# 步骤 3:导出为 HTML(本地脚本转换)
python scripts/export-to-html.py --note-id "abc123" --template blue-theme
→ 生成 "AI 工具介绍_formatted.html"

---

占位符标签(快速排版)

在 WPS 笔记中使用这些标签,导出时自动转换为对应样式:

| 标签 | 用法 | 效果 | |------|------|------| | `<b/>` | `<b/>文字</b>` | 橙色加粗(整段或行内) | | `<h2/>` | `<h2/>大标题</h2>` | 蓝色大标题(一级章节) | | `<h3/>` | `<h3/>小标题</h3>` | 蓝色小标题(二级分节) | | `<bq/>` | `<bq/>引用文字</bq>` | 灰底蓝边引用块 | | `<note/>` | `<note/>注释文字</note>` | 灰色小字注释 |

**使用示例**:

<h2/>01|核心观点

<b/>整段橙色加粗,适合核心金句。</b>

<b/>行内加粗</b> 用于强调重点词汇。

<h3/>深入分析

正文段落正常书写...

<bq/>引用块适合摘录观点或补充说明。</bq>

<note/>注:本文仅代表个人观点。</note>

---

WPS 笔记颜色 → HTML 颜色映射

WPS 笔记的 XML 中颜色受**预设色板**约束,导出时按下表映射为公众号内联样式 RGB 值:

fontColor(字体颜色)

| WPS XML 值 | 含义 | HTML 输出 | |-----------|------|----------| | `#080F17` | 黑色 | `color: rgb(8,15,23)` | | `#C21C13` | 红色 | `color: rgb(194,28,19)` | | `#DB7800` | 橙色 | `color: rgb(219,120,0)` | | `#078654` | 绿色 | `color: rgb(7,134,84)` | | `#0E52D4` | 蓝色 | `color: rgb(14,82,212)` | | `#0080A0` | 浅蓝 | `color: rgb(0,128,160)` | | `#757575` | 灰色 | `color: rgb(117,117,117)` | | `#DA326B` | 粉色 | `color: rgb(218,50,107)` | | `#D1A300` | 金色 | `color: rgb(209,163,0)` | | `#58A401` | 浅绿 | `color: rgb(88,164,1)` | | `#116AF0` | 亮蓝 | `color: rgb(17,106,240)` | | `#A639D7` | 紫色 | `color: rgb(166,57,215)` |

fontHighlightColor(文字背景高亮)

| WPS XML 值 | 含义 | HTML 输出 | |-----------|------|----------| | `#FBF5B3` | 黄色 | `background-color: rgb(251,245,179); padding:0 2px; border-radius:2px` | | `#F8D7B7` | 橙色 | `background-color: rgb(248,215,183); ...` | | `#F7C7D3` | 粉色 | `background-color: rgb(247,199,211); ...` | | `#DFF0C4` | 绿色 | `background-color: rgb(223,240,196); ...` | | `#C6EADD` | 深绿 | `background-color: rgb(198,234,221); ...` | | `#D9EEFB` | 蓝色 | `background-color: rgb(217,238,251); ...` | | `#D5DCF7` | 浅蓝 | `background-color: rgb(213,220,247); ...` | | `#E6D6F0` | 紫色 | `background-color: rgb(230,214,240); ...` | | `#E6E6E6` | 灰色 | `background-color: rgb(230,230,230); ...` |

> **注意**:任意 hex 色值在 WPS 编辑器中会被静默丢弃,导出脚本只处理上述预设色板中的颜色,其他值忽略不渲染。

---

模板风格

| 模板 | 特点 | 适用场景 | |------|------|----------| | `blue-theme` ⭐默认 | 蓝色强调色,现代简洁 | 科技、企业、正式文档 | | `default` | 橙色风格,专业美观 | 通用场景 | | `minimal` | 极简风格,干净利落 | 技术文档、教程 | | `elegant` | 优雅精致,细节丰富 | 深度长文、品牌内容 |

blue-theme 蓝色主题

基于样本 HTML 的蓝色主题,特点:

  • **主色**: `rgb(36, 91, 219)` 深蓝色
  • **正文字号**: 15px(比默认更小更紧凑)
  • **行距**: 2.0(更舒适的可读性)
  • **引用块**: 左边框 3px + 浅灰背景
  • **分栏**: Flex 布局,居中对齐

使用方法:

python scripts/export-to-html.py --note-id "abc123" --template blue-theme

---

与 content-creator 的组合

创作流程:
Read more
Ships withwpsnote-skills

笔记,是思想落地的地方。 本仓库以 wps-note 为基础能力底座,让 Claude Code、Cursor、OpenClaw 等主流 AI Agent 直接驱动 WPS 笔记——往里写、从里读、让它有序、让它被找到。 笔记不再是你自己整理的地方,而是 Agent 替你打理的记忆层。

Get the whole plugin

Other skills on wpsnote-skills.

class-note-builder
Skill

class-note-builder

当用户希望把课堂逐字稿、OCR 笔记、截图资料或零散学习内容整理成结构化的 WPS 学习笔记时使用此 Skill。适合课堂记录整理、培训复盘、补课笔记汇总、课程主笔记构建等场景,尤其适合原始材料很乱、但最终需要一篇可复习、可回看、可继续补充的主笔记时。

coding-assistant
Skill

coding-assistant

多平台编码助手。遵循各平台官方文档做编码规范、单测与编译/lint;协助将核心技术梳理为完整 WPS 笔记技术文档。生成的笔记必须包含 7…

content-creator
Skill

content-creator

【内容创作起点】用户想要写文章/公众号/文案时的首选skill。 触发词:"帮我写""我想写""准备写""开始写""写个文章""写篇稿子""写公众号""写小红书""仿照这个风格写""分析我的写作风格""提取写作模板"。…

content-digest
Skill

content-digest

将任意内容提炼为结构化知识笔记,自动保存到 WPS 笔记。只要用户给出任何内容(链接、图片、本地文件、粘贴文字)并有保存笔记的意图,就应使用此…

doc-importer
Skill

doc-importer

将本地文档批量导入到 WPS 笔记。支持扫描 Obsidian Vault、思源笔记、微信公众号存档、 下载目录或任意用户指定目录,自动识别 HTML、Markdown、PDF、DOCX、PPTX、XLSX 等格式, 转换为 WPS…