# Write a diagram as code and render it for a doc, README or PR

> Write a diagram as code and render it for a doc, README or PR: 3 companies fully do it, 8 with a limit, 18 carry the tag. Every listing in Diagramming with the reason and a source.

- Canonical: https://www.anchorterminal.com/niches/diagramming.render-as-code/
- Markdown: https://www.anchorterminal.com/niches/diagramming.render-as-code/index.md (~1,550 tokens)
- Slim: https://www.anchorterminal.com/niches/diagramming.render-as-code/index.min.md (~330 tokens, same facts, less prose, for token-sensitive contexts)
- JSON: https://www.anchorterminal.com/niches/diagramming.render-as-code/index.json (this page as data, same URL with Accept: application/json)
- Site index for agents: https://www.anchorterminal.com/llms.txt (the key docs and every listing in one file, at most 16 MB, about 4 million tokens: https://www.anchorterminal.com/llms-full.txt)
- API: https://www.anchorterminal.com/api/v1/index.json
- MCP: https://www.anchorterminal.com/mcp (the whole catalogue as tools, no key)
- DNS: dig +short TXT <slug>.grade.anchorterminal.com (the grade as a DNS TXT record, for a sandbox with no HTTP where names still resolve; also top., best.<category>. and <a>.vs.<b>. under the zone, and the same under grade.letme.dev)
- Licence: CC BY 4.0, credit Anchor Terminal and link this page (https://www.anchorterminal.com/terms/#data)
- Updated: 2026-11-15

Two or three companies' docs show a full fit.

| Companies, full fit | With a limit | Carry the tag | Share of the category's work | First-hand accounts |
| --- | --- | --- | --- | --- |
| 3 | 8 | 18 | 22 | 11 |

## What counts as done

Diagram source committed or embedded as text, plus an SVG or PNG that renders without a parse error and shows every node and edge in the source, produced from the source alone.

Measured, for our own tests: one render call under 5 seconds for a 30-node diagram.

How agents ask for it: add a sequence diagram to the README; render this Mermaid as PNG; make a PlantUML diagram for the proposal; draw the schema as an ERD

## Does the job

The docs show it meets the test above, and nothing we read says otherwise.

- **D2 (The Hack Foundation (Hack Club), fiscal sponsor of the D2 project)**: The local CLI renders .d2 text to SVG, PNG, PDF, PPTX, GIF or ASCII from stdin to stdout with automatic layout, and TALA is now bundled free. The man page says to trust the exit status, since a partial file can be written on error. Speed bar not stated.
- **Kroki (Yuzu tech, a French software firm. No registered legal form found)**: POST /<type>/<format> with the diagram text returns SVG, PNG or PDF for about 29 formats, self-hosted from Docker with SECURE safe mode by default; acc-06 renders locally from Claude Code. Speed bar not stated; acc-04 needed several rounds of TikZ fixes.
- **Mermaid Chart MCP (Mermaid Chart Inc.)**: validate_and_render_mermaid_diagram validates Mermaid text and returns PNG and SVG with a playground link; a free account is enough. Rendering is hosted, not local (acc-09 used mermaid-cli for that). Speed bar not stated.

## Does the job, with a limit

It does the job, but something in the docs or a user's account will get in an agent's way. The limit is named in each row.

- **AI Diagram Maker MCP (AI Diagram Maker (Rajasekar Elango))**: generate_diagram_from_mermaid converts Mermaid to D2 and returns a PNG, but the conversion passes through AI and credits, the agent's own source isn't rendered as written, and it is hosted only.
- **draw.io + MCP (draw.io Ltd)**: Source is draw.io XML or Mermaid text, but PNG, SVG and PDF come only from the plugin with draw.io Desktop's CLI installed; the hosted server and tool server return links, not images.
- **Eraser API + MCP (Eraser Labs, Inc.)**: Eraser's own diagram-as-code is text the agent keeps, and export_diagram returns PNG, JPEG, SVG or PDF. Rendering is hosted only, and whether a syntax error fails the call or renders is not documented.
- **ExcaliClaw (ExcaliClaw)**: Mermaid text in, export_design gives PNG or SVG, but only Mermaid's structure is read, rendering is hosted only, and the terms couldn't be read because they render by script.
- **Excalidraw (Excalidraw s.r.o.)**: The CLI renders a local .excalidraw file to PNG or SVG in under a second with Chrome, and excalidraw mermaid turns Mermaid into SVG. Only some Mermaid types become shapes, the rest a static image, and acc-03 found the look too rough.
- **Lucid API + MCP (Lucid Software Inc.)**: Mermaid text goes in and the export endpoint returns PNG, JPEG or SVG of one page by Accept header, but rendering is hosted only, and an invalid body is a generic 400 with no line.
- **PlantUML (No legal entity found. Copyright Arnaud Roques)**: java -jar plantuml.jar --svg -pipe renders text locally to SVG, PNG or PDF and exits above 0 on a syntax error. Without --no-error-image a bad diagram still writes an image of the error, and the default LEGACY profile lets !include read files and URLs.
- **Structurizr + MCP (Structurizr Limited)**: The DSL is text and MCP exports views to Mermaid, PlantUML or C4-PlantUML text, which then need a second renderer. PNG and SVG come from a separate export command or a self-hosted server, since the cloud service closed.

- not this job: Cloudviz API (SIA Cloudviz Solutions): No diagram text input; it renders from a scanned AWS account.
- not this job: Diagrams.so API + MCP (RedHold LLC): Input is prose, not diagram code the agent keeps; there is no text source to commit and render.
- not this job: Mumble (tiny space): No diagram text language to commit and render; the canvas is JSON and images come from the app's PNG or PDF export.
- not this job: Mural MCP (Tactivos, Inc. (d/b/a Mural)): A whiteboard with no diagram-as-code format or text source to commit.
- not this job: tldraw SDK + MCP (tldraw, Inc.): No text diagram format or headless render; image export runs in the editor in a browser.
- not this job: Whimsical MCP (Whimsical, Inc.): Whimsical's syntax lives inside its boards; export is a PNG snapshot through fetch, with no SVG or source file to commit.

## What stops agents finishing

- syntax error rendered as an image of the error with a success status
- public render instance with no terms for private diagrams
- layout engine needs a paid licence

## Around it

Before: code.read-repo. After: code.open-pr, docs.write.

## Where this comes from

Weight 22 of 100 in Diagramming: 11 of 37 accounts (Mermaid, D2, PlantUML, Kroki, Structurizr export); what most HN users say they do day to day

As data: https://www.anchorterminal.com/api/v1/use-cases/diagramming.render-as-code.json, or the MCP tool get_use_case with id diagramming.render-as-code. Draft, read 2026-11-15 from public docs and first-hand accounts, not yet reviewed by a person.

---

Query this catalogue directly over MCP: https://www.anchorterminal.com/mcp (Streamable HTTP, no key). How: https://www.anchorterminal.com/agents/#mcp
