Converts long-form markdown (specs, RFCs, reports, plans, explainers) into a single-file, lightly-interactive HTML document with sticky TOC, scrollspy, search f
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-md-document-cd495232b717 ,按照其中的说明把「md-document」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
The general-purpose converter — handles the 90% case Shihipar describes (specs, plans, RFCs, reports, explainers). Three stdlib tools pipeline together:
markdown_parser.py → html_renderer.py → interactivity_injector.py
(md → JSON AST) (AST + tokens → HTML) (HTML + JS behavior)
Output is one .html file with sticky TOC, search filter, scrollspy, code-copy buttons, and the user's 12 derived brand tokens. Externals limited to Google Fonts CSS + Prism.js CDN.
| Symptom | Action |
|---|---|
markdown-html-orchestrator routes input as DOCUMENT | Invoke this skill |
User runs /cs:md-document <path>.md directly | Invoke this skill |
| User says "convert this spec/report/RFC/plan to HTML" | Invoke this skill |
Input is a code review (has ```diff blocks) | Route to md-review instead |
Input is a slide deck (clear --- boundaries) | Route to md-slides instead |
| Input is < 100 lines | Refuse (Shihipar threshold — markdown still wins) |
| Design-system not onboarded | Refuse, surface /cs:design-system |
# 1. Parse markdown → JSON AST
python3 markdown-html/skills/md-document/scripts/markdown_parser.py \
--input <path>.md --output sections.json
# 2. Render AST + design-system config → single-file HTML
python3 markdown-html/skills/md-document/scripts/html_renderer.py \
--sections sections.json --output document.html
# 3. Inject lightweight JS (search, copycode, smoothscroll, scrollspy)
python3 markdown-html/skills/md-document/scripts/interactivity_injector.py \
--file document.html \
--features search,copycode,smoothscroll,scrollspy
Or all-in-one (sample render):
python3 markdown-html/skills/md-document/scripts/html_renderer.py --sample \
| python3 markdown-html/skills/md-document/scripts/interactivity_injector.py \
--file /dev/stdin --output document.html
CommonMark subset sufficient for agent-generated artifacts:
code / links / ```python) with Prism.js highlighting on demand> [!NOTE], > [!TIP], > [!IMPORTANT], > [!WARNING], > [!CAUTION])Out of scope: nested lists, HTML inlines, footnotes, definition lists, task list checkboxes (rendered as plain text), reference-style links.
config_loader.setup_completed() must return True. Otherwise surface /cs:design-system.fonts.googleapis.com and cdn.jsdelivr.net (Prism). Anything else is a regression.design_style=editorial produces 720px-wide layout with 1.75 line-height; playful rounds the callouts and adds shadow; technical is dense with 0.875rem code. Smoke-tested.prefers-color-scheme). Canon: WCAG 2.2 §1.4.3.<title> and is excluded from the TOC.md-review — that converter renders diff blocks + severity-tagged margin annotations. This one renders prose + tables + code + callouts.md-slides — that converter splits on --- boundaries into slides. This one renders one continuous document.marketing/landing/ — that generates landing pages from scratch (no markdown input). This converts existing markdown.{default_output_dir}/doc-{slug}.html (path resolved by orchestrator's output_path_resolver.py; collision suffix -2, -3, … by default).
references/ for full citations