Using different types of Directives
All directives are comments formatted in a special way to allow passing configuration parameters to Mermaid.
The syntax of directives is simple: they start with the line comment format, %%
, followed by an opening bracket, {
, then the directive, and finally a closing bracket, }
(matching the opening one):
%%{directive}
There are several types of directives. We will cover them all, but let's start by looking at the most important and versatile type: the init
or initialize
directive.
The init directive
This is a directive that you can use to modify the initial configuration of the Mermaid diagram. This directive starts with init
or initialize
keyword, followed by a colon (:
) and a JSON formatted configuration object:
%%{init: configuration-object}
Let's look at an example of using the init
directive. There is a configuration option that you can use to turn mirrorActors
on or off in sequence diagrams. We used...