← ClaudeAtlas

mermaid-to-imageslisted

Turn a Markdown file's diagrams into image files and rewrite each block as a Markdown image reference. Handles two sources: ```mermaid fenced blocks (rendered directly) and hand-drawn ASCII diagrams in plain fences (sequence/flow/box art), which are first translated to equivalent mermaid and then rendered. Uses mermaid-cli (mmdc) offline when available, or the hosted mermaid.ink service otherwise. Use when a Markdown doc must show diagrams in a viewer that does not render mermaid (many editors, PDF/print, some blog engines), or to promote ASCII art to real diagrams. Takes one argument: the path to the Markdown file. Edits the file in place, so it is user-invoked only.
hcussi/claude-code-toolkit · ★ 0 · AI & Automation · score 63
Install: claude install-skill hcussi/claude-code-toolkit
# mermaid-to-images > **Non-negotiable rules. Read these first; they override any instinct to be clever.** > > 1. **The bundled script is the ONLY renderer.** Every image is produced by > running `scripts/mermaid_to_images.py`. You MUST NOT render diagrams any > other way. Specifically forbidden: a headless browser or Playwright > screenshot, a local HTTP server (`http.server`), converting SVG to PNG > yourself, `@1x`/`@2x` intermediates, or drawing/editing an image by hand. > 2. **If the script cannot render, STOP and report to the user.** A failure > (no `mmdc`, no network to mermaid.ink) is a hard stop, not a problem to route > around. Relay the script's error and its remediation; do not invent a > fallback renderer. Producing the image by other means is a failure, not a > save. > 3. **Do not choose output names, formats, or folders.** The output is exactly > `diagram-N.png` inside `<md-stem>-diagrams/`. Never rename to something > "semantic" (e.g. `assets/big-picture.png`), never emit `.svg`, never save > `.mmd` source, never write a `mermaid-config.json`. > 4. **Your only edits to the doc** are: (a) turning an ASCII diagram fence into a > ` ```mermaid ` fence (with a `%% alt:` comment), and (b) running the script, > which does the fence-to-image rewrite. Nothing else. > > If any rule pushes you toward more work, you are misreading it: the goal is a > boring, identical result every run. When blocked, stopping is the correct > outcom