Kroki Edge Cases

Kroki Edge Cases

Companion to [[Misc/Kroki Diagram Tests]]. Part 1 covers every remaining block name with a non-trivial diagram; part 2 pokes at the fence parser, the @from_file: resolver, encoding and failure paths. Each block states the expected result.

Part 1: complex diagrams per engine

Mermaid (local, several diagram kinds)

Sequence diagram with activation, loop and notes:

Mermaid diagram

Class diagram with generics, relations and notes:

Mermaid diagram

State diagram with composite state and fork:

Mermaid diagram

Gantt chart (date scales, sections):

Mermaid diagram

Pie chart and ER diagram:

Mermaid diagram

Mermaid diagram

Mermaid init directive and entity-escaped labels (#quot;, #lt; are Mermaid's own escapes):

Mermaid diagram

PlantUML (mindmap, JSON, skinparam)

PlantUML diagram

PlantUML diagram

PlantUML diagram

C4 with PlantUML

C4 with PlantUML diagram

GraphViz (subgraphs, HTML-like labels, unicode)

GraphViz diagram

D2 (containers, shapes, styled edges)

D2 diagram

BlockDiag family (actdiag, nwdiag, packetdiag, rackdiag)

ActDiag diagram

NwDiag diagram

PacketDiag diagram

RackDiag diagram

Ditaa

Ditaa diagram

Pikchr

Pikchr diagram

Svgbob (larger ASCII art)

Svgbob diagram

UMLet

UMlet diagram

Symbolator (VHDL entity)

Symbolator diagram

WireViz

WireViz diagram

Excalidraw (full file format)

Excalidraw diagram

BPMN (small but complete, with DI)

BPMN diagram

Structurizr (container view)

Structurizr diagram

TikZ (nodes, loops, decorations)

TikZ diagram

Vega-Lite (layered chart with text labels)

Vega-Lite diagram

DBML (enums, notes, indexes, composite keys)

DBML diagram

WaveDrom (head, foot, groups, config)

WaveDrom diagram

Bytefield diagram

Nomnoml (directives, classifiers, nesting)

Nomnoml diagram

Part 2: outliers

Info-string variations

Extra tokens after the language are ignored (first word wins). Expected: an image.

GraphViz diagram

markdown-it-attrs braces are stripped before rendering. Expected: an image.

GraphViz diagram

Tilde fences are still fences. Expected: an image.

GraphViz diagram

Block names are case-sensitive, like the plugin. Expected: a plain code block.

digraph { case -> sensitive }

Unknown prefix. Expected: a plain code block.

digraph { unknown -> prefix }

Nesting

Inside a callout. Expected: an image inside the callout box.

diagram in a callout

A diagram inside an admonition block:

GraphViz diagram

Inside a blockquote. Expected: an image, indented as a quote.

A quoted diagram:

GraphViz diagram

Inside a list item. Expected: an image under the second bullet.

A fence shown as literal text inside a four-backtick markdown block. Expected: a code block showing the text, no image.

```graphviz
digraph { literal -> text }
```

Bodies

Empty body. Expected: a plain code block (nothing is sent anywhere).

Whitespace-only body. Expected: a plain code block.




Special characters that must survive HTML escaping and URL encoding (<, >, &, quotes, backslashes, tabs, emoji). Expected: an image with the exact labels.

GraphViz diagram

The same in a locally rendered type. Expected: an image with the exact labels.

Nomnoml diagram

Exact duplicate of an earlier diagram (same source, same type). Expected: an image sharing the same /diagrams/<md5>.svg as the tilde-fence example above.

GraphViz diagram

Size

A high-entropy GraphViz graph (400 nodes with random labels) whose encoded URL is about 7.4 KB. Kroki's default KROKI_MAX_URI_LENGTH is 4096 and kroki.io answers HTTP 414 for this one. Expected: [Kroki] Failed to download in a production build and a broken image with the remote URL left in place. A self-hosted Kroki with a raised limit renders it; obsidian-kroki has the same limitation.

GraphViz diagram

A large diagram in a locally rendered type never touches a URL, so size limits do not apply. Expected: an image (large).

Nomnoml diagram

@from_file: variations

Leading blank line and trailing text after the path line are tolerated. Expected: the same image as the basic include test.

GraphViz diagram

Windows-style separators. Expected: the same image.

GraphViz diagram

A different engine from an include (.puml). Expected: a PlantUML image.

PlantUML diagram

Path traversal. Expected: an error block "escapes the notes directory".

Kroki (graphviz): Include path escapes the notes directory: ../../../package.json

Absolute path. Expected: an error block "escapes the notes directory".

Kroki (graphviz): Included file not found: C:/Windows/win.ini

Directory instead of a file. Expected: an error block "Could not read included file".

Kroki (graphviz): Could not read included file Misc/kroki-includes: EISDIR: illegal operation on a directory, read

Keyword without a path. Expected: an error block "requires a path".

Kroki (graphviz): @from_file: requires a path

Keyword not at the start of the body is just diagram source. Expected: a Kroki syntax error, so a download failure and a broken image (see next section).

GraphViz diagram

Invalid sources (failure paths)

Invalid GraphViz. Expected in npm run build: [Kroki] Failed to download (HTTP 400) and the remote URL kept, which the browser shows as a broken image. In dev: the remote URL is requested by the browser and returns 400.

GraphViz diagram

Invalid Mermaid. Expected: [Kroki] Local render failed (mermaid) followed by a download attempt; kroki.io answers 400 (or 500 while its Mermaid service is down), so the remote URL is kept.

Mermaid diagram

Mermaid diagram kind that isomorphic-mermaid may not support (gitGraph). Expected: either a local image or a logged local failure plus a Kroki fallback.

Mermaid diagram

Vega-Lite referencing remote data. Expected: the local renderer fetches the URL at build time (network access); if that fails the build falls back to Kroki, which also needs network.

Vega-Lite diagram