Kroki Reference
Kroki unified diagram rendering. Container lifecycle, AsciiDoc block syntax for D2/Mermaid/GraphViz/PlantUML, and troubleshooting.
What Kroki Does
Kroki provides a unified HTTP API to render diagrams from textual descriptions. In the Antora workflow, Kroki runs as a local container during build, converting diagram source blocks into SVG images.
Container Lifecycle
podman run -d --name kroki -p 8000:8000 yuzutech/kroki
# Or with Docker:
docker run -d --name kroki -p 8000:8000 yuzutech/kroki
make # Starts Kroki, builds, stops Kroki
make serve # Starts Kroki, builds, stops Kroki, serves
podman stop kroki && podman rm kroki
AsciiDoc Integration
[d2,target=my-diagram,format=svg]
....
server -> database: queries
server -> cache: lookups
....
[mermaid,target=flow-diagram,format=svg]
....
graph LR
A[Start] --> B{Decision}
B -->|Yes| C[Action]
B -->|No| D[End]
....
[graphviz,target=graph,format=svg]
....
digraph {
rankdir=LR
A -> B -> C
}
....
[plantuml,target=sequence,format=svg]
....
@startuml
Client -> Server: Request
Server -> Database: Query
Database --> Server: Result
Server --> Client: Response
@enduml
....
Supported Diagram Types
| Type | Block Identifier |
|---|---|
D2 |
|
Mermaid |
|
GraphViz |
|
PlantUML |
|
Ditaa |
|
Structurizr |
|
BPMN |
|
Bytefield |
|
Antora Playbook Configuration
asciidoc:
extensions:
- asciidoctor-kroki
attributes:
kroki-server-url: http://localhost:8000
kroki-fetch-diagram: true
kroki-fetch-diagram: true downloads rendered images during build, embedding them in the output. Without it, diagrams are fetched at page load time.
Output Formats
[d2,target=diagram,format=svg]
[d2,target=diagram,format=png]
SVG is preferred: scalable, searchable text, smaller files.
Troubleshooting
podman ps | grep kroki
# If empty, start it:
podman run -d --name kroki -p 8000:8000 yuzutech/kroki
curl -s http://localhost:8000/d2/svg \
-H "Content-Type: text/plain" \
-d 'a -> b' | head -5
# Should return SVG XML
podman logs kroki 2>&1 | tail -20