Skip to content
Lower pricing Individual licenses are now $49/year for Studio, $25 for Core — See pricing →

Semantic Syntax Highlighting

Last updated:

Mermaid Studio provides accurate syntax highlighting for all supported diagram types, powered by dedicated Grammar-Kit based parsers that understand the structure and semantics of each diagram.

Most syntax highlighters use regular expressions to identify tokens based on patterns. This works well for many languages, but Mermaid presents a unique challenge: 20+ diagram types, each with its own syntax, where the same text can have entirely different meanings depending on context.

Mermaid Studio uses dedicated parsers that understand each diagram type’s grammar. This enables semantic highlighting: coloring tokens based on what they mean, not just what they look like. You can see at a glance whether something is a node ID, a label, a type reference, or a keyword.

Parser-based vs regex-based highlighting comparison

For example, every type identifier in a class-diagram member position is resolved against the file: declared classes, generic parameters from the owning class, primitives like int, built-ins like String and Optional, and collection types like List and Map each route to their own color-scheme attribute. A class List { } declaration in your file makes every List reference highlight as a declared class instead of a built-in collection.

This parser foundation also powers Mermaid Studio’s code completion, error detection, and refactoring capabilities.

A few diagram types run on a generic token-level tier while their dedicated grammars are on the roadmap; see Basic Syntax Highlighting for what that tier covers.

Syntax highlighting colors adapt to your current IDE color scheme. You can also customize individual element colors.

  1. Open Settings ( Command + Comma Control + Alt + S ).

  2. Navigate to Editor > Color Scheme > Mermaid Studio.

    Color Scheme settings on the Mermaid Studio page, with the Flowchart group expanded, its Arrow attribute selected, and the foreground, background, and font-style controls beside the highlighted preview

  3. Expand a group and select the element you want to customize.

  4. Adjust the foreground color, background color, or font style.

  5. Click Apply to see your changes.

Common holds the attributes shared across diagram types, and the other groups cover the types that expose additional elements of their own: Flowchart, Class Diagram, State Diagram, Ishikawa, and Railroad. Diagram types without a group of their own draw their colors from Common, so changing an attribute there applies everywhere it isn’t overridden.

Ishikawa (fishbone) diagrams use indentation-based depth highlighting, where causes at different nesting levels are colored distinctly. This makes it easy to see the hierarchy of causes at a glance without counting indentation levels.

Ishikawa depth-based highlighting

Mermaid Studio’s syntax highlighting is deeply integrated into IDE’s editor color scheme system, ensuring that default colors match your preferred theme without requiring additional configuration.

Themes