Skip to main content
The ParseResult interface represents the output of the Mermaid parse function. It contains information about the parsed diagram, including its type and configuration.

Properties

string
required
The type of diagram that was parsed (e.g., ‘flowchart’, ‘sequence’, ‘gantt’, ‘class’, ‘state’, etc.).
MermaidConfig
required
The configuration object for the diagram. This includes any config passed as YAML frontmatter or directives within the diagram definition.

Example usage

Basic parsing

Parsing with error handling

Parsing with suppressErrors option

Validating diagram syntax

Accessing diagram configuration

Type checking before rendering

TypeScript definition

Notes

  • The parse function validates diagram syntax without rendering it
  • When suppressErrors is false (default), invalid syntax throws an error
  • When suppressErrors is true, invalid syntax returns false instead of throwing
  • The config property contains merged configuration from frontmatter, directives, and global settings
  • Use parse to validate diagrams before rendering or to extract diagram metadata