Skip to main content
Configures Mermaid with global settings that apply to all diagrams. This method should be called before rendering any diagrams with run() or render().

Signature

Parameters

MermaidConfig
required
Configuration object containing settings for Mermaid rendering.Common configuration options:

Return value

void - This method does not return a value.

Examples

Basic initialization

Custom theme configuration

Configuration for automatic rendering

Deterministic IDs for testing

Usage notes

  • Call initialize() before using run() or render()
  • Can be called multiple times to update configuration
  • Configuration merges with existing settings
  • When theme is specified, appropriate theme variables are automatically applied
  • The fontFamily setting is propagated to themeVariables.fontFamily if not already set
  • run() - Render all diagrams on the page
  • render() - Render a single diagram to SVG