SuperAPI AI Directory

bm-md

Frontend & websites

View repository

Updated 10-16 00:29

About this skill

bm.md Markdown Formatting Skill

Core Capabilities

Use bm.md to accomplish the following tasks:

  • Markdown Rendering: Convert Markdown to styled HTML, supporting 8 formatting styles, text highlighting, and image dimensions
  • HTML to Markdown: Convert HTML content back to Markdown format
  • Plain Text Extraction: Extract plain text from Markdown, removing all formatting markers
  • Format Validation and Repair: Automatically detect and fix Markdown formatting issues

Core Workflow

  1. Clarify the delivery goal: Confirm the audience, output platform, factual boundaries, and expected files; when information is insufficient, ask first, and do not guess facts or values.
  2. Organize the body first: First complete headings hierarchy, paragraphs, lists, tables, quotes, and code, then consider visual enhancements.
  3. Choose enhancements by semantics: Add Mermaid, Infographic, highlighting, or image dimensions only when they enhance understanding. Follow the decision rules below and read the corresponding references as needed.
  4. Execute rendering: Prefer the CLI; when local commands cannot be executed or the user explicitly requests remote invocation, switch to the REST API.
  5. Check and fall back: Check the command status, the response's result, chart errors, and the completeness of key information. When enhanced syntax fails, fix it first; if it still fails, fall back to clearly structured body text, lists, or tables, and do not deliver broken charts.

Enhancement Decisions and On-Demand References

  • Processes, call chains, states, class relationships, or ER models: use Mermaid。
  • Parallel items, steps, comparisons, hierarchies, relationships, or real values: use AntV Infographic. Fields are bound to templates; generate according to the verified examples in the reference.
  • Local key conclusions: usetext highlighting, do not highlight entire paragraphs.
  • When the user specifies dimensions or the layout truly requires fixed dimensions: useimage dimension syntax; when dimensions are unknown, keep ordinary images.

Stay restrained: do not decorate simple content with charts, do not use Mermaid and Infographic to express the same information repeatedly, and do not fabricate facts or values. After generating rich Markdown, you must render it through bm.md and check the result.

Execution Priority

  1. Prefer the CLI: If node --versioncan be executed locally, use the bmmd command to process Markdown.
  2. CLI invocation method: If bmmdis already installed on the system, use it directly; otherwise use npx -y bmmd to run it temporarily.
  3. Use the REST API as a fallback: If there is no Node.js environment, local commands cannot be executed, or the user explicitly requests remote invocation, then use https://bm.md/api/markdown/*。

By default, the CLI outputs results to stdout, and they can be written to a file via --output <file> . The REST API returns JSON, and the result is in the result field.


Available Tools

1. Markdown Rendering

Render Markdown source text to HTML with inline styles, which can be copied directly into a rich text editor.

CLI example (preferred):

npx -y bmmd render article.md --platform wechat --output article.html

Supports stdin:

cat article.md | npx -y bmmd render --platform wechat > article.html

Endpoint: POST https://bm.md/api/markdown/render

Request parameters:

Parameter Type Required Default value Description
markdown string Yes - Markdown source text, supports GFM syntax and math formulas
markdownStyle string No kami Layout style ID, see the complete list below
codeTheme string No kimbie-light Code block highlight theme ID, see the complete list below
mermaidTheme string No "" Mermaid flowchart theme ID, an empty string means use the default theme
infographicTheme string No default Infographic theme ID
infographicPalette string No antv Infographic color scheme ID
customCss string No "" Custom CSS, selectors must be scoped under #bm-md , such as #bm-md h1 { color: red }
enableFootnoteLinks boolean No true Whether to convert links to footnote form
breaks boolean No false Whether to convert soft line breaks within paragraphs to HTML line breaks, does not affect code blocks
openLinksInNewWindow boolean No true Whether to open links in a new window
platform string No html Target platform:html、wechat
footnoteLabel string No Footnotes GFM footnote section title
referenceTitle string No References External link reference section title

curl example:

curl -X POST https://bm.md/api/markdown/render \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "# 标题\n\n这是一段**加粗**的文字。\n\n```javascript\nconsole.log(\"Hello, World!\");\n```",
    "markdownStyle": "kami",
    "codeTheme": "kimbie-light",
    "platform": "wechat"
  }' \
  -o bm.md.json

Response example:

{
  "result": "<div id=\"bm-md\"><h1 style=\"...\">标题</h1>...</div>"
}

2. HTML to Markdown

Convert HTML source code to Markdown format.

CLI example (preferred):

npx -y bmmd parse page.html --output article.md

Supports stdin:

cat page.html | npx -y bmmd parse > article.md

Endpoint: POST https://bm.md/api/markdown/parse

Request parameters:

Parameter Type Required Description
html string Yes HTML source code, can be a complete document or a fragment

curl example:

curl -X POST https://bm.md/api/markdown/parse \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>标题</h1><p>这是一段<strong>加粗</strong>的文字。</p>"
  }' \
  -o bm.md.json

Response example:

{
  "result": "# 标题\n\n这是一段**加粗**的文字。"
}

3. Extract plain text

Extract plain text content from Markdown, remove all formatting markers, and preserve paragraph separation.

CLI example (preferred):

npx -y bmmd extract article.md --output article.txt

Endpoint: POST https://bm.md/api/markdown/extract

Request parameters:

Parameter Type Required Description
markdown string Yes Markdown source text

curl example:

curl -X POST https://bm.md/api/markdown/extract \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "# 标题\n\n这是一段**加粗**的文字,包含[链接](https://example.com)。"
  }' \
  -o bm.md.json

Response example:

{
  "result": "标题\n\n这是一段加粗的文字,包含链接。"
}

4. Markdown formatting

Validate and automatically fix Markdown formatting issues, and unify code style.

CLI example (preferred):

# 输出修复后的 Markdown
npx -y bmmd lint article.md --output article.fixed.md

# 直接写回源文件
npx -y bmmd lint article.md --fix

Endpoint: POST https://bm.md/api/markdown/lint

Request parameters:

Parameter Type Required Description
markdown string Yes Markdown source text to be validated

curl example:

curl -X POST https://bm.md/api/markdown/lint \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "#标题\n这是一段文字,没有正确的空格。\n-列表项1\n-列表项2"
  }' \
  -o bm.md.json

Response example:

{
  "result": "# 标题\n\n这是一段文字,没有正确的空格。\n\n- 列表项1\n- 列表项2"
}

Parameter reference

Layout style (markdownStyle)

ID Name Style description
kami Kami Clean paper reading style (default)
bauhaus Bauhaus Bauhaus style, geometry and functionalism
blueprint Blueprint Blueprint style, engineering design feel
botanical Botanical Botanical garden style, natural and soft
newsprint Newsprint Newspaper print style
retro Retro Retro Nostalgic Style
sketch Sketch Hand-drawn Sketch Style
terminal Terminal Terminal/Command Line Style
forest-review Forest Review Forest Quarterly Report Style, warm-toned editorial layout
navy-vellum Navy Vellum Deep Blue Parchment Style, quiet academic notes
rose-nocturne Rose Nocturne Rose Nocturne Style, dark-toned fashion editorial
solar-catalog Solar Catalog Daylight Catalog Style, exhibition poster texture
triad-paper Triad Paper Tritone Paper Style, tri-color fashion magazine feel
field-tablet Field Tablet Field Nameplate Style, archaeological manual texture
public-square Public Square Public Square Style, activist poster
pixel-orbit Pixel Orbit Pixel Orbit Style, retro pixel arcade

Code Theme (codeTheme)

ID Name Type
catppuccin-latte Catppuccin Latte Light
catppuccin-frappe Catppuccin Frappé Dark
catppuccin-macchiato Catppuccin Macchiato Dark
catppuccin-mocha Catppuccin Mocha Dark
kimbie-light Kimbie Light Light
kimbie-dark Kimbie Dark Dark
panda-syntax-light Panda Syntax Light Light
panda-syntax-dark Panda Syntax Dark Dark
paraiso-light Paraiso Light Light
paraiso-dark Paraiso Dark Dark
rose-pine-dawn Rosé Pine Dawn Light
rose-pine Rosé Pine Dark
tokyo-night-light Tokyo Night Light Light
tokyo-night-dark Tokyo Night Dark Dark

Target Platform (platform)

ID Description
html General web page, standard HTML output
wechat WeChat Official Account, optimized for the WeChat editor

Notes

  1. Mathematical formulas: Supports $...$(inline) and $$...$$(block-level) syntax
  2. GFM syntax: Fully supports GitHub Flavored Markdown, including tables, task lists, strikethrough, etc.
  3. Image handling: Image URLs must be publicly accessible addresses
  4. Inline styles: The output HTML has CSS inlined onto elements and can be copied and used directly
  5. Encoding requirements: Both requests and responses use UTF-8 encoding