MermaidConfig interface defines all configuration options available for Mermaid diagrams. This includes global settings, theme configuration, security options, and diagram-specific configurations.
Properties
The CSS style sheet theme for the diagram. You may also use
themeCSS to override this value.Variables to customize the selected theme.
Custom CSS to override theme styles.
Defines which main look to use for the diagram.
Seed for the handDrawn look. Important for automated tests as they will always find differences without the seed. Default value of 0 gives a random seed.
Defines which layout algorithm to use for rendering the diagram.
The maximum allowed size of the user’s text diagram.
Defines the maximum number of edges that can be drawn in a graph.
Configuration options for the ELK layout algorithm.
Enable dark mode styling.
Whether to use HTML tags for rendering labels on nodes and edges. Diagram-specific
htmlLabels settings are deprecated; use this root-level setting instead.Specifies the font to be used in the rendered diagrams. Can be any possible CSS
font-family.Alternative font family.
The amount of logging to be used by Mermaid.
Level of trust for parsed diagram.
strict: Only safe elements and attributes are allowedloose: All elements and attributes are allowedantiscript: Scripts are not allowedsandbox: Sandboxed rendering
Dictates whether Mermaid starts on page load.
Controls whether arrow markers in HTML code are absolute paths or anchors. This matters if you are using base tag settings.
Specifies which
currentConfig keys are considered secure and can only be changed via call to mermaid.initialize. This prevents malicious graph directives from overriding a site’s default security.Specifies if Mermaid can expect the dependent to include KaTeX stylesheets for browsers without their own MathML implementation. If disabled and MathML is not supported, math equations are replaced with a warning. If enabled and MathML is not supported, Mermaid falls back to legacy rendering for KaTeX.
Forces Mermaid to rely on KaTeX’s own stylesheet for rendering MathML. Due to differences between OS fonts and browser’s MathML implementation, this option is recommended if consistent rendering is important. If set to true, ignores
legacyMathML.Controls if the generated IDs of nodes in the SVG are generated randomly or based on a seed. If set to
false, the IDs are generated based on the current date and thus are not deterministic. This matters if your files are checked into source control (e.g., git) and should not change unless content is changed.Optional seed for deterministic IDs. If set to
undefined but deterministicIds is true, a simple number iterator is used. You can set this attribute to base the seed on a static string.Configuration options to pass to the
dompurify library.Enable text wrapping.
Default font size for diagrams.
Enable automatic wrapping for markdown content.
Suppresses inserting ‘Syntax error’ diagram in the DOM. This is useful when you want to control how to handle syntax errors in your application.
Diagram-specific configurations
Configuration specific to flowchart diagrams.
Configuration specific to sequence diagrams.
Configuration specific to Gantt diagrams.
Configuration specific to journey diagrams.
Configuration specific to timeline diagrams.
Configuration specific to class diagrams.
Configuration specific to state diagrams.
Configuration specific to entity relationship diagrams.
Configuration specific to pie diagrams.
Configuration specific to quadrant chart diagrams.
Configuration specific to XY chart diagrams.
Configuration specific to requirement diagrams.
Configuration specific to architecture diagrams.
Configuration specific to mindmap diagrams.
Configuration specific to Ishikawa diagrams.
Configuration specific to Kanban diagrams.
Configuration specific to Git graph diagrams.
Configuration specific to C4 diagrams.
Configuration specific to Sankey diagrams.
Configuration specific to packet diagrams.
Configuration specific to block diagrams.
Configuration specific to radar diagrams.
Configuration specific to Venn diagrams.