Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
freestylefly avatar

Canghe Markdown To Html

  • 509 installs
  • 424 repo stars
  • Updated June 8, 2026
  • freestylefly/canghe-skills

canghe-markdown-to-html is an agent skill that converts Markdown files into WeChat-ready styled HTML for developers publishing technical articles with code, math, and diagrams.

About

canghe-markdown-to-html is an agent skill from freestylefly/canghe-skills that converts Markdown files into styled HTML with inline CSS optimized for WeChat Official Account and other publishing platforms. The skill runs scripts/main.ts from the skill directory and supports syntax highlighting, math rendering, PlantUML diagrams, footnotes, alerts, and infographic blocks with responsive layout. Developers reach for canghe-markdown-to-html when a .md draft must become platform-ready HTML without hand-writing WeChat-compatible styles. Trigger phrases include markdown to html, convert md to html, and md转html, making it useful for bilingual technical blogging pipelines.

  • Converts Markdown to inline-CSS HTML optimized for WeChat Official Accounts
  • Supports code highlighting, LaTeX math, PlantUML diagrams, footnotes, alerts and infographics
  • Uses dedicated TypeScript entry point at scripts/main.ts
  • Respects project-level and user-level EXTEND.md preference files
  • Triggered by phrases such as "markdown to html", "convert md to html" or "md转html"

Canghe Markdown To Html by the numbers

  • 509 all-time installs (skills.sh)
  • Ranked #383 of 1,879 Documentation skills by installs in the Skillselion catalog
  • Data as of Jul 31, 2026 (Skillselion catalog sync)
npx skills add https://github.com/freestylefly/canghe-skills --skill canghe-markdown-to-html

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs509
repo stars424
Last updatedJune 8, 2026
Repositoryfreestylefly/canghe-skills

How do you convert Markdown to WeChat-ready HTML?

Instantly turn any Markdown file into clean, WeChat-ready styled HTML complete with syntax highlighting, math rendering, diagrams and responsive design.

Who is it for?

Developers publishing technical Markdown articles to WeChat Official Account or styled HTML channels who need code, math, and diagram support.

Skip if: Static site generators already owning the full publish pipeline, or teams needing only plain unstyled HTML export without platform themes.

When should I use this skill?

A developer asks to convert markdown to html, md转html, or needs styled HTML with code highlighting and WeChat-compatible themes.

What you get

Styled HTML file with inline CSS, highlighted code blocks, rendered math, diagrams, footnotes, and responsive article layout.

  • Styled HTML article
  • Inline CSS theme
  • Rendered code and diagram blocks

Files

SKILL.mdMarkdownGitHub ↗

Markdown to HTML Converter

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

Script Directory

Agent Execution: Determine this SKILL.md directory as SKILL_DIR, then use ${SKILL_DIR}/scripts/<name>.ts.

ScriptPurpose
scripts/main.tsMain entry point

Preferences (EXTEND.md)

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

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 canghe-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 canghe-format-markdown skill to format the file, then use formatted file as input.

If user declines: Continue with original file.

Step 1: Confirm Theme

Before converting, use AskUserQuestion to confirm the theme (unless user already specified):

ThemeDescription
default (Recommended)经典主题 - 传统排版,标题居中带底边,二级标题白字彩底
grace优雅主题 - 文字阴影,圆角卡片,精致引用块
simple简洁主题 - 现代极简风,不对称圆角,清爽留白

Step 2: Convert

npx -y bun ${SKILL_DIR}/scripts/main.ts <markdown_file> --theme <theme>

Step 3: Report Result

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

Usage

npx -y bun ${SKILL_DIR}/scripts/main.ts <markdown_file> [options]

Options:

OptionDescriptionDefault
--theme <name>Theme name (default, grace, simple)default
--title <title>Override title from frontmatter
--keep-titleKeep the first heading in contentfalse (removed)
--helpShow 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"

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:

{
  "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"
    }
  ]
}

Themes

ThemeDescription
default经典主题 - 传统排版,标题居中带底边,二级标题白字彩底
grace优雅主题 - 文字阴影,圆角卡片,精致引用块 (by @brzhang)
simple简洁主题 - 现代极简风,不对称圆角,清爽留白 (by @okooo5km)

Supported Markdown Features

FeatureSyntax
Headings# H1 to ###### H6
Bold/Italic**bold**, *italic*
Code blocks `lang with syntax highlighting
Inline code` code `
TablesGitHub-flavored markdown tables
Images![alt](src)
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

Frontmatter

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.

Extension Support

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

Related skills

How it compares

Pick canghe-markdown-to-html for WeChat-themed Markdown publishing rather than generic static-site or documentation-site generators.

FAQ

What platforms does canghe-markdown-to-html target?

canghe-markdown-to-html targets WeChat Official Account and other platforms needing styled HTML with inline CSS. The skill optimizes technical articles with code highlighting, math, diagrams, footnotes, and responsive layout.

Which script runs the canghe-markdown-to-html conversion?

canghe-markdown-to-html uses scripts/main.ts as the main entry point inside the skill directory. Agents resolve SKILL_DIR and execute that TypeScript script to convert Markdown source into themed HTML output.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.