Mermaid

Gungnir
2022-03-12
2 min

INFO

This feature is disabled by default.

TIP

Code related to the disabled features will not be included in your site's bundle files.

Configuration

Use Mermaid via plugin-mermaid to create complex diagrams in Markdown:

theme: gungnirTheme({
  themePlugins: {
    mermaid: true
  }
})


 


If you want to customize the token of the fenced code block (which is mermaidjs by default):

theme: gungnirTheme({
  themePlugins: {
    mermaid: {
      token: "mermaid"
    }
  }
})



 



Themes

Mermaid supports multiple themes. By default, Gungnir uses default theme in light mode and dark in dark mode. You can also use other themes by configuring the plugin options:

theme: gungnirTheme({
  themePlugins: {
    mermaid: {
      theme: "default",  // default: "default"
      darkTheme: "dark"  // default: "dark"
    }
  }
})

Also see plugin-mermaid for more details.

Syntax

The token info of the code block should be mermaidjs (or your custom one), for example:

Code
```mermaidjs
sequenceDiagram
  Alice->John: Hello John, how are you?
  loop Every minute
    John-->Alice: Great!
  end
```

Refer to the documentation of Mermaid for more information.