Back to the collection
baoyu-markdown-to-html·Content & media

baoyu-markdown-to-html: convert Markdown into previewable styled HTML

On this page

Use baoyu-markdown-to-html after article content and formatting are settled. It produces styled HTML with support for code, formulas, tables, and diagrams, including styling intended for WeChat editing workflows. File conversion does not log in to or publish on a platform.

Install and invoke

Run this in your project terminal to install only this skill for Claude Code:

Command
npx skills add jimliu/baoyu-skills --skill baoyu-markdown-to-html -a claude-code

Node.js and npx must be available. For Codex, replace -a claude-code with -a codex. In the agent conversation, explicitly ask it to use baoyu-markdown-to-html and supply your material. The installation command belongs in the terminal, not in your content brief.

Verify the rules with a small article

Prepare Markdown containing headings, prose, a table, and an image. Resolve typography problems first when necessary rather than mixing extensive rewriting into conversion.

Example brief:

Prompt
Use baoyu-markdown-to-html on article.md.
Choose grace with green accents, keep the first body heading, and move ordinary external links to bottom references.
Do not rewrite the text. Report the HTML path, image dependencies, and whether Mermaid rendered successfully.
Create local files only; do not publish.

The relevant script options are --theme grace --color green --keep-title --cite. Locate scripts/main.ts in the actual installation and run it through Bun or the documented npx -y bun fallback. Without --keep-title, conversion normally removes the first body heading and uses the document's title metadata.

Inspect assets and diagrams separately

Output normally shares the input directory: article.md becomes article.html. Existing HTML is backed up with a timestamp. Read the returned htmlPath, image inventory, and backup location rather than relying only on a success message.

--cite is disabled by default. When enabled, ordinary external links receive numbered references at the end. WeChat article links and bare URLs have separate treatment, so do not assume every link moves. Inspect numbering, labels, and destinations in the preview.

Mermaid diagrams are rendered as local PNGs through a headless browser and cached under imgs/.mermaid-cache/. If Chrome, Chromium, or Edge is unavailable, or rendering fails, conversion can still finish while the diagram remains a code block. The presence of an HTML file therefore does not prove every diagram succeeded.

Preview in a browser and the intended publishing environment. Check table width, code readability, image paths, and formulas. Platform editors may alter styling during paste, so judge the actual reader-facing result. Retain Markdown as the editing source; changes made only to generated HTML can disappear on the next conversion.

Run a small publication rehearsal

Start with a short article containing a second-level heading, external link, table, local image, and Mermaid diagram. Convert it with the theme, color, and citation settings intended for the real publication. Open the output in a browser: did the first heading disappear under the default rule, do citation numbers match their links, and is the diagram a PNG or merely a code block? If Mermaid fell back, check the browser executable first, then choose a static image or textual representation. A successful command exit alone does not prove that every diagram rendered.

Paste the same HTML into the target editor and inspect it again. The platform may change styling; table overflow, code formatting, and link markers often differ from the local preview. A relative path to a local image does not mean the publishing platform uploaded that image. Once the rehearsal passes, convert the remaining drafts and retain Markdown originals and backups. Make future edits in Markdown and regenerate so the two versions do not drift apart.

Use conversion as a preview gate

Treat HTML conversion as the preview gate for the publishable version. Just Jason’s article workflow completes writing, images, compression, and Markdown cleanup before using baoyu-markdown-to-html for WeChat format, then publishes. This lets you inspect heading levels, quotes, code, and images separately. Open the produced HTML rather than equating file creation with a good page. A local image path will not display for WeChat readers. If the publishing platform rewrites styles or image URLs, check its final preview as well.

If even the first sample will not convert, determine whether the error occurs before Markdown parsing or during rendering. On an older fresh install, a user saw an import failure for baoyu-chrome-cdp/mermaid; the published dependency package lagged the repository source at the time. That issue is closed. Start with the maintainer-recommended current version, then reproduce with a tiny document containing one heading and image instead of repeatedly editing article layout while dependencies fail to load.

How did your first task go?

These choices help us understand where readers get stuck through site analytics. Blocking analytics may prevent delivery; use email for a specific issue.

References

  1. baoyu-markdown-to-html: official workflowBaoyu (Jim Liu)
  2. Repository installation and configurationBaoyu (Jim Liu)
  3. Skills CLI: select a skill and target agentVercel Labs
  4. Bun installation and runtime checksBun
  5. AI Agent + Skill:正在升级我们的设计边界和PPT边界Just Jason
  6. npm-published baoyu-md and baoyu-chrome-cdp stale builds on fresh installcyuanxv
Found outdated or incorrect information? Let us know

Keep exploring

More skills worth getting to know.