jimliu/baoyu-skills

baoyu-markdown-to-html

Converts Markdown to styled HTML with WeChat-compatible themes.

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/jimliu/baoyu-skills --skill baoyu-markdown-to-html

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

Markdown to HTML Converter

Output is HTML with inline CSS, optimized for WeChat Official Account.

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

{baseDir} = this SKILL.md's directory. Resolve ${BUN_X}: bun if installed → else npx -y bun → else suggest installing bun.

ScriptPurpose
scripts/main.tsMain entry point

Preferences (EXTEND.md)

First found wins:

PriorityPathScope
1.baoyu-skills/baoyu-markdown-to-html/EXTEND.mdProject
2${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-markdown-to-html/EXTEND.mdXDG
3$HOME/.baoyu-skills/baoyu-markdown-to-html/EXTEND.mdUser home

None found → use defaults.

Supported: default theme, custom CSS variables, code block style, mermaid defaults (mermaid_theme, mermaid_scale, mermaid_background).

Workflow

Step 0: Pre-check (CJK Content)

Only if the input contains CJK characters AND the baoyu-format-markdown skill is available: ask (AskUserQuestion) whether to format first — it fixes ** bold markers broken by inner punctuation and CJK/English spacing. Agree → run baoyu-format-markdown, use the formatted file. Decline → use the original. No CJK → skip to Step 1.

Step 1: Determine Theme

First match wins:

  1. User-specified (CLI --theme or conversation)
  2. This skill's EXTEND.md default_theme
  3. Cross-skill fallback (only if step 2 has none): default_theme: line in $HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md, if it exists
  4. None → ask (AskUserQuestion) with the Themes table

Theme from EXTEND.md → use it directly, do NOT ask.

Step 1.5: Determine Citation Mode

Default off; don't ask. Enable (--cite) only if the user explicitly asks for "微信外链转底部引用", "底部引用", "文末引用", or passes --cite. 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

Show htmlPath from the JSON result; mention backupPath if a backup was created.

Options

OptionDescriptionDefault
--theme <name>Theme name (default, grace, simple, modern)default
`--color <name\hex>`Primary color: preset name or hex valuetheme default
--font-family <name>Font: sans, serif, serif-cjk, mono, or CSS valuetheme default
--font-size <N>Font size: 14px, 15px, 16px, 17px, 18px16px
--title <title>Override title from frontmatter
--citeConvert external links to bottom citations, append 引用链接 sectionfalse (off)
--keep-titleKeep the first heading in contentfalse (removed)
--mermaid-theme <name>Mermaid theme: default, forest, dark, neutral, basedefault
--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 this860
--mermaid-bg <value>Mermaid background: white, transparent, or #hexwhite
--no-mermaidSkip Mermaid PNG rendering; emit <pre class="mermaid"> fallbackfalse
--helpShow help

Color Presets:

NameHexLabel
blue#0F4C81Classic Blue
green#009874Emerald Green
vermilion#FA5151Vibrant Vermilion
yellow#FECE00Lemon Yellow
purple#92617ELavender Purple
sky#55C9EASky Blue
rose#B76E79Rose Gold
olive#556B2FOlive Green
black#333333Graphite Black
gray#A9A9A9Smoke Gray
pink#FFB7C5Sakura Pink
red#A93226China Red
orange#D97757Warm Orange (modern default)

Examples:

bash
${BUN_X} {baseDir}/scripts/main.ts article.md                                  # default theme, first heading removed
${BUN_X} {baseDir}/scripts/main.ts article.md --theme modern --color red
${BUN_X} {baseDir}/scripts/main.ts article.md --cite --keep-title --title "My Article"

Output

/path/to/article.md → /path/to/article.html (same directory). An existing HTML file is first backed up to /path/to/article.html.bak-YYYYMMDDHHMMSS.

JSON 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: mermaid blocks are rendered to PNG via headless Chrome (CDP), cached at imgs/.mermaid-cache/mermaid-<hash>.png (key: code, theme, scale, target width, background, mermaid version; suggest adding the dir to .gitignore). Needs Chrome/Chromium/Edge; if unavailable or rendering fails, falls back to <pre class="mermaid">…</pre> and conversion still succeeds.

Themes

ThemeDescription
defaultClassic - traditional layout, centered title with bottom border, H2 with white text on colored background
graceElegant - text shadow, rounded cards, refined blockquotes (by @brzhang)
simpleMinimal - modern minimalist, asymmetric rounded corners, clean whitespace (by @okooo5km)
modernModern - large radius, pill-shaped titles, relaxed line height (pair with --color red for traditional red-gold style)

Supported Markdown Features

Standard GFM (headings, emphasis, lists, tables, images, links, blockquotes, inline code) plus:

FeatureSyntax
Code blocks lang with syntax highlighting
Links[text](url); add --cite to move ordinary external links into bottom references
Alerts> [!NOTE], > [!WARNING], etc.
Footnotes[^1] references
Ruby text`{baseannotation}`
Mermaid mermaid (see Output)
PlantUML plantuml diagrams

Frontmatter

title, author, description (summary). No title → first H1/H2, else filename.

Extension Support

Custom configuration via EXTEND.md — see Preferences.

같은 저장소의 Skills

더 많은 Skills

모든 Skills
jimliu
커뮤니티

baoyu-compress-image

Compresses images to WebP (default) or PNG with automatic tool selection. Use when user asks to "compress image", "optimize image", "convert to webp", or reduce image file size.

1시간 설치 수
6
GitHub Stars
2.7만
업데이트
11월 1일
jimliu
커뮤니티

baoyu-url-to-markdown

Fetch any URL and convert to markdown using baoyu-fetch CLI (Chrome CDP with site-specific adapters). Built-in adapters for X/Twitter, YouTube transcripts, Hacker News threads, and generic pages via Defuddle. Handles login/CAPTCHA via interaction wait modes. Use when user wants to save a webpage as markdown.

1시간 설치 수
6
GitHub Stars
2.7만
업데이트
11월 1일
jimliu
커뮤니티

baoyu-comic

Knowledge comic creator supporting multiple art styles and tones. Creates original educational comics with detailed panel layouts and batch-capable image generation. Use when user asks to create "知识漫画", "教育漫画", "biography comic", "tutorial comic", or "Logicomix-style comic".

1시간 설치 수
5
GitHub Stars
2.7만
업데이트
11월 1일
jimliu
커뮤니티

baoyu-cover-image

Generates article cover images with 5 dimensions (type, palette, rendering, text, mood) combining 11 color palettes and 7 rendering styles. Supports cinematic (2.35:1), widescreen (16:9), and square (1:1) aspects. Use when user asks to "generate cover image", "create article cover", or "make cover".

1시간 설치 수
6
GitHub Stars
2.7만
업데이트
11월 1일