{"id":"168217b2-409c-4ab3-bfe2-4d8206692980","shortId":"uQBmn7","kind":"skill","title":"baoyu-markdown-to-html","tagline":"Converts Markdown to styled HTML with WeChat-compatible themes. Supports code highlighting, math, 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\", \"微信外链转底部引用\"","description":"# Markdown to HTML Converter\n\nConverts Markdown files to beautifully styled HTML with inline CSS, optimized for WeChat Official Account and other platforms.\n\n## User Input Tools\n\nWhen this skill prompts the user, follow this tool-selection rule (priority order):\n\n1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.\n2. **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.\n3. **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.\n\nConcrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.\n\n## Script Directory\n\n**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.\n\n| Script | Purpose |\n|--------|---------|\n| `scripts/main.ts` | Main entry point |\n\n## Preferences (EXTEND.md)\n\nCheck EXTEND.md in priority order — the first one found wins:\n\n| Priority | Path | Scope |\n|----------|------|-------|\n| 1 | `.baoyu-skills/baoyu-markdown-to-html/EXTEND.md` | Project |\n| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-markdown-to-html/EXTEND.md` | XDG |\n| 3 | `$HOME/.baoyu-skills/baoyu-markdown-to-html/EXTEND.md` | User home |\n\nIf none found, use defaults.\n\n**EXTEND.md supports**: default theme, custom CSS variables, code block style.\n\n## Workflow\n\n### Step 0: Pre-check (Chinese Content)\n\n**Condition**: Only execute if input file contains Chinese text.\n\n**Detection**:\n1. Read input markdown file\n2. Check if content contains CJK characters (Chinese/Japanese/Korean)\n3. If no CJK content → skip to Step 1\n\n**Format Suggestion**:\n\nIf CJK content detected AND `baoyu-format-markdown` skill is available:\n\nUse `AskUserQuestion` to ask whether to format first. Formatting can fix:\n- Bold markers with punctuation inside causing `**` parse failures\n- CJK/English spacing issues\n\n**If user agrees**: Invoke `baoyu-format-markdown` skill to format the file, then use formatted file as input.\n\n**If user declines**: Continue with original file.\n\n### Step 1: Determine Theme\n\n**Theme resolution order** (first match wins):\n1. User explicitly specified theme (CLI `--theme` or conversation)\n2. EXTEND.md `default_theme` (this skill's own EXTEND.md, checked in Step 0)\n3. `baoyu-post-to-wechat` EXTEND.md `default_theme` (cross-skill fallback)\n4. If none found → use AskUserQuestion to confirm\n\n**Cross-skill EXTEND.md check** (only if this skill's EXTEND.md has no `default_theme`):\n\nRead `$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.\n\n**If theme is resolved from EXTEND.md**: Use it directly, do NOT ask the user.\n\n**If no default found**: use `AskUserQuestion` to confirm a theme from the [Themes](#themes) table below.\n\n### Step 1.5: Determine Citation Mode\n\n**Default**: Off. Do not ask by default.\n\n**Enable only if the user explicitly asks** for \"微信外链转底部引用\", \"底部引用\", \"文末引用\", or passes `--cite`.\n\n**Behavior when enabled**:\n- Ordinary external links are rendered with numbered superscripts and collected under a final `引用链接` section.\n- `https://mp.weixin.qq.com/...` links stay as direct links and are not moved to the bottom.\n- Bare links where link text equals URL stay inline.\n\n### Step 2: Convert\n\n```bash\n${BUN_X} {baseDir}/scripts/main.ts <markdown_file> --theme <theme> [--cite]\n```\n\n### Step 3: Report Result\n\nDisplay the output path from JSON result. If backup was created, mention it.\n\n## Usage\n\n```bash\n${BUN_X} {baseDir}/scripts/main.ts <markdown_file> [options]\n```\n\n**Options:**\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `--theme <name>` | Theme name (default, grace, simple, modern) | default |\n| `--color <name\\|hex>` | Primary color: preset name or hex value | theme default |\n| `--font-family <name>` | Font: sans, serif, serif-cjk, mono, or CSS value | theme default |\n| `--font-size <N>` | Font size: 14px, 15px, 16px, 17px, 18px | 16px |\n| `--title <title>` | Override title from frontmatter | |\n| `--cite` | Convert external links to bottom citations, append `引用链接` section | false (off) |\n| `--keep-title` | Keep the first heading in content | false (removed) |\n| `--help` | Show help | |\n\n**Color Presets:**\n\n| Name | Hex | Label |\n|------|-----|-------|\n| blue | #0F4C81 | Classic Blue |\n| green | #009874 | Emerald Green |\n| vermilion | #FA5151 | Vibrant Vermilion |\n| yellow | #FECE00 | Lemon Yellow |\n| purple | #92617E | Lavender Purple |\n| sky | #55C9EA | Sky Blue |\n| rose | #B76E79 | Rose Gold |\n| olive | #556B2F | Olive Green |\n| black | #333333 | Graphite Black |\n| gray | #A9A9A9 | Smoke Gray |\n| pink | #FFB7C5 | Sakura Pink |\n| red | #A93226 | China Red |\n| orange | #D97757 | Warm Orange (modern default) |\n\n**Examples:**\n\n```bash\n# Basic conversion (uses default theme, removes first heading)\n${BUN_X} {baseDir}/scripts/main.ts article.md\n\n# With specific theme\n${BUN_X} {baseDir}/scripts/main.ts article.md --theme grace\n\n# Theme with custom color\n${BUN_X} {baseDir}/scripts/main.ts article.md --theme modern --color red\n\n# Enable bottom citations for ordinary external links\n${BUN_X} {baseDir}/scripts/main.ts article.md --cite\n\n# Keep the first heading in content\n${BUN_X} {baseDir}/scripts/main.ts article.md --keep-title\n\n# Override title\n${BUN_X} {baseDir}/scripts/main.ts article.md --title \"My Article\"\n```\n\n## Output\n\n**File location**: Same directory as input markdown file.\n- Input: `/path/to/article.md`\n- Output: `/path/to/article.html`\n\n**Conflict handling**: If HTML file already exists, it will be backed up first:\n- Backup: `/path/to/article.html.bak-YYYYMMDDHHMMSS`\n\n**JSON output to stdout:**\n\n```json\n{\n  \"title\": \"Article Title\",\n  \"author\": \"Author Name\",\n  \"summary\": \"Article summary...\",\n  \"htmlPath\": \"/path/to/article.html\",\n  \"backupPath\": \"/path/to/article.html.bak-20260128180000\",\n  \"contentImages\": [\n    {\n      \"placeholder\": \"MDTOHTMLIMGPH_1\",\n      \"localPath\": \"/path/to/img.png\",\n      \"originalPath\": \"imgs/image.png\"\n    }\n  ]\n}\n```\n\n## Themes\n\n| Theme | Description |\n|-------|-------------|\n| `default` | Classic - traditional layout, centered title with bottom border, H2 with white text on colored background |\n| `grace` | Elegant - text shadow, rounded cards, refined blockquotes (by @brzhang) |\n| `simple` | Minimal - modern minimalist, asymmetric rounded corners, clean whitespace (by @okooo5km) |\n| `modern` | Modern - large radius, pill-shaped titles, relaxed line height (pair with `--color red` for traditional red-gold style) |\n\n## Supported Markdown Features\n\n| Feature | Syntax |\n|---------|--------|\n| Headings | `# H1` to `###### H6` |\n| Bold/Italic | `**bold**`, `*italic*` |\n| Code blocks | ` ```lang ` with syntax highlighting |\n| Inline code | `` `code` `` |\n| Tables | GitHub-flavored markdown tables |\n| Images | `![alt](src)` |\n| Links | `[text](url)`; add `--cite` to move ordinary external links into bottom references |\n| Blockquotes | `> quote` |\n| Lists | `-` unordered, `1.` ordered |\n| Alerts | `> [!NOTE]`, `> [!WARNING]`, etc. |\n| Footnotes | `[^1]` references |\n| Ruby text | `{base|annotation}` |\n| Mermaid | ` ```mermaid ` diagrams |\n| PlantUML | ` ```plantuml ` diagrams |\n\n## Frontmatter\n\nSupports YAML frontmatter for metadata:\n\n```yaml\n---\ntitle: Article Title\nauthor: Author Name\ndescription: Article summary\n---\n```\n\nIf no title is found, extracts from first H1/H2 heading or uses filename.\n\n## Extension Support\n\nCustom configurations via EXTEND.md. See **Preferences** section for paths and supported options.","tags":["baoyu","markdown","html","skills","jimliu","agent-skills","claude-skills","codex-skills","openclaw-skills"],"capabilities":["skill","source-jimliu","skill-baoyu-markdown-to-html","topic-agent-skills","topic-claude-skills","topic-codex-skills","topic-openclaw-skills"],"categories":["baoyu-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/JimLiu/baoyu-skills/baoyu-markdown-to-html","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add JimLiu/baoyu-skills","source_repo":"https://github.com/JimLiu/baoyu-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 16958 github stars · SKILL.md body (7,962 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-03T00:52:27.538Z","embedding":null,"createdAt":"2026-04-18T21:53:33.477Z","updatedAt":"2026-05-03T00:52:27.538Z","lastSeenAt":"2026-05-03T00:52:27.538Z","tsv":"'/...':539 '/baoyu-markdown-to-html/extend.md':245 '/baoyu-skills/baoyu-markdown-to-html/extend.md':252 '/path/to/article.html':822,853 '/path/to/article.html.bak-20260128180000':855 '/path/to/article.html.bak-yyyymmddhhmmss':837 '/path/to/article.md':820 '/path/to/img.png':861 '/scripts/main.ts':568,593,748,756,767,783,795,805 '0':275,406 '009874':686 '0f4c81':682 '1':86,241,291,312,376,385,859,972,979 '1.5':494 '14px':639 '15px':640 '16px':641,644 '17px':642 '18px':643 '2':112,247,296,394,562 '3':139,254,304,407,572 '333333':714 '4':420 '556b2f':710 '55c9ea':702 '92617e':698 'a93226':726 'a9a9a9':718 'account':65 'actual':218 'add':958 'agent':99,186 'agre':351 'alert':22,974 'alreadi':828 'alt':953 'annot':984 'append':657 'applic':151 'articl':809,844,850,999,1005 'article.md':749,757,768,784,796,806 'ask':34,107,127,162,330,474,502,511 'askuserquest':102,172,328,425,482 'asymmetr':897 'author':846,847,1001,1002 'avail':204,326 'b76e79':706 'back':833 'background':882 'backup':583,836 'backuppath':854 'baoyu':2,243,321,354,409 'baoyu-format-markdown':320,353 'baoyu-markdown-to-html':1 'baoyu-post-to-wechat':408 'baoyu-skil':242 'bare':552 'base':983 'basedir':193,213,567,592,747,755,766,782,794,804 'bash':564,589,736 'basic':737 'batch':140 'beauti':55 'behavior':519 'black':713,716 'block':271,938 'blockquot':890,968 'blue':681,684,704 'bold':338,935 'bold/italic':934 'border':875 'bottom':26,551,655,774,874,966 'brzhang':892 'built':89 'built-in':88 'bun':195,199,201,207,211,215,565,590,745,753,764,780,792,802 'call':148,156 'card':888 'caus':343 'center':871 'charact':302 'check':228,278,297,403,432 'china':727 'chines':279,288 'chinese/japanese/korean':303 'chosen':134 'citat':27,496,656,775 'cite':518,570,650,785,959 'cjk':301,307,316,627 'cjk/english':346 'clarifi':106 'classic':683,868 'clean':900 'cli':390 'code':17,270,937,944,945 'collect':531 'color':607,611,676,763,771,881,917 'combin':149 'compat':14 'concret':171 'condit':281 'config':249 'configur':1023 'confirm':427,484 'conflict':823 'contain':287,300 'content':280,299,308,317,670,791 'contentimag':856 'continu':371 'convers':393,738 'convert':6,39,50,51,563,651 'corner':899 'creat':585 'cross':417,429 'cross-skil':416,428 'css':60,268,630 'current':98 'custom':267,762,1022 'd97757':730 'declin':370 'default':262,265,396,414,441,452,479,498,504,598,602,606,618,633,734,740,867 'descript':597,866,1004 'detect':290,318 'determin':188,377,495 'diagram':987,990 'direct':471,543 'directori':185,191,814 'display':575 'e.g':101 'eleg':884 'els':208 'emerald':687 'emit':119 'enabl':505,521,773 'entri':224 'equal':557 'equival':111,180 'etc':977 'exampl':176,735 'execut':187,283 'exist':118,447,829 'explicit':387,510 'expos':95 'extend.md':227,229,263,395,402,413,431,438,468,1025 'extens':1020 'extern':29,523,652,778,963 'extract':1012 'fa5151':690 'failur':345 'fall':461 'fallback':113,419 'fals':660,671 'famili':621 'featur':927,928 'fece00':694 'ffb7c5':722 'file':53,286,295,361,365,374,811,818,827 'filenam':1019 'final':534 'first':234,334,382,667,743,788,835,1014 'fix':337 'flavor':949 'follow':78 'font':620,622,635,637 'font-famili':619 'font-siz':634 'footnot':21,978 'format':313,322,333,335,355,359,364 'found':236,260,423,480,1011 'frontmatt':649,991,994 'github':948 'github-flavor':947 'gold':708,923 'grace':603,759,883 'graphit':715 'gray':717,720 'green':685,688,712 'h1':931 'h1/h2':1015 'h2':876 'h6':933 'handl':824 'head':668,744,789,930,1016 'height':914 'help':673,675 'hex':609,615,679 'highlight':18,942 'home':250,257 'home/.baoyu-skills/baoyu-markdown-to-html/extend.md':255 'home/.baoyu-skills/baoyu-post-to-wechat/extend.md':444 'home/.config':251 'html':5,10,38,42,45,49,57,826 'htmlpath':852 'imag':952 'imgs/image.png':863 'infograph':23 'inlin':59,560,943 'input':70,93,105,285,293,367,816,819 'insid':342 'instal':200,210 'invok':352 'issu':348 'ital':936 'json':580,838,842 'keep':663,665,786,798 'keep-titl':662,797 'label':680 'lang':939 'larg':906 'lavend':699 'layout':870 'lemon':695 'line':454,913 'link':30,524,540,544,553,555,653,779,955,964 'list':970 'local':179 'localpath':860 'locat':812 'look':449 'main':223 'markdown':3,7,36,47,52,294,323,356,817,926,950 'marker':339 'match':383 'math':19 'md':40,43 'mdtohtmlimgph':858 'mention':586 'mermaid':985,986 'messag':125 'metadata':996 'minim':894 'minimalist':896 'mode':497 'modern':605,733,770,895,904,905 'mono':628 'move':548,961 'mp.weixin.qq.com':538 'mp.weixin.qq.com/...':537 'multipl':145 'name':601,608,613,678,848,1003 'none':259,422 'note':975 'npx':203,205 'number':121,528 'number/answer':135 'offici':64 'okooo5km':903 'oliv':709,711 'one':164,235 'optim':61 'option':25,594,595,596,1033 'orang':729,732 'order':85,170,232,381,973 'ordinari':522,777,962 'origin':373 'originalpath':862 'otherwis':460 'output':577,810,821,839 'overrid':646,800 'pair':915 'pars':344 'pass':517 'path':239,578,1030 'per':147 'pill':909 'pill-shap':908 'pink':721,724 'placehold':857 'plain':123 'plain-text':122 'plantuml':20,988,989 'platform':68 'point':225 'post':410 'pre':277 'pre-check':276 'prefer':87,226,1027 'present':459 'preset':612,677 'primari':610 'prioriti':84,169,231,238 'project':246 'prompt':75 'punctuat':341 'purpl':697,700 'purpos':221 'question':138,146,152,161 'quot':969 'radius':907 'read':292,443 'red':725,728,772,918,922 'red-gold':921 'refer':173,967,980 'refin':889 'relax':912 'remov':672,742 'render':526 'replac':212 'repli':131 'report':573 'request':103 'resolut':380 'resolv':194,466 'result':574,581 'rose':705,707 'round':887,898 'rubi':981 'rule':83 'runtim':100,183,197 'sakura':723 'san':623 'scope':240 'script':184,220 'scripts/main.ts':222 'section':536,659,1028 'see':1026 'select':82 'serif':624,626 'serif-cjk':625 'shadow':886 'shape':910 'show':674 'simpl':604,893 'singl':155,160 'single-quest':159 'size':636,638 'skill':74,244,324,357,399,418,430,436 'skill-baoyu-markdown-to-html' 'skill.md':190 'skip':309 'sky':701,703 'smoke':719 'source-jimliu' 'space':347 'specif':751 'specifi':388 'src':954 'stay':541,559 'stdout':841 'step':274,311,375,405,493,561,571 'style':9,56,272,924 'substitut':177 'suggest':209,314 'summari':849,851,1006 'superscript':529 'support':16,144,264,925,992,1021,1032 'syntax':929,941 'tabl':491,946,951 'text':124,289,556,879,885,956,982 'theme':15,266,378,379,389,391,397,415,442,453,464,486,489,490,569,599,600,617,632,741,752,758,760,769,864,865 'time':167 'titl':645,647,664,799,801,807,843,845,872,911,998,1000,1009 'tool':71,81,94,117,143 'tool-select':80 'topic-agent-skills' 'topic-claude-skills' 'topic-codex-skills' 'topic-openclaw-skills' 'tradit':869,920 'unord':971 'url':558,957 'usag':588 'use':31,261,327,363,424,455,469,481,739,1018 'user':33,69,77,92,104,108,129,256,350,369,386,476,509 'user-input':91 'valu':219,457,616,631 'variabl':269 'vermilion':689,692 'via':1024 'vibrant':691 'warm':731 'warn':976 'wechat':13,63,412 'wechat-compat':12 'whether':331 'white':878 'whitespac':901 'win':237,384 'workflow':273 'x':196,216,566,591,746,754,765,781,793,803 'xdg':248,253 'y':206 'yaml':993,997 'yellow':693,696 '底部引用':514 '引用链接':535,658 '微信外链转底部引用':46,513 '文末引用':515 '转':44","prices":[{"id":"93d1e70e-2a08-42bc-9b91-b6fbc456c640","listingId":"168217b2-409c-4ab3-bfe2-4d8206692980","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"JimLiu","category":"baoyu-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:53:33.477Z"}],"sources":[{"listingId":"168217b2-409c-4ab3-bfe2-4d8206692980","source":"github","sourceId":"JimLiu/baoyu-skills/baoyu-markdown-to-html","sourceUrl":"https://github.com/JimLiu/baoyu-skills/tree/main/skills/baoyu-markdown-to-html","isPrimary":false,"firstSeenAt":"2026-04-18T21:53:33.477Z","lastSeenAt":"2026-05-03T00:52:27.538Z"}],"details":{"listingId":"168217b2-409c-4ab3-bfe2-4d8206692980","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"JimLiu","slug":"baoyu-markdown-to-html","github":{"repo":"JimLiu/baoyu-skills","stars":16958,"topics":["agent-skills","claude-skills","codex-skills","openclaw-skills"],"license":null,"html_url":"https://github.com/JimLiu/baoyu-skills","pushed_at":"2026-04-25T20:03:31Z","description":null,"skill_md_sha":"9e8569032126726bf5b40213ce89757dd9f158b8","skill_md_path":"skills/baoyu-markdown-to-html/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/JimLiu/baoyu-skills/tree/main/skills/baoyu-markdown-to-html"},"layout":"multi","source":"github","category":"baoyu-skills","frontmatter":{"name":"baoyu-markdown-to-html","description":"Converts Markdown to styled HTML with WeChat-compatible themes. Supports code highlighting, math, 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."},"skills_sh_url":"https://skills.sh/JimLiu/baoyu-skills/baoyu-markdown-to-html"},"updatedAt":"2026-05-03T00:52:27.538Z"}}