Nodes/ComfyUI-UML/UML Render
ComfyUI Node

UML Render

The flagship render node — diagram text in, an image out, 28 diagram types deep

By antoinebou12·Created 6 months ago·Updated 17 days ago· 3
UML Render
  • code_input
  • IMAGE
  • path
  • kroki_url
  • content_for_viewer
  • viewer_url
backendweb
kroki_urlhttps://kroki.io
diagram_typemermaid
codesequenceDiagram participant Alice participant Bob Alice->John: Hello John, how are you? loop Healthcheck John->John: Fight against hypochondria end Note right of John: Rational thoughts prevail... John-->Alice: Great! John->Bob: How about you? Bob-->John: Jolly good!
output_formatpng
diagram_options
theme

UML Render (class name UMLDiagram) is the reason this pack exists. It takes diagram source code - Mermaid, PlantUML, Graphviz, D2, or any of 28 Kroki-supported dialects - and turns it into an actual image you can preview, save, and wire into the rest of your ComfyUI graph. If you've ever fought with a Mermaid renderer's browser quirks just to see a flowchart, this node is the answer to a question you didn't know you had: why not render diagrams inside ComfyUI like anything else?

The big idea is that it leans on Kroki, a free hosted service that renders dozens of diagram languages server-side. You paste in code, it does the rendering, you get bytes back. No local Chromium, no headless-browser dependency, no massive model download. The default backend is web, and the default kroki_url is https://kroki.io - it genuinely works with zero setup.

How it works

Mechanically it's simple: the node POSTs your code to {kroki_url}/{diagram_type}/{output_format}, gets the rendered bytes, and saves them to output/uml/ in your ComfyUI output folder. But there are two details worth knowing.

First, the LLM-fence cleanup. If code_input is connected (e.g. from an LLM node), it takes priority over the code widget, and the node aggressively strips markdown fences - ```mermaid ... ``` blocks get unwrapped, prose around the code gets dropped. Models love to wrap their output in fences, so this is the difference between "it rendered" and "Kroki choked on a backtick." This is exactly why the LLM nodes in this pack exist: they generate the code, and this node makes sure it survives contact with a language model.

Second, the outputs are unusually rich. It returns five things:

  • IMAGE - a proper ComfyUI image tensor for PNG/JPEG output (and SVG if you install cairosvg; otherwise a placeholder).
  • path - where the file landed under output/uml/.
  • kroki_url - a shareable GET URL (Kroki's deflate+base64 format, the same one the web UI uses). Paste it in a browser and anyone can see the diagram.
  • content_for_viewer - the raw SVG string when you render SVG, for feeding a viewer node.
  • viewer_url - a link into the pack's built-in zoomable viewer.

Right-click the node and "Open in viewer" is the fastest way to actually look at what you generated.

The inputs that matter

  • backend - web (Kroki, default) or local. Local only really pays off for Mermaid (needs Node.js + cd web/js && npm ci) or Graphviz (needs the graphviz Python package); otherwise it falls back to web anyway.
  • diagram_type - the big one. 28 choices, and your code has to match: mermaid code in the plantuml slot renders garbage.
  • code - the diagram source itself. Multiline, defaulting to a sample sequence diagram so you always have something that runs.
  • output_format - png, svg, jpeg, pdf, txt, base64. Not every format works for every diagram type; the node validates this and errors out clearly.
  • diagram_options - optional JSON passed to Kroki, e.g. {"theme": "dark"} for Mermaid/D2/PlantUML or {"scale": 1.5} for Graphviz. Invalid JSON fails the run with a message that tells you it's a JSON problem.
  • theme - a shortcut that merges into diagram_options (also used by local Mermaid).

Installing

One of five nodes in the antoinebou12/ComfyUI-UML pack:

comfy node install comfyui-uml
# or manually:
cd ComfyUI/custom_nodes && git clone https://github.com/antoinebou12/ComfyUI-UML
pip install -r requirements.txt

Restart after install. Base dependencies are just httpx and kroki; cairosvg is worth adding for real SVG previews, and comfy-dynamic-widgets hides the widgets you're not using.

Troubleshooting

  • "Kroki error: ..." - the service is unreachable or rejected the request. Check your internet, and remember Kroki is a free public service, not a guarantee. If you're offline or behind a proxy, that's when backend: local earns its keep.
  • Format not supported for this type - the node says so clearly; e.g. bpmn only outputs SVG. Match the type, or switch to a format it allows.
  • Placeholder image - normal for PDF/txt/base64 output, which are saved to disk but have no raster preview. Not a bug.
  • Pasted a workflow with missing nodes - the README's stock answer: load workflows/uml_single_node.json from the repo, which is the minimal UML Render + viewer combo, and build up from there.

Small-pack caveat: this is a young, MIT-licensed project from a solo author with CI tests but a small user base. For diagrams it's fine - for anything you'd stake a production system on, treat it as the handy side-tool it is.

CategoryUML

Inputs (8)

NameTypeDefaultDescription
backendCOMBOweb2 options: web, local
kroki_urlSTRINGhttps://kroki.io
diagram_typeCOMBOmermaid28 options: actdiag, blockdiag, bpmn, bytefield, c4plantuml, d2, +22
codeSTRINGsequenceDiagram participant Alice participant Bob Alice->John: Hello John, how are you? loop Healthcheck John->John: Fight against hypochondria end Note right of John: Rational thoughts prevail... John-->Alice: Great! John->Bob: How about you? Bob-->John: Jolly good!
code_inputopt*
output_formatoptCOMBOpng6 options: png, svg, jpeg, pdf, txt, base64
diagram_optionsoptSTRING
themeoptSTRING

Outputs (5)

NameTypeDescription
IMAGEIMAGE
pathSTRING
kroki_urlSTRING
content_for_viewerSTRING
viewer_urlSTRING