## What it solves
- **Long answers are hard to read** — content becomes multi-panel sheets or continuous docs, with flowcharts, sequence diagrams, ER diagrams, trees, charts, tables, and syntax-highlighted code
- **Asking an AI to write a whole HTML page is unstable** — you author content and structure only; the compiler owns components, diagram coordinates, styles, and layout
- **Answers are hard to keep and share** — output is static HTML with no app to deploy; local assets can be bundled alongside for offline reading
- **Reading should lead to discussion** — pages offer multiple-choice questions and per-panel comments; the Reply action collects them as text you can paste back to the AI
- **Charts stay readable without JavaScript** — `chart` fences compile to a static SVG with a legend and a native data table; `xy` covers line/area/bar/point/bubble/stacked/combo, alongside `pie`, `heatmap`, and `radar`. Pages add tooltips and keyboard navigation by default, while videos always use the static version
- **Static explanations are not always enough** — the same diagram components can be rendered into explainer videos with scenes, narration, and camera focus
- **Some ideas only click when you try them** — `tsx live` blocks run Preact components styled with Tailwind classes right in the page, with built-in UI primitives for forms, buttons, JSON and program output; `useApi` calls endpoints and, when the backend is down, falls back to a snapshot with an in-block explanation and a Retry button; code shared by a page's blocks goes in `tsx live-lib`, and `ts server` ships a backend with the document (requires Bun)
## Install as a skill for AI agents
```bash
npx skills add https://gitee.com/cjl2385/answer-with-html.git
```
To verify locally, run `npx skills add /absolute/path/to/this/repo` in a scratch workspace: use the repo's real absolute path, not `.` pointing at the workspace; the install targets the current project and never overwrites existing skills.
Once installed, the agent decides on its own when to compile an answer: when you ask for HTML, diagrams, or a visual explanation, when you say you don't understand and something needs to be explained step by step, or when you explicitly request an explainer video. It reads `SKILL.md` and calls the bundled CLI at `/scripts/to-html.mjs`.
Compatibility: runs on Node.js 22.12+ or Bun ≥ 1.2. Media export additionally needs a browser (MP4 also ffmpeg). Image compression is built in when running under Bun; on Node, install sharp if you want it (raw bytes otherwise). Voice narration and the HTTP serve mode are covered in the skill references.
## Update the skill
Check for updates, or update only this globally installed skill:
```bash
npx skills check
npx skills update answer-with-html -g
```
**Overwrite only the Claude Code global directory**
```bash
npx skills add https://gitee.com/cjl2385/answer-with-html.git --skill answer-with-html --agent claude-code --global --copy --yes
```
## Writing pages
No file needed — pipe the draft through stdin (`-` reads it). Examples below shorten `node /scripts/to-html.mjs` to `to-html`:
````bash
to-html render - <<'TO_HTML_EOF'
---
title: How a request is handled
template: sheet
lang: en
---
## A Conclusion
Plain Markdown: paragraphs, lists, tables, images, and code blocks all work.
## B Processing flow
```flow LR
Input -> Parse -> Render -> HTML
```
TO_HTML_EOF
````
To render an existing draft, run `to-html render draft.md` (relative image paths resolve against the draft's directory; a stdin draft resolves against the current directory).
`##` headings are panels; `sheet` suits multi-panel overviews, `doc` suits continuous reading. Diagrams use the project's own fence syntax — no hand-written SVG required.
Without `-o`, output goes to a task directory `~/.answer-with-html/_/` (a timestamp is appended on name collisions): `_.origin.md` keeps the source draft (same name as the page), `_.html` (same name as its directory) is the page, local images are compressed into `assets/` by sharp or Bun's built-in engine (raw bytes only when neither is available); `TO_HTML_HOME` relocates the data root. The page opens in the browser automatically after rendering.
## Common operations
```bash
# deliver together with images: generates assets/ next to the HTML plus a same-named .origin.md draft snapshot
to-html render answer.md -o report/index.html
# a single self-contained file: local images embedded as Base64
to-html render answer.md -o standalone.html --images embed
# replace one panel of an existing page
to-html patch report/index.html --panel A --from replacement.md
# export real video files
to-html video outline.md --voice off --mp4
to-html video outline.md --voice off --webm
# syntax and options
to-html help
to-html help flow
to-html help video
```
- In the default image mode, **the HTML file and its sibling `assets/` directory must be moved together**; in embed mode, a single local image is capped at 5 MB. `` / `.mp3` etc. render as players; local video and audio (including `