Jim Liu 寶玉

Baoyu Markdown To Html

內容創作v1.117.3
作者:Jim Liu 寶玉更新於 2026-06-01共 11 個版本 · 最新版本釋出於 2026-06-01baoyu-markdown-to-html@clawhub_jimliu/baoyu-markdown-to-html
文章寫作#WeChat#微信

據 AlphaMoat 統計,截至 2026-10,Baoyu Markdown To Html 累計下載 9,648 次、獲 3 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 2,845 位,在「內容創作」分類(927 個)中排名第 285 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
9648
星標
3
全站下載量排名
#2,845
全站前 27% · 「內容創作」前 31%
平台累計下載星標評論
ClawHub ↗47502-
SkillHub ↗96483—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

支援程式碼、公式、圖表及可選的外部連結底部引用。使用 Bun 或 npx 回退;Mermaid 圖片渲染需支援的瀏覽器,否則回退為標記。HTML 寫在原始檔旁,衝突時備份。轉換前檢查遠端圖片連結和輸出路徑。

資料釋出於 2026-10-27

可以用來做什麼

  • 準備帶樣式的文章 HTML

什麼時候用

  • Markdown 需要微信公眾號相容排版時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

按所選主題轉換這份 Markdown,除非明確要求否則關閉底部引用。

月度資料趨勢

累計下載9648
72855191萬2026-03 · 累計下載 13892026-05 · 累計下載 31422026-06 · 累計下載 35632026-07 · 累計下載 40882026-08 · 累計下載 46062026-09 · 累計下載 57662026-10 · 累計下載 964826-0326-0926-10
星標3
0232026-03 · 星標 -2026-05 · 星標 22026-06 · 星標 22026-07 · 星標 22026-08 · 星標 22026-09 · 星標 32026-10 · 星標 326-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-109648—3
2026-095766—3
2026-084606+12.7%2
2026-074088+14.7%2
2026-063563+13.4%2
2026-053142—2
2026-031389—-

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

9.8 KB · ClawHub v1.117.3
---
name: baoyu-markdown-to-html
description: Converts Markdown to styled HTML with WeChat-compatible themes. Supports code highlighting, math, Mermaid (rendered to PNG via headless Chrome), PlantUML, footnotes, alerts, infographics, and optional bottom citations for external links. Use when user asks for "markdown to html", "convert md to html", "md 转 html", "微信外链转底部引用", or needs styled HTML output from markdown.
version: 1.117.3
metadata:
  openclaw:
    homepage: https://github.com/JimLiu/baoyu-skills#baoyu-markdown-to-html
    requires:
      anyBins:
        - bun
展開全部(共 256 行)
        - npx
---

# Markdown to HTML Converter

Converts Markdown files to beautifully styled HTML with inline CSS, optimized for WeChat Official Account and other platforms.

## User Input Tools

When this skill prompts the user, follow this tool-selection rule (priority order):

1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.
2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.

Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.

## Script Directory

**Agent Execution**: Determine this SKILL.md directory as `{baseDir}`. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun. Replace `{baseDir}` and `${BUN_X}` with actual values.

| Script | Purpose |
|--------|---------|
| `scripts/main.ts` | Main entry point |

## Preferences (EXTEND.md)

Check EXTEND.md in priority order — the first one found wins:

| Priority | Path | Scope |
|----------|------|-------|
| 1 | `.baoyu-skills/baoyu-markdown-to-html/EXTEND.md` | Project |
| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-markdown-to-html/EXTEND.md` | XDG |
| 3 | `$HOME/.baoyu-skills/baoyu-markdown-to-html/EXTEND.md` | User home |

If none found, use defaults.

**EXTEND.md supports**: default theme, custom CSS variables, code block style, mermaid defaults (`mermaid_theme`, `mermaid_scale`, `mermaid_background`).

## Workflow

### Step 0: Pre-check (Chinese Content)

**Condition**: Only execute if input file contains Chinese text.

**Detection**:
1. Read input markdown file
2. Check if content contains CJK characters (Chinese/Japanese/Korean)
3. If no CJK content → skip to Step 1

**Format Suggestion**:

If CJK content detected AND `baoyu-format-markdown` skill is available:

Use `AskUserQuestion` to ask whether to format first. Formatting can fix:
- Bold markers with punctuation inside causing `**` parse failures
- CJK/English spacing issues

**If user agrees**: Invoke `baoyu-format-markdown` skill to format the file, then use formatted file as input.

**If user declines**: Continue with original file.

### Step 1: Determine Theme

**Theme resolution order** (first match wins):
1. User explicitly specified theme (CLI `--theme` or conversation)
2. EXTEND.md `default_theme` (this skill's own EXTEND.md, checked in Step 0)
3. `baoyu-post-to-wechat` EXTEND.md `default_theme` (cross-skill fallback)
4. If none found → use AskUserQuestion to confirm

**Cross-skill EXTEND.md check** (only if this skill's EXTEND.md has no `default_theme`):

Read `$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md` if it exists and look for a `default_theme:` line. Use the value if present; otherwise fall through.

**If theme is resolved from EXTEND.md**: Use it directly, do NOT ask the user.

**If no default found**: use `AskUserQuestion` to confirm a theme from the [Themes](#themes) table below.

### Step 1.5: Determine Citation Mode

**Default**: Off. Do not ask by default.

**Enable only if the user explicitly asks** for "微信外链转底部引用", "底部引用", "文末引用", or passes `--cite`.

**Behavior when enabled**:
- Ordinary external links are rendered with numbered superscripts and collected under a final `引用链接` section.
- `https://mp.weixin.qq.com/...` links stay as direct links and are not moved to the bottom.
- Bare links where link text equals URL stay inline.

### Step 2: Convert

```bash
${BUN_X} {baseDir}/scripts/main.ts <markdown_file> --theme <theme> [--cite]
```

### Step 3: Report Result

Display the output path from JSON result. If backup was created, mention it.

## Usage

```bash
${BUN_X} {baseDir}/scripts/main.ts <markdown_file> [options]
```

**Options:**

| Option | Description | Default |
|--------|-------------|---------|
| `--theme <name>` | Theme name (default, grace, simple, modern) | default |
| `--color <name\|hex>` | Primary color: preset name or hex value | theme default |
| `--font-family <name>` | Font: sans, serif, serif-cjk, mono, or CSS value | theme default |
| `--font-size <N>` | Font size: 14px, 15px, 16px, 17px, 18px | 16px |
| `--title <title>` | Override title from frontmatter | |
| `--cite` | Convert external links to bottom citations, append `引用链接` section | false (off) |
| `--keep-title` | Keep the first heading in content | false (removed) |
| `--mermaid-theme <name>` | Mermaid theme: `default`, `forest`, `dark`, `neutral`, `base` | default |
| `--mermaid-scale <N>` | Mermaid render scale (positive number ≤ 4) | 2 |
| `--mermaid-width <N>` | Mermaid target display width in CSS px; PNG is rendered at `width × scale` pixels when the diagram is narrower than this | 860 |
| `--mermaid-bg <value>` | Mermaid background: `white`, `transparent`, or `#hex` | white |
| `--no-mermaid` | Skip Mermaid PNG rendering; emit `<pre class="mermaid">` fallback | false |
| `--help` | Show help | |

**Color Presets:**

| Name | Hex | Label |
|------|-----|-------|
| blue | #0F4C81 | Classic Blue |
| green | #009874 | Emerald Green |
| vermilion | #FA5151 | Vibrant Vermilion |
| yellow | #FECE00 | Lemon Yellow |
| purple | #92617E | Lavender Purple |
| sky | #55C9EA | Sky Blue |
| rose | #B76E79 | Rose Gold |
| olive | #556B2F | Olive Green |
| black | #333333 | Graphite Black |
| gray | #A9A9A9 | Smoke Gray |
| pink | #FFB7C5 | Sakura Pink |
| red | #A93226 | China Red |
| orange | #D97757 | Warm Orange (modern default) |

**Examples:**

```bash
# Basic conversion (uses default theme, removes first heading)
${BUN_X} {baseDir}/scripts/main.ts article.md

# With specific theme
${BUN_X} {baseDir}/scripts/main.ts article.md --theme grace

# Theme with custom color
${BUN_X} {baseDir}/scripts/main.ts article.md --theme modern --color red

# Enable bottom citations for ordinary external links
${BUN_X} {baseDir}/scripts/main.ts article.md --cite

# Keep the first heading in content
${BUN_X} {baseDir}/scripts/main.ts article.md --keep-title

# Override title
${BUN_X} {baseDir}/scripts/main.ts article.md --title "My Article"
```

## Output

**File location**: Same directory as input markdown file.
- Input: `/path/to/article.md`
- Output: `/path/to/article.html`

**Conflict handling**: If HTML file already exists, it will be backed up first:
- Backup: `/path/to/article.html.bak-YYYYMMDDHHMMSS`

**JSON output to stdout:**

```json
{
  "title": "Article Title",
  "author": "Author Name",
  "summary": "Article summary...",
  "htmlPath": "/path/to/article.html",
  "backupPath": "/path/to/article.html.bak-20260128180000",
  "contentImages": [
    {
      "placeholder": "MDTOHTMLIMGPH_1",
      "localPath": "/path/to/img.png",
      "originalPath": "imgs/image.png"
    }
  ],
  "mermaidImages": [
    {
      "hash": "a1b2c3d4e5f6",
      "localPath": "/path/to/imgs/.mermaid-cache/mermaid-a1b2c3d4e5f6.png",
      "cached": false
    }
  ]
}
```

**Mermaid rendering**: Code blocks fenced as ` ```mermaid ` are rendered to PNGs via headless Chrome (CDP) and cached at `imgs/.mermaid-cache/mermaid-<hash>.png`. The cache key includes the code, theme, scale, target width, background, and mermaid version. Add `imgs/.mermaid-cache/` to `.gitignore` if you do not want generated diagrams checked in. Requires Chrome/Chromium/Edge on the system; otherwise the block falls back to `<pre class="mermaid">…</pre>` and conversion still succeeds.

## Themes

| Theme | Description |
|-------|-------------|
| `default` | Classic - traditional layout, centered title with bottom border, H2 with white text on colored background |
| `grace` | Elegant - text shadow, rounded cards, refined blockquotes (by @brzhang) |
| `simple` | Minimal - modern minimalist, asymmetric rounded corners, clean whitespace (by @okooo5km) |
| `modern` | Modern - large radius, pill-shaped titles, relaxed line height (pair with `--color red` for traditional red-gold style) |

## Supported Markdown Features

| Feature | Syntax |
|---------|--------|
| Headings | `# H1` to `###### H6` |
| Bold/Italic | `**bold**`, `*italic*` |
| Code blocks | ` ```lang ` with syntax highlighting |
| Inline code | `` `code` `` |
| Tables | GitHub-flavored markdown tables |
| Images | `![alt](src)` |
| Links | `[text](url)`; add `--cite` to move ordinary external links into bottom references |
| Blockquotes | `> quote` |
| Lists | `-` unordered, `1.` ordered |
| Alerts | `> [!NOTE]`, `> [!WARNING]`, etc. |
| Footnotes | `[^1]` references |
| Ruby text | `{base|annotation}` |
| Mermaid | ` ```mermaid ` blocks rendered to local PNG via headless Chrome (cached under `imgs/.mermaid-cache/`); falls back to `<pre class="mermaid">` if Chrome is unavailable or rendering fails |
| PlantUML | ` ```plantuml ` diagrams |

## Frontmatter

Supports YAML frontmatter for metadata:

```yaml
---
title: Article Title
author: Author Name
description: Article summary
---
```

If no title is found, extracts from first H1/H2 heading or uses filename.

## Extension Support

Custom configurations via EXTEND.md. See **Preferences** section for paths and supported options.

「內容創作」分類下的熱門技能

李白.Skill內容創作

李白.Skill:潤色專家 檢測並消除中文文字中的AI生成痕跡,將生硬的機器輸出轉化為自然流暢的人類文筆。融合規則檢測、分層改寫(詞彙→句式→內容→邏輯→語氣)和六步質控流水線,確保最終文字透過人工審查。

↓ 125萬★ 121user_741dc82b
libai-skill內容創作

李白.Skill:潤色專家 檢測並消除中文文字中的AI生成痕跡,將生硬的機器輸出轉化為自然流暢的人類文筆。融合規則檢測、分層改寫和質控流水線,確保最終文字透過人工審查。

↓ 101.8萬★ 11user_814dbe54
文章去AI味工具內容創作

識別並去掉文字里的 AI 寫作痕跡,讓文字讀起來更像人寫。

↓ 95.1萬★ 767user_ab5ae6ee
影片號爆款短影片拆解(付費版:全能)【零一數科·出品】內容創作

【零一數科·出品】影片號爆款短影片拆解(全能版)(付費版)。影片號爆款短影片拆解(付費版:全能)。一鍵拆解爆款,把一條影片號影片拆成結構分段、爆款歸因、六維評分和可借鑑策略,照著學照著抄。支援影片號分享連結和本地影片,付費全能版遠端分析,1–5 分鐘出視覺化 HTML 報告。

↓ 91.9萬★ 116u_c19e970c
影片號掛車爆單短影片指令碼生成【零一數科·出品】內容創作

【零一數科·出品】影片號掛車爆單短影片指令碼生成(付費版)。一條連結二創指令碼,丟進爆款影片號連結即以此骨架改寫成你的掛車指令碼,或按方向/目的/商品原創多條口播指令碼(含分段表、口播全文、六維質檢評分)。

↓ 55.4萬★ 39u_c19e970c
Humanizer內容創作

把文字里 AI 寫作的典型痕跡挑出來並改寫得更自然,同時保留原意的寫作編輯技能。

↓ 50.9萬★ 1116B*T
中文公文寫作內容創作

用於中文公文、事務性材料和新聞稿件的起草、改寫、壓縮、潤色、審校、文種核對、去口語化、降 AI 味及 Word 格式處理,適用於機關、企事業單位、學校和新聞機構。涵蓋申請、請示、報告、通知、通告、意見、決定、決議、議案、公報、命令、函、覆函、批覆、說明、方案、紀要、公告、公示、通報、制度、規定、辦法、細則、操作規程、工作要點、總結、調研、講話、致辭、主持詞、述職、可研、審查材料、技術需求、新聞訊息、編者按、新聞評論,以及採購、整改、反饋和 AI 算力等場景。

↓ 41.3萬★ 84gongyu0918
影片號爆款文案生成(體驗版)【零一數科·出品】內容創作

【零一數科·出品】影片號爆款文案生成(體驗版)。免費免登入出指令碼,給創作目的、行業、受眾、選題就按爆款結構(Hook-中段-CTA、節奏標籤)產出口播指令碼,資訊不全也能按爆款潛質兜底。本地執行、無需 Key,零成本上手。

↓ 33.9萬★ 94u_c19e970c

Jim Liu 寶玉 的其他技能

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。