Configuration
Attributes
| Attribute | Description | Default |
|---|---|---|
|
The URL of the Kroki server. See Self-Hosted Kroki. |
|
|
Embed images as data-URI elements in HTML so the file is completely self-contained. |
|
|
Download images from the Kroki server and save them to disk. Not available in the browser. |
|
|
How to retrieve images from the Kroki server:
|
|
|
A file included at the top of every PlantUML diagram, as if |
|
|
Additional search paths for resolving |
|
|
Maximum URI length before switching to POST when using the |
|
|
|
Default format
By default, images are generated as SVG when possible.
To change this, set the kroki-default-format attribute:
:kroki-default-format: png
Unset it with :kroki-default-format!: or restore the default with :kroki-default-format: svg.
|
An AsciiDoc attribute can be defined through the CLI or API, in the document header, or in the document body. If you are using Antora, you can define attributes in your playbook and/or component descriptor.
The References: |
Default options
By default, Asciidoctor Kroki generates a link to the Kroki server or a local file for SVG diagrams.
To change this default behavior, set the kroki-default-options attribute:
:kroki-default-options: inline
Unset it with :kroki-default-options: none, :kroki-default-options!:, or override it per block or macro using opts=none.
Generated file names
When kroki-fetch-diagram is set, diagrams are downloaded and saved to disk.
The generated file name depends on whether you give the diagram a name:
-
Named diagram — the name is used as-is, so the link stays stable even when the diagram content changes:
[plantuml,my-diagram] .... alice -> bob ....generates
my-diagram.svg. -
Anonymous diagram — a content-addressed name such as
diag-<checksum>.svgis generated so anonymous diagrams never collide.
|
If the same name is used for two diagrams with different content in the same document, the file is overwritten and a warning is logged. Use unique names to keep links stable. |
Preprocessing
Some diagram libraries support referencing external entities by URL or accessing filesystem resources.
For example, PlantUML supports the !import directive, and Vega-Lite can load data from a URL.
By default, the Kroki server runs in SECURE mode, which restricts access to the local file system and external network resources.
To work around this, Asciidoctor Kroki resolves and loads external resources before sending the request to the Kroki server.
This feature is only available when Asciidoctor safe mode is server or lower.
|
Preprocessing is implemented in the JavaScript/Node.js extension only.
The Ruby gem does not resolve includes locally and instead relies on the Kroki server to resolve them (for example by running the server with |
Feature parity (JavaScript vs Ruby)
The JavaScript/Node.js extension and the Ruby gem share the same version and are released together, but a few features are currently available in the JavaScript/Node.js extension only:
| Feature | JavaScript | Ruby |
|---|---|---|
Preprocessing of PlantUML |
Yes |
No (resolved by the Kroki server) |
Preprocessing of Structurizr |
Yes |
No (resolved by the Kroki server) |
Preprocessing of Vega-Lite |
Yes |
No (resolved by the Kroki server) |
|
Yes |
No |
|
Yes |
Yes |
|
Yes |
Yes |
| Antora uses the JavaScript/Node.js extension, so preprocessing is fully available in an Antora pipeline. |