Syntax

You can declare positional and named attributes when using the block or macro form.

Positional attributes

Block form

  1. The first positional attribute specifies the diagram type.

  2. The second optional positional attribute assigns a file name (i.e., target) to the generated diagram.

  3. The third optional positional attribute specifies the image format.

[mermaid,abcd-flowchart,svg]
----
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
----

In the above example, the diagram type is mermaid, the target is abcd-flowchart, and the image format is svg.

Macro form

  1. The first optional positional attribute specifies the image format.

vegalite::chart.vlite[svg]

In the above example, the diagram type is vegalite, the target is chart.vlite, and the image format is svg.

Named attributes

You can combine positional and named attributes:

.PlantUML example
[plantuml#diagAliceBob,alice-and-bob,svg,role=sequence]
----
alice -> bob
----

In this example, an id is assigned using #diagAliceBob after the diagram type, and a role is defined using role=sequence.

With the macro form:

vegalite::chart.vlite[svg,role=chart,opts=interactive]

A positional attribute declares the image format, and two named attributes define the role and opts.

Attributes

The following attributes are used by the built-in HTML 5 converter:

Attribute Description

target

File name for the generated image

width

Image width

height

Image height

format

Image format (default: svg)

fallback

Fallback image if the diagram cannot be rendered

link

URL to link the image to

float

Image float (left or right)

align

Image alignment

role

CSS class(es) to apply to the image

title

Alternative text description of the diagram

Options

The following options are available when using the SVG format:

Option Description

inline

Inline the SVG content directly in the HTML

interactive

Make the SVG interactive (e.g., for Vega-Lite)

none

Cancel any default options

Options are defined using the options attribute (or opts for short):

[blockdiag,opts=inline]
----
blockdiag {
  Kroki -> generates -> "Block diagrams";

  Kroki [color = "greenyellow"];
  "Block diagrams" [color = "pink"];
}
----

Diagram-specific options

Any named attribute that is not a built-in attribute is forwarded to the Kroki server as a diagram-specific option (query parameter). This allows you to pass diagram type options supported by Kroki directly on the block or macro.

Consult the Kroki documentation for the available options per diagram type.

For example, Structurizr workspaces often define multiple views. By default, only the last view is rendered. Use the view-key option to specify which view to render:

[structurizr,view-key=SystemContext]
----
workspace {
  model {
    user = person "User"
    system = softwareSystem "Software System"
    user -> system "Uses"
  }
  views {
    systemContext system "SystemContext" {
      include *
    }
  }
}
----

Supported diagram types

Kroki currently supports the following diagram libraries:

Library Block/macro name

ActDiag

actdiag

BlockDiag

blockdiag

BPMN

bpmn

Bytefield

bytefield

C4 (PlantUML)

c4plantuml

D2

d2

DBML

dbml

Ditaa

ditaa

ERD

erd

Excalidraw

excalidraw

GraphViz

graphviz

Mermaid

mermaid

Nomnoml

nomnoml

NwDiag

nwdiag

PacketDiag

packetdiag

Pikchr

pikchr

PlantUML

plantuml

RackDiag

rackdiag

SeqDiag

seqdiag

SVGBob

svgbob

Symbolator

symbolator

UMLet

umlet

Vega

vega

Vega-Lite

vegalite

WaveDrom

wavedrom

Structurizr

structurizr

Diagrams.net [1]

diagramsnet

Each diagram library supports one or more output formats. Consult the Kroki documentation for the supported formats per library.


1. Only available via self-hosted Kroki.