Skip to main content

baoyu-markdown-to-html

Converts Markdown to styled HTML with WeChat-compatible themes. Supports code highlighting, math, PlantUML, footnotes, alerts, and infographics. Use when user asks for "markdown to html", "convert md to html", "md่ฝฌhtml", or needs styled HTML output from markdown.

Jump to install

Source facts

Repository
mediar-ai/skillhubz
Last source activity
March 1, 2026 at 22:46
Detected SKILL.md language
English
Stars
7
Forks
4

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions ยท Read-only preview
name
baoyu-markdown-to-html
description
Converts Markdown to styled HTML with WeChat-compatible themes. Supports code highlighting, math, PlantUML, footnotes, alerts, and infographics. Use when user asks for "markdown to html", "convert md to html", "md่ฝฌhtml", or needs styled HTML output from markdown.
# 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`. | Script | Purpose | |--------|---------| | `scripts/main.ts` | Main entry point | ## Preferences (EXTEND.md) Use Bash to check EXTEND.md existence (priority order): ```bash # Check project-level first test -f .baoyu-skills/baoyu-markdown-to-html/EXTEND.md && echo "project" # Then user-level (cross-platform: $HOME works on macOS/Linux/WSL) test -f "$HOME/.baoyu-skills/baoyu-markdown-to-html/EXTEND.md" && echo "user" ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Path โ”‚ Location โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ .baoyu-skills/baoyu-markdown-to-html/EXTEND.md โ”‚ Project directory โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ $HOME/.baoyu-skills/baoyu-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 `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`): ```bash # Check baoyu-post-to-wechat EXTEND.md for default_theme test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" && grep -o 'default_theme:.*' "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" ``` **If theme is resolved from EXTEND.md**: Use it directly, do NOT ask the user. **If no default found**: Use AskUserQuestion to confirm: | Theme | Description | |-------|-------------| | `default` (Recommended) | ็ปๅ…ธไธป้ข˜ - ไผ ็ปŸๆŽ’็‰ˆ๏ผŒๆ ‡้ข˜ๅฑ…ไธญๅธฆๅบ•่พน๏ผŒไบŒ็บงๆ ‡้ข˜็™ฝๅญ—ๅฝฉๅบ• | | `grace` | ไผ˜้›…ไธป้ข˜ - ๆ–‡ๅญ—้˜ดๅฝฑ๏ผŒๅœ†่ง’ๅก็‰‡๏ผŒ็ฒพ่‡ดๅผ•็”จๅ— | | `simple` | ็ฎ€ๆดไธป้ข˜ - ็Žฐไปฃๆž็ฎ€้ฃŽ๏ผŒไธๅฏน็งฐๅœ†่ง’๏ผŒๆธ…็ˆฝ็•™็™ฝ | | `modern` | ็Žฐไปฃไธป้ข˜ - ๅคงๅœ†่ง’ใ€่ฏไธธๅฝขๆ ‡้ข˜ใ€ๅฎฝๆพ่กŒ่ท๏ผˆๆญ้… `--color red` ่ฟ˜ๅŽŸไผ ็ปŸ็บข้‡‘้ฃŽๆ ผ๏ผ‰ | ### Step 2: Convert ```bash 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 ```bash npx -y bun ${SKILL_DIR}/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 | | | `--keep-title` | Keep the first heading in content | false (removed) | | `--help` | Show help | | **Color Presets:** | Name | Hex | Label | |------|-----|-------| | blue | #0F4C81 | ็ปๅ…ธ่“ | | green | #009874 | ็ฟก็ฟ ็ปฟ | | vermilion | #FA5151 | ๆดปๅŠ›ๆฉ˜ | | yellow | #FECE00 | ๆŸ ๆชฌ้ป„ | | purple | #92617E | ่–ฐ่กฃ็ดซ | | sky | #55C9EA | ๅคฉ็ฉบ่“ | | rose | #B76E79 | ็Žซ็‘ฐ้‡‘ | | olive | #556B2F | ๆฉ„ๆฆ„็ปฟ | | black | #333333 | ็Ÿณๅขจ้ป‘ | | gray | #A9A9A9 | ้›พ็ƒŸ็ฐ | | pink | #FFB7C5 | ๆจฑ่Šฑ็ฒ‰ | | red | #A93226 | ไธญๅ›ฝ็บข | | orange | #D97757 | ๆš–ๆฉ˜ (modern default) | **Examples:** ```bash # 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 # Theme with custom color npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --theme modern --color red # 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:** ```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" } ] } ``` ## Themes | Theme | Description | |-------|-------------| | `default` | ็ปๅ…ธไธป้ข˜ - ไผ ็ปŸๆŽ’็‰ˆ๏ผŒๆ ‡้ข˜ๅฑ…ไธญๅธฆๅบ•่พน๏ผŒไบŒ็บงๆ ‡้ข˜็™ฝๅญ—ๅฝฉๅบ• | | `grace` | ไผ˜้›…ไธป้ข˜ - ๆ–‡ๅญ—้˜ดๅฝฑ๏ผŒๅœ†่ง’ๅก็‰‡๏ผŒ็ฒพ่‡ดๅผ•็”จๅ— (by @brzhang) | | `simple` | ็ฎ€ๆดไธป้ข˜ - ็Žฐไปฃๆž็ฎ€้ฃŽ๏ผŒไธๅฏน็งฐๅœ†่ง’๏ผŒๆธ…็ˆฝ็•™็™ฝ (by @okooo5km) | | `modern` | ็Žฐไปฃไธป้ข˜ - ๅคงๅœ†่ง’ใ€่ฏไธธๅฝขๆ ‡้ข˜ใ€ๅฎฝๆพ่กŒ่ท๏ผˆๆญ้… `--color red` ่ฟ˜ๅŽŸไผ ็ปŸ็บข้‡‘้ฃŽๆ ผ๏ผ‰ | ## 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)` with footnote references | | Blockquotes | `> quote` | | Lists | `-` unordered, `1.` ordered | | Alerts | `> [!NOTE]`, `> [!WARNING]`, etc. | | Footnotes | `[^1]` references | | Ruby text | `{base|annotation}` | | Mermaid | ` ```mermaid ` diagrams | | 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.
View on GitHub