From business-intelligence-skills
Converts Markdown to WeChat-compatible HTML with inline CSS, supporting code highlighting, math, PlantUML, footnotes, alerts, and infographics.
How this skill is triggered — by the user, by Claude, or both
Slash command
/business-intelligence-skills:canghe-markdown-to-htmlThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Converts Markdown files to beautifully styled HTML with inline CSS, optimized for WeChat Official Account and other platforms.
scripts/main.tsscripts/md/LICENSEscripts/md/extensions/alert.tsscripts/md/extensions/footnotes.tsscripts/md/extensions/index.tsscripts/md/extensions/infographic.tsscripts/md/extensions/katex.tsscripts/md/extensions/markup.tsscripts/md/extensions/plantuml.tsscripts/md/extensions/ruby.tsscripts/md/extensions/slider.tsscripts/md/extensions/toc.tsscripts/md/package-lock.jsonscripts/md/package.jsonscripts/md/render.tsscripts/md/themes/base.cssscripts/md/themes/default.cssscripts/md/themes/grace.cssscripts/md/themes/simple.cssscripts/md/utils/languages.tsConverts Markdown files to beautifully styled HTML with inline CSS, optimized for WeChat Official Account and other platforms.
Agent Execution: Determine this SKILL.md directory as SKILL_DIR, then use ${SKILL_DIR}/scripts/<name>.ts.
| Script | Purpose |
|---|---|
scripts/main.ts | Main entry point |
Use Bash to check EXTEND.md existence (priority order):
# Check project-level first
test -f .canghe-skills/canghe-markdown-to-html/EXTEND.md && echo "project"
# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.canghe-skills/canghe-markdown-to-html/EXTEND.md" && echo "user"
┌──────────────────────────────────────────────────────────────┬───────────────────┐ │ Path │ Location │ ├──────────────────────────────────────────────────────────────┼───────────────────┤ │ .canghe-skills/canghe-markdown-to-html/EXTEND.md │ Project directory │ ├──────────────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.canghe-skills/canghe-markdown-to-html/EXTEND.md │ User home │ └──────────────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ Result │ Action │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Found │ Read, parse, apply settings │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Not found │ Use defaults │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md Supports: Default theme | Custom CSS variables | Code block style
Condition: Only execute if input file contains Chinese text.
Detection:
Format Suggestion:
If CJK content detected AND canghe-format-markdown skill is available:
Use AskUserQuestion to ask whether to format first. Formatting can fix:
** parse failuresIf user agrees: Invoke canghe-format-markdown skill to format the file, then use formatted file as input.
If user declines: Continue with original file.
Before converting, use AskUserQuestion to confirm the theme (unless user already specified):
| Theme | Description |
|---|---|
default (Recommended) | 经典主题 - 传统排版,标题居中带底边,二级标题白字彩底 |
grace | 优雅主题 - 文字阴影,圆角卡片,精致引用块 |
simple | 简洁主题 - 现代极简风,不对称圆角,清爽留白 |
npx -y bun ${SKILL_DIR}/scripts/main.ts <markdown_file> --theme <theme>
Display the output path from JSON result. If backup was created, mention it.
npx -y bun ${SKILL_DIR}/scripts/main.ts <markdown_file> [options]
Options:
| Option | Description | Default |
|---|---|---|
--theme <name> | Theme name (default, grace, simple) | default |
--title <title> | Override title from frontmatter | |
--keep-title | Keep the first heading in content | false (removed) |
--help | Show help |
Examples:
# Basic conversion (uses default theme, removes first heading)
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md
# With specific theme
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --theme grace
# Keep the first heading in content
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --keep-title
# Override title
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --title "My Article"
File location: Same directory as input markdown file.
/path/to/article.md/path/to/article.htmlConflict handling: If HTML file already exists, it will be backed up first:
/path/to/article.html.bak-YYYYMMDDHHMMSSJSON output to stdout:
{
"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"
}
]
}
| Theme | Description |
|---|---|
default | 经典主题 - 传统排版,标题居中带底边,二级标题白字彩底 |
grace | 优雅主题 - 文字阴影,圆角卡片,精致引用块 (by @brzhang) |
simple | 简洁主题 - 现代极简风,不对称圆角,清爽留白 (by @okooo5km) |
| 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 |  |
| Links | [text](url) with footnote references |
| Blockquotes | > quote |
| Lists | - unordered, 1. ordered |
| Alerts | > [!NOTE], > [!WARNING], etc. |
| Footnotes | [^1] references |
| Ruby text | `{base |
| Mermaid | ```mermaid diagrams |
| PlantUML | ```plantuml diagrams |
Supports YAML frontmatter for metadata:
---
title: Article Title
author: Author Name
description: Article summary
---
If no title is found, extracts from first H1/H2 heading or uses filename.
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
npx claudepluginhub freestylefly/canghe-skills --plugin content-skillsConverts Markdown to styled HTML with WeChat-compatible themes, supporting code highlighting, math, Mermaid (PNG via headless Chrome), PlantUML, footnotes, alerts, infographics, and optional bottom citations for external links.
Generates browser-viewable HTML previews from markdown, plain text, and Mermaid diagrams. Validates diagrams, applies GitHub/dark/minimal styling, saves to temp dir, and auto-opens in default browser for docs, reports, and visualizations.
Converts Markdown files with Mermaid diagrams to styled PDFs using Python script and Puppeteer. Useful for generating PDF documentation, reports, or printable documents with custom styles.