{"_id":"grok-mermaid","_rev":"6-b694aacd4d7962594f4efee4f674f7fc","name":"grok-mermaid","dist-tags":{"latest":"0.2.3"},"versions":{"0.1.0":{"name":"grok-mermaid","version":"0.1.0","keywords":["mermaid","terminal","tui","ascii","unicode","diagram"],"author":{"name":"Alexey Zaytsev","email":"alexey.zaytsev@gmail.com"},"license":"Apache-2.0","_id":"grok-mermaid@0.1.0","maintainers":[{"name":"xl0","email":"alexey.zaytsev@gmail.com"}],"homepage":"https://github.com/xl0/grok-mermaid#readme","bugs":{"url":"https://github.com/xl0/grok-mermaid/issues"},"dist":{"shasum":"201d609efac2fbdf78fd8f2c7d7d7cd4a70aca56","tarball":"https://registry.npmjs.org/grok-mermaid/-/grok-mermaid-0.1.0.tgz","fileCount":64,"integrity":"sha512-F4+sSaxLSEYVv1qLKwMy72zyJfRf+2hCu8hUOqoReoK138Jplkqb8Fzq0NCSMwFgxJEfORgp8x8KaB1h+yg4bA==","signatures":[{"sig":"MEUCIAaXMSMpLT7NSjIBjnIqsfxQIDBfRKHNYrEJpCyXabPXAiEAyrbNDqQr9fWnYgGTrPUrkoKgPokbH9rjO4Hw7jdoMpM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":488080},"type":"module","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"0832c472e2254545f2948227b567fef5c5e3533c","scripts":{"fix":"biome check --write .","test":"bun test","build":"tsgo -p tsconfig.build.json","check":"biome check .","gen:width":"bun run scripts/gen-width-data.ts","typecheck":"tsgo --noEmit","differential":"bun run tools/differential/run.ts","prepublishOnly":"bun run check && bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"xl0","email":"alexey.zaytsev@gmail.com"},"repository":{"url":"git+https://github.com/xl0/grok-mermaid.git","type":"git"},"_npmVersion":"12.0.1","description":"Render Mermaid diagrams as Unicode box-drawing art for terminals","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@biomejs/biome":"^2.5.5","@typescript/native-preview":"latest"},"_npmOperationalInternal":{"tmp":"tmp/grok-mermaid_0.1.0_1785203728382_0.02162628449874293","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"grok-mermaid","version":"0.1.1","keywords":["mermaid","terminal","tui","ascii","unicode","diagram"],"author":{"name":"Alexey Zaytsev","email":"alexey.zaytsev@gmail.com"},"license":"Apache-2.0","_id":"grok-mermaid@0.1.1","maintainers":[{"name":"xl0","email":"alexey.zaytsev@gmail.com"}],"homepage":"https://github.com/xl0/grok-mermaid#readme","bugs":{"url":"https://github.com/xl0/grok-mermaid/issues"},"dist":{"shasum":"d389d130c1dc38da821308910057679904573d94","tarball":"https://registry.npmjs.org/grok-mermaid/-/grok-mermaid-0.1.1.tgz","fileCount":64,"integrity":"sha512-c8cyZK13yzS6VxCnOQTX3VBfoVPkozqF+ubCDuJX886aITK2X4DcrrbizIhHnQmE1ZBR/X34yDMqDBfh4EV91A==","signatures":[{"sig":"MEUCIQC20XegvrgZRFo7FPpP89zoPerbfA3lNefKkYqDbBITmAIgLlCdGeCRweTomPiJPPsradWoUFNiU1HkREW1qktafCQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":488908},"type":"module","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"cf4ab3c1e6d8dfdd0dd5f1eeb827a45168e07728","scripts":{"fix":"biome check --write .","test":"bun test","build":"tsgo -p tsconfig.build.json","check":"biome check .","gen:demo":"bun run scripts/gen-demo-svg.ts","gen:width":"bun run scripts/gen-width-data.ts","typecheck":"tsgo --noEmit","differential":"bun run tools/differential/run.ts","prepublishOnly":"bun run check && bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"xl0","email":"alexey.zaytsev@gmail.com"},"repository":{"url":"git+https://github.com/xl0/grok-mermaid.git","type":"git"},"_npmVersion":"12.0.1","description":"Render Mermaid diagrams as Unicode box-drawing art for terminals","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@biomejs/biome":"^2.5.5","@typescript/native-preview":"latest"},"_npmOperationalInternal":{"tmp":"tmp/grok-mermaid_0.1.1_1785205434320_0.5573379251460571","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"grok-mermaid","version":"0.2.0","keywords":["mermaid","terminal","tui","ascii","unicode","diagram"],"author":{"name":"Alexey Zaytsev","email":"alexey.zaytsev@gmail.com"},"license":"Apache-2.0","_id":"grok-mermaid@0.2.0","maintainers":[{"name":"xl0","email":"alexey.zaytsev@gmail.com"}],"homepage":"https://github.com/xl0/grok-mermaid#readme","bugs":{"url":"https://github.com/xl0/grok-mermaid/issues"},"dist":{"shasum":"078bc1a2e5fb0b1c8b1169f60699fd614e3676d6","tarball":"https://registry.npmjs.org/grok-mermaid/-/grok-mermaid-0.2.0.tgz","fileCount":64,"integrity":"sha512-uQSC9UFN8QDM+a/5KaESYzSDcD1LIbcNrHa2/3l0MRCLnB6HTxrOq2JI8X8F7OEF/KWQuqM+OpaEYXj2+fILtA==","signatures":[{"sig":"MEUCIAjPdHlqn/wtMqybCuHvDrsqA4h4xl336J0HYKvHdZowAiEAhWHCqolTJPM8Cwux82kBG7ul/WnNxsrYEVgHHH65A2Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":502124},"type":"module","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"6be650796b05141c84ab252b4e6bcf84256a94cf","scripts":{"fix":"biome check --write .","test":"bun test","build":"tsgo -p tsconfig.build.json","check":"biome check .","gen:demo":"bun run scripts/gen-demo-svg.ts","gen:width":"bun run scripts/gen-width-data.ts","typecheck":"tsgo --noEmit","differential":"bun run tools/differential/run.ts","prepublishOnly":"bun run check && bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"xl0","email":"alexey.zaytsev@gmail.com"},"repository":{"url":"git+https://github.com/xl0/grok-mermaid.git","type":"git"},"_npmVersion":"12.0.1","description":"Render Mermaid diagrams as Unicode box-drawing art for terminals","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@biomejs/biome":"^2.5.5","@typescript/native-preview":"latest"},"_npmOperationalInternal":{"tmp":"tmp/grok-mermaid_0.2.0_1785263661482_0.9734039986363554","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"grok-mermaid","version":"0.2.1","keywords":["mermaid","terminal","tui","ascii","unicode","diagram"],"author":{"name":"Alexey Zaytsev","email":"alexey.zaytsev@gmail.com"},"license":"Apache-2.0","_id":"grok-mermaid@0.2.1","maintainers":[{"name":"xl0","email":"alexey.zaytsev@gmail.com"}],"homepage":"https://github.com/xl0/grok-mermaid#readme","bugs":{"url":"https://github.com/xl0/grok-mermaid/issues"},"dist":{"shasum":"5a776ba15272613bcdfe99bbd7db4f9f6b7e558d","tarball":"https://registry.npmjs.org/grok-mermaid/-/grok-mermaid-0.2.1.tgz","fileCount":65,"integrity":"sha512-FS/OxQaE+5jDQpGId2jKquoUWK81Sbqbys950fwvl+lVp3hw4h07NP+gJfVvMhTpcPLMwBt7XHHN5PxR1b+69A==","signatures":[{"sig":"MEUCIELOLeQ0kEc3JPkHG0IJrw92zLDgh4lMJBWeecRs1OUqAiEAly2w79y9MM8t4g7vos2gl/3DDn9Zv4itdcGH/5OzOhE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/grok-mermaid@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":503975},"type":"module","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"85115cc3cea77f10b4bfd21c920c1983e347ba49","scripts":{"fix":"biome check --write .","test":"bun test","build":"tsgo -p tsconfig.build.json","check":"biome check .","release":"bun run scripts/release.ts","gen:demo":"bun run scripts/gen-demo-svg.ts","gen:width":"bun run scripts/gen-width-data.ts","typecheck":"tsgo --noEmit","differential":"bun run tools/differential/run.ts","prepublishOnly":"bun run check && bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ddd769f8-a818-416c-af7e-5c5bdae95b7c"}},"repository":{"url":"git+https://github.com/xl0/grok-mermaid.git","type":"git"},"_npmVersion":"12.0.2","description":"Render Mermaid diagrams as Unicode box-drawing art for terminals","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@biomejs/biome":"^2.5.5","@typescript/native-preview":"latest"},"_npmOperationalInternal":{"tmp":"tmp/grok-mermaid_0.2.1_1785548192208_0.9253268873467644","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"grok-mermaid","version":"0.2.2","keywords":["mermaid","terminal","tui","ascii","unicode","diagram"],"author":{"name":"Alexey Zaytsev","email":"alexey.zaytsev@gmail.com"},"license":"Apache-2.0","_id":"grok-mermaid@0.2.2","maintainers":[{"name":"xl0","email":"alexey.zaytsev@gmail.com"}],"homepage":"https://github.com/xl0/grok-mermaid#readme","bugs":{"url":"https://github.com/xl0/grok-mermaid/issues"},"dist":{"shasum":"a3722186403839de617df378f750674c3eb04ce4","tarball":"https://registry.npmjs.org/grok-mermaid/-/grok-mermaid-0.2.2.tgz","fileCount":64,"integrity":"sha512-XcJEP5dDC8liHBh52mlLjU18fNvu1ckFsu0QpIG3+APZ270fsj9wxpiA6cOURmbUEuoMVgjbC2+UYgTdCqqgzA==","signatures":[{"sig":"MEUCIEZzJmTaZNJYC/24Hd4yXuJjrZAWMTdL2NXXo0EyYjtgAiEAh3402ZVpm4pUdCgX7Q9+6wuiucrQGkDJGApwMgLo7t8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/grok-mermaid@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":503973},"type":"module","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"3430584a71350d72b5a0310e91bcd55578a9f981","scripts":{"fix":"biome check --write .","test":"bun test","build":"tsgo -p tsconfig.build.json","check":"biome check .","release":"bun run scripts/release.ts","gen:demo":"bun run scripts/gen-demo-svg.ts","gen:width":"bun run scripts/gen-width-data.ts","typecheck":"tsgo --noEmit","differential":"bun run tools/differential/run.ts","prepublishOnly":"bun run check && bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ddd769f8-a818-416c-af7e-5c5bdae95b7c"}},"repository":{"url":"git+https://github.com/xl0/grok-mermaid.git","type":"git"},"_npmVersion":"12.0.2","description":"Render Mermaid diagrams as Unicode box-drawing art for terminals","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@biomejs/biome":"^2.5.5","@typescript/native-preview":"latest"},"_npmOperationalInternal":{"tmp":"tmp/grok-mermaid_0.2.2_1785867225975_0.19135767045394525","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"grok-mermaid","version":"0.2.3","description":"Render Mermaid diagrams as Unicode box-drawing art for terminals","keywords":["mermaid","terminal","tui","ascii","unicode","diagram"],"license":"Apache-2.0","author":{"name":"Alexey Zaytsev","email":"alexey.zaytsev@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/xl0/grok-mermaid.git"},"type":"module","sideEffects":false,"engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsgo -p tsconfig.build.json","typecheck":"tsgo --noEmit","check":"biome check .","fix":"biome check --write .","test":"bun test","gen:width":"bun run scripts/gen-width-data.ts","gen:demo":"bun run scripts/gen-demo-svg.ts","prepublishOnly":"bun run check && bun run typecheck && bun test && bun run build","release":"bun run scripts/release.ts","differential":"bun run tools/differential/run.ts"},"devDependencies":{"@biomejs/biome":"^2.5.5","@types/bun":"latest","@typescript/native-preview":"latest"},"gitHead":"b2333510e49f3ace5e3675738969ddc4781d4ed5","_id":"grok-mermaid@0.2.3","bugs":{"url":"https://github.com/xl0/grok-mermaid/issues"},"homepage":"https://github.com/xl0/grok-mermaid#readme","_nodeVersion":"24.18.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-/4KopAbsjvuRP9MdPtlDjOHUmUVEohOX73JNcsWpzAtFxh+bq5+Dhb6gzvRieLDwIPQIR3/vy8V1NNTuz4Zsmg==","shasum":"8021ac30b7ef1507c4c2d3516bf97908f39562de","tarball":"https://registry.npmjs.org/grok-mermaid/-/grok-mermaid-0.2.3.tgz","fileCount":64,"unpackedSize":508454,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/grok-mermaid@0.2.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCwl/ooh0+PwEpdu6XMxjZDZNG6ungPCTyVZ6VaZDlD+QIhANh9Vl4f1YD91dlNXZ6v8VXaFUclQUpEOXuzSTdr98J5"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ddd769f8-a818-416c-af7e-5c5bdae95b7c"}},"directories":{},"maintainers":[{"name":"xl0","email":"alexey.zaytsev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/grok-mermaid_0.2.3_1786485207556_0.8929487130113749"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-28T01:55:28.318Z","modified":"2026-08-11T21:53:28.033Z","0.1.0":"2026-07-28T01:55:28.577Z","0.1.1":"2026-07-28T02:23:54.720Z","0.2.0":"2026-07-28T18:34:21.666Z","0.2.1":"2026-08-01T01:36:32.378Z","0.2.2":"2026-08-04T18:13:46.143Z","0.2.3":"2026-08-11T21:53:27.706Z"},"bugs":{"url":"https://github.com/xl0/grok-mermaid/issues"},"author":{"name":"Alexey Zaytsev","email":"alexey.zaytsev@gmail.com"},"license":"Apache-2.0","homepage":"https://github.com/xl0/grok-mermaid#readme","keywords":["mermaid","terminal","tui","ascii","unicode","diagram"],"repository":{"type":"git","url":"git+https://github.com/xl0/grok-mermaid.git"},"description":"Render Mermaid diagrams as Unicode box-drawing art for terminals","maintainers":[{"name":"xl0","email":"alexey.zaytsev@gmail.com"}],"readme":"# grok-mermaid\n\nRender Mermaid diagrams as Unicode box-drawing art, for terminals.\n\nA TypeScript port of the terminal Mermaid renderer in\n[xai-org/grok-build](https://github.com/xai-org/grok-build)\n(`crates/codegen/xai-grok-markdown/src/mermaid.rs`). No browser, no headless\nChrome, no SVG — a self-contained layout engine that emits text.\n\n```\n      ┌──────────────┐\n      │ Parse source │\n      └───────┬──────┘\n              │\n              ▼\n       ╭────────────╮\n       │ Supported? │\n       ╰──────┬─────╯\n      ┌───────┴────────┐\n      ▼yes             ▼no\n ┌─────────┐   ┌───────────────┐\n │ Lay out │   │ Framed source │\n └────┬────┘   └───────┬───────┘\n      └───────┬────────┘\n              ▼\n       ┌─────────────┐\n       │ Unicode art │\n       └─────────────┘\n```\n\n## Install\n\n```sh\nnpm install grok-mermaid\n```\n\n## Usage\n\n```ts\nimport { render } from 'grok-mermaid'\n\nconst art = render('flowchart LR\\n  A[Start] --> B[Done]')\nif (art) console.log(art.plain.join('\\n'))\n```\n\n`render` draws the diagram at whatever size it needs and reports that as\n`art.width`. It returns `null` when there is no art to show: blank input, a\nsyntax error, a diagram type it does not draw, or one large enough that laying\nit out is refused.\n\n### Syntax errors\n\nRendering is best-effort: a source that does not fully parse still draws what it\ncan, and reports the rest in `art.warnings`.\n\n```ts\n// Flowcharts are lenient, as mermaid.js is: the parseable prefix survives.\nrender('graph TD\\n A[Start --> B')\n// plain     one box labelled `Start --> B` — the edge you wrote is gone\n// warnings  ['node \"A\": label is missing its closing `]`']\n\n// The rest fail on any unreadable statement, but retry once without the last\n// line — the one a half-finished source ends on.\nrender('stateDiagram-v2\\n A --> B\\n some garbage line')\n// plain     the A --> B transition, drawn\n// warnings  ['dropped, unreadable final line: \"some garbage line\"']\n```\n\nAn empty `warnings` means the whole source made it into the art.\n\n**Warnings are advisory — never gate rendering on them.** The art is the best\navailable drawing either way, and a diagram mid-edit warns at nearly every\nintermediate state: a label bracket is unterminated right up until it is typed.\n\n`diagramKind(src)` reads the header alone, separating the two `null`s worth\ndifferent messages:\n\n```ts\nif (render(src) === null) {\n  const kind = diagramKind(src) // 'flowchart' | 'state' | 'class' | 'er' | 'sequence' | null\n  console.log(kind ? `${kind} diagram: syntax error` : 'diagram type not supported here')\n}\n```\n\n### Streaming\n\nCall `render` on each prefix as it arrives — no special handling, no waiting for\na complete diagram. Best-effort parsing is what keeps it drawn instead of\nalternating with the source box.\n\n<img src=\"https://raw.githubusercontent.com/xl0/grok-mermaid/master/docs/streaming.gif\" width=\"900\" alt=\"A terminal replaying a stream of Mermaid diagrams — flowcharts and a state machine drawing themselves as box-drawing art, each one growing in place without ever reverting to a block of source text.\">\n\n### Fitting a viewport\n\nThe renderer takes no width limit. Nothing about a terminal tells it whether a\nwide diagram should be shrunk, scrolled, linked to an image or just printed, so\nthe decision stays with you — compare `art.width` against the space you have:\n\n```ts\nimport { render, sourceBox } from 'grok-mermaid'\n\nconst cols = process.stdout.columns\nconst art = render(src)\nif (art && art.width <= cols) console.log(art.plain.join('\\n'))\nelse {\n  console.log(sourceBox(src, cols).plain.join('\\n'))\n  console.log(`(diagram needs ${art?.width ?? '?'} columns)`)\n}\n```\n\n`sourceBox(src, maxWidth?)` frames the source in a titled box, hard-wrapping to\n`maxWidth`. It is the usual thing to show when the art does not fit or does not\nexist, but it is yours to choose and yours to caption.\n\n### Colour\n\nThe core is colour-blind. `styled` carries the same rows as `plain`, split into\nruns tagged with a semantic class, so you map classes to your own theme:\n\n<img src=\"https://raw.githubusercontent.com/xl0/grok-mermaid/master/docs/demo.svg\" width=\"330\" alt=\"A flowchart rendered as Unicode box-drawing art on a dark panel: grey box outlines, white node labels, cyan connectors and arrowheads, grey edge labels.\">\n\nThat image is real `render()` output painted through one such theme.\n\n```ts\nimport { type Cls, render } from 'grok-mermaid'\n\nconst art = render(src)!\n\nconst theme: Partial<Record<Cls, (s: string) => string>> = {\n  border: dim, text: white, edge: cyan, edgeLabel: gray,\n}\nconst out = art.styled.map((row) =>\n  row.map((span) => (theme[span.cls] ?? identity)(span.text)).join(''),\n)\n```\n\n| Class | What it covers |\n| --- | --- |\n| `border` | box outlines, subgraph frames, compartment rules |\n| `text` | node, participant and compartment labels |\n| `edge` | connector lines and arrowheads |\n| `edgeLabel` | text sitting on an edge |\n| `title` | the `mermaid: <kind>` header of a source box |\n| `none` | blank filler |\n\n`styled[i]` joined is always exactly `plain[i]`, so you can swap between them\nfreely. A render is plain JSON: cacheable across theme changes, transferable to\na worker.\n\nFor the common case there is a helper:\n\n```ts\nimport { render, toAnsi } from 'grok-mermaid'\n\nconsole.log(toAnsi(render(src)!).join('\\n'))\n```\n\n`toAnsi(art, theme)` takes `Partial<Record<Cls, string>>` of SGR parameters\n(`'2'` dim, `'36'` cyan, `'38;5;244'` for 256-colour), defaulting to a dim\nframe with cyan connectors.\n\n## Supported diagrams\n\n| Type | Notes |\n| --- | --- |\n| `graph` / `flowchart` | `TD`/`TB`, `BT`, `LR`, `RL`; `subgraph` nesting; node shapes; solid/dotted/thick links; arrow, circle, cross heads; edge labels |\n| `stateDiagram` / `stateDiagram-v2` | states, transitions, `[*]` start/end, `<<choice>>`, descriptions, composite states flattened |\n| `classDiagram` | compartments, annotations, generics, cardinalities, inheritance/realization/composition/aggregation/dependency |\n| `erDiagram` | entities, attributes, crow's-foot cardinalities |\n| `sequenceDiagram` | participants, messages, self-messages, notes, `loop`/`alt`/`opt` dividers, `autonumber` |\n\n## Credits\n\nInspired by Simon Willison's\n[grok-mermaid.html](https://tools.simonwillison.net/grok-mermaid)\n([source](https://github.com/simonw/tools/blob/main/grok-mermaid.html)), which\ncompiles the original Rust renderer to WebAssembly so it runs in a browser.\nThat demo is what made the renderer worth having outside the Grok CLI; this\nport takes the other route and reimplements it in TypeScript, so it needs no\nWASM and runs anywhere JS does.\n\n100% of the code written by Opus 5, with a healthy dose of feedback and direction from my side.\n\n## License\n\nApache-2.0. See [LICENSE](LICENSE).\n\nThe Rust original in [xai-org/grok-build](https://github.com/xai-org/grok-build)\n(`crates/codegen/xai-grok-markdown/src/mermaid.rs`) is Apache-2.0, Copyright\n2023-2026 SpaceXAI. Its layout algorithms, glyph tables, parser behaviour and\ntest corpus are what this port is derived from.\n","readmeFilename":"README.md"}