2.2 KB73 lines
Blame
1> **Warning**
2>
3> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
4>
5> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/configuration.md](../../packages/mermaid/src/docs/config/configuration.md).
6
7# Configuration
8
9When mermaid starts, configuration is extracted to determine a configuration to be used for a diagram. There are 3 sources for configuration:
10
11- The default configuration
12- Overrides at the site level are set by the initialize call, and will be applied to all diagrams in the site/app. The term for this is the **siteConfig**.
13- Frontmatter (v10.5.0+) - diagram authors can update selected configuration parameters in the frontmatter of the diagram. These are applied to the render config.
14- Directives (Deprecated by Frontmatter) - diagram authors can update selected configuration parameters directly in the diagram code via directives. These are applied to the render config.
15
16**The render config** is configuration that is used when rendering by applying these configurations.
17
18## Frontmatter config
19
20The entire mermaid configuration (except the secure configs) can be overridden by the diagram author in the frontmatter of the diagram. The frontmatter is a YAML block at the top of the diagram.
21
22```mermaid-example
23---
24title: Hello Title
25config:
26 theme: base
27 themeVariables:
28 primaryColor: "#00ff00"
29---
30flowchart
31 Hello --> World
32
33```
34
35```mermaid
36---
37title: Hello Title
38config:
39 theme: base
40 themeVariables:
41 primaryColor: "#00ff00"
42---
43flowchart
44 Hello --> World
45
46```
47
48## Theme configuration
49
50## Starting mermaid
51
52```mermaid-example
53sequenceDiagram
54 Site->>mermaid: initialize
55 Site->>mermaid: content loaded
56 mermaid->>mermaidAPI: init
57```
58
59```mermaid
60sequenceDiagram
61 Site->>mermaid: initialize
62 Site->>mermaid: content loaded
63 mermaid->>mermaidAPI: init
64```
65
66## Initialize
67
68The initialize call is applied **only once**. It is called by the site integrator in order to override the default configuration at a site level.
69
70## configApi.reset
71
72This method resets the configuration for a diagram to the overall site configuration, which is the configuration provided by the site integrator. Before each rendering of a diagram, reset is called at the very beginning.
73