collab/mermaid/docs/config/configuration.mdblame
View source
6dd74de1> **Warning**
6dd74de2>
6dd74de3> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
6dd74de4>
6dd74de5> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/configuration.md](../../packages/mermaid/src/docs/config/configuration.md).
6dd74de6
6dd74de7# Configuration
6dd74de8
6dd74de9When mermaid starts, configuration is extracted to determine a configuration to be used for a diagram. There are 3 sources for configuration:
6dd74de10
6dd74de11- The default configuration
6dd74de12- 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**.
6dd74de13- Frontmatter (v10.5.0+) - diagram authors can update selected configuration parameters in the frontmatter of the diagram. These are applied to the render config.
6dd74de14- 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.
6dd74de15
6dd74de16**The render config** is configuration that is used when rendering by applying these configurations.
6dd74de17
6dd74de18## Frontmatter config
6dd74de19
6dd74de20The 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.
6dd74de21
6dd74de22```mermaid-example
6dd74de23---
6dd74de24title: Hello Title
6dd74de25config:
6dd74de26 theme: base
6dd74de27 themeVariables:
6dd74de28 primaryColor: "#00ff00"
6dd74de29---
6dd74de30flowchart
6dd74de31 Hello --> World
6dd74de32
6dd74de33```
6dd74de34
6dd74de35```mermaid
6dd74de36---
6dd74de37title: Hello Title
6dd74de38config:
6dd74de39 theme: base
6dd74de40 themeVariables:
6dd74de41 primaryColor: "#00ff00"
6dd74de42---
6dd74de43flowchart
6dd74de44 Hello --> World
6dd74de45
6dd74de46```
6dd74de47
6dd74de48## Theme configuration
6dd74de49
6dd74de50## Starting mermaid
6dd74de51
6dd74de52```mermaid-example
6dd74de53sequenceDiagram
6dd74de54 Site->>mermaid: initialize
6dd74de55 Site->>mermaid: content loaded
6dd74de56 mermaid->>mermaidAPI: init
6dd74de57```
6dd74de58
6dd74de59```mermaid
6dd74de60sequenceDiagram
6dd74de61 Site->>mermaid: initialize
6dd74de62 Site->>mermaid: content loaded
6dd74de63 mermaid->>mermaidAPI: init
6dd74de64```
6dd74de65
6dd74de66## Initialize
6dd74de67
6dd74de68The initialize call is applied **only once**. It is called by the site integrator in order to override the default configuration at a site level.
6dd74de69
6dd74de70## configApi.reset
6dd74de71
6dd74de72This 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.