# MermaidParser

Parses Mermaid source into source-preserving document models.

 Class  

`ChartForgeX.Mermaid`

**Namespace**

`ChartForgeX.Mermaid`

**Assembly**

`ChartForgeX.Mermaid`

**Source**

[MermaidParser.cs:18](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.cs#L18)

**Modifiers**

sealed

Parses Mermaid source into source-preserving document models.

## Inheritance

- object
- MermaidParser

 Filter members   

    Show inherited   

 

## Constructors

 `public MermaidParser()` [#](#constructor-ctor) 

## Methods

 Parse 3 overloads 

 `public MermaidParseResult<MermaidDocument> Parse(string source)` [#](#method-parse-string) 

[MermaidParser.cs:18](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.cs#L18)

Parses Mermaid source and detects the diagram family.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidDocument>` The parse result. 

 `public MermaidParseResult<MermaidDocument> Parse(string source, MermaidParseOptions? options)` [#](#method-parse-string-chartforgex-mermaid-mermaidparseoptions) 

[MermaidParser.cs:24](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.cs#L24)

Parses source using explicit calendar context for formats that require it.

Parameters

**source string required**

The Mermaid source text.

**options ChartForgeX.Mermaid.MermaidParseOptions? required**

Optional source-resolution context.

Returns

 `MermaidParseResult<MermaidDocument>` The source-preserving document and located diagnostics. 

 `public MermaidParseResult<MermaidDocument> Parse(string source, MermaidParseOptions? options, CancellationToken cancellationToken)` [#](#method-parse-string-chartforgex-mermaid-mermaidparseoptions-threading-cancellationtoken) 

[MermaidParser.cs:32](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.cs#L32)

Parses source with captured resource bounds and cooperative cancellation.

Parameters

**source string required**

The Mermaid source text.

**options ChartForgeX.Mermaid.MermaidParseOptions? required**

Calendar context and resource policy; null uses defaults.

**cancellationToken System.Threading.CancellationToken required**

Cancellation checked during source scanning and semantic parser loops.

Returns

 `MermaidParseResult<MermaidDocument>` The parsed document, or a located resource diagnostic when a captured bound is exceeded. 

 `public MermaidParseResult<MermaidAgentflowDocument> ParseAgentflow(string source)` [#](#method-parseagentflow-string) 

[MermaidParser.Agentflow.cs:6](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Agentflow.cs#L6)

Parses an inert native Agentflow document with the default captured source policy.

Parameters

**source string required**

Returns

 `MermaidParseResult<MermaidAgentflowDocument>` 

 `public MermaidParseResult<MermaidArchitectureDocument> ParseArchitecture(string source)` [#](#method-parsearchitecture-string) 

[MermaidParser.Typed.cs:254](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L254)

Parses Mermaid source as an architecture diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidArchitectureDocument>` The parse result. 

 `public MermaidParseResult<MermaidBlockDocument> ParseBlock(string source)` [#](#method-parseblock-string) 

[MermaidParser.Block.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Block.cs#L10)

Parses Mermaid source as a block diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidBlockDocument>` The parse result. 

 `public MermaidParseResult<MermaidC4Document> ParseC4(string source)` [#](#method-parsec4-string) 

[MermaidParser.C4.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.C4.cs#L10)

Parses Mermaid source as a C4 diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidC4Document>` The parse result. 

 `public MermaidParseResult<MermaidClassDocument> ParseClass(string source)` [#](#method-parseclass-string) 

[MermaidParser.Typed.cs:66](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L66)

Parses Mermaid source as a class diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidClassDocument>` The parse result. 

 `public MermaidParseResult<MermaidCynefinDocument> ParseCynefin(string source)` [#](#method-parsecynefin-string) 

[MermaidParser.Cynefin.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Cynefin.cs#L10)

Parses source as a source-preserving Cynefin domain document.

Parameters

**source string required**

Returns

 `MermaidParseResult<MermaidCynefinDocument>` 

 `public MermaidParseResult<MermaidEntityRelationshipDocument> ParseEntityRelationship(string source)` [#](#method-parseentityrelationship-string) 

[MermaidParser.Typed.cs:94](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L94)

Parses Mermaid source as an entity relationship diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidEntityRelationshipDocument>` The parse result. 

 `public MermaidParseResult<MermaidEventModelingDocument> ParseEventModeling(string source)` [#](#method-parseeventmodeling-string) 

[MermaidParser.EventModeling.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.EventModeling.cs#L10)

Parses Mermaid source as an Event Modeling document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidEventModelingDocument>` The parse result. 

 `public MermaidParseResult<MermaidFlowchartDocument> ParseFlowchart(string source)` [#](#method-parseflowchart-string) 

[MermaidParser.Typed.cs:24](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L24)

Parses Mermaid source as a flowchart document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidFlowchartDocument>` The parse result. 

 ParseGantt 2 overloads 

 `public MermaidParseResult<MermaidGanttDocument> ParseGantt(string source)` [#](#method-parsegantt-string) 

[MermaidParser.Typed.cs:107](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L107)

Parses Mermaid source as a Gantt diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidGanttDocument>` The parse result. 

 `public MermaidParseResult<MermaidGanttDocument> ParseGantt(string source, MermaidParseOptions? options)` [#](#method-parsegantt-string-chartforgex-mermaid-mermaidparseoptions) 

[MermaidParser.Typed.cs:114](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L114)

Parses a Gantt document with explicit context for input formats that omit the year.

Parameters

**source string required**

The Mermaid source text.

**options ChartForgeX.Mermaid.MermaidParseOptions? required**

Optional source-resolution context.

Returns

 `MermaidParseResult<MermaidGanttDocument>` The Gantt document and located diagnostics. 

 `public MermaidParseResult<MermaidGitGraphDocument> ParseGitGraph(string source)` [#](#method-parsegitgraph-string) 

[MermaidParser.GitGraph.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.GitGraph.cs#L10)

Parses Mermaid source as a git graph diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidGitGraphDocument>` The parse result. 

 `public MermaidParseResult<MermaidIshikawaDocument> ParseIshikawa(string source)` [#](#method-parseishikawa-string) 

[MermaidParser.Ishikawa.cs:12](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Ishikawa.cs#L12)

Parses Mermaid source as an Ishikawa diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidIshikawaDocument>` The parse result. 

 `public MermaidParseResult<MermaidJourneyDocument> ParseJourney(string source)` [#](#method-parsejourney-string) 

[MermaidParser.Typed.cs:52](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L52)

Parses Mermaid source as a user journey document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidJourneyDocument>` The parse result. 

 `public MermaidParseResult<MermaidKanbanDocument> ParseKanban(string source)` [#](#method-parsekanban-string) 

[MermaidParser.Typed.cs:240](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L240)

Parses Mermaid source as a kanban diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidKanbanDocument>` The parse result. 

 `public MermaidParseResult<MermaidMindMapDocument> ParseMindMap(string source)` [#](#method-parsemindmap-string) 

[MermaidParser.Typed.cs:170](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L170)

Parses Mermaid source as a mindmap document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidMindMapDocument>` The parse result. 

 `public MermaidParseResult<MermaidPacketDocument> ParsePacket(string source)` [#](#method-parsepacket-string) 

[MermaidParser.Packet.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Packet.cs#L10)

Parses Mermaid source as a packet diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidPacketDocument>` The parse result. 

 `public MermaidParseResult<MermaidPieDocument> ParsePie(string source)` [#](#method-parsepie-string) 

[MermaidParser.Typed.cs:38](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L38)

Parses Mermaid source as a pie chart document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidPieDocument>` The parse result. 

 `public MermaidParseResult<MermaidQuadrantDocument> ParseQuadrant(string source)` [#](#method-parsequadrant-string) 

[MermaidParser.Typed.cs:142](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L142)

Parses Mermaid source as a quadrant chart document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidQuadrantDocument>` The parse result. 

 `public MermaidParseResult<MermaidRadarDocument> ParseRadar(string source)` [#](#method-parseradar-string) 

[MermaidParser.Typed.cs:212](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L212)

Parses Mermaid source as a radar diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidRadarDocument>` The parse result. 

 ParseRailroad 2 overloads 

 `public MermaidParseResult<MermaidRailroadDocument> ParseRailroad(string source)` [#](#method-parserailroad-string) 

[MermaidParser.Railroad.cs:7](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Railroad.cs#L7)

Parses any of the four supported railroad frontend headers.

Parameters

**source string required**

Returns

 `MermaidParseResult<MermaidRailroadDocument>` 

 `public MermaidParseResult<MermaidRailroadDocument> ParseRailroad(string source, MermaidParseOptions? options, CancellationToken cancellationToken = default)` [#](#method-parserailroad-string-chartforgex-mermaid-mermaidparseoptions-threading-cancellationtoken) 

[MermaidParser.Railroad.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Railroad.cs#L10)

Parses railroad source with captured resource bounds and cooperative cancellation.

Parameters

**source string required**

**options ChartForgeX.Mermaid.MermaidParseOptions? required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

 `MermaidParseResult<MermaidRailroadDocument>` 

 `public MermaidParseResult<MermaidRequirementDocument> ParseRequirement(string source)` [#](#method-parserequirement-string) 

[MermaidParser.Typed.cs:156](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L156)

Parses Mermaid source as a requirement diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidRequirementDocument>` The parse result. 

 `public MermaidParseResult<MermaidSankeyDocument> ParseSankey(string source)` [#](#method-parsesankey-string) 

[MermaidParser.Typed.cs:198](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L198)

Parses Mermaid source as a Sankey diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidSankeyDocument>` The parse result. 

 `public MermaidParseResult<MermaidSequenceDocument> ParseSequence(string source)` [#](#method-parsesequence-string) 

[MermaidParser.Typed.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L10)

Parses Mermaid source as a sequence diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidSequenceDocument>` The parse result. 

 `public MermaidParseResult<MermaidStateDocument> ParseState(string source)` [#](#method-parsestate-string) 

[MermaidParser.Typed.cs:80](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L80)

Parses Mermaid source as a state diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidStateDocument>` The parse result. 

 `public MermaidParseResult<MermaidTimelineDocument> ParseTimeline(string source)` [#](#method-parsetimeline-string) 

[MermaidParser.Typed.cs:128](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L128)

Parses Mermaid source as a timeline diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidTimelineDocument>` The parse result. 

 `public MermaidParseResult<MermaidTreemapDocument> ParseTreemap(string source)` [#](#method-parsetreemap-string) 

[MermaidParser.Typed.cs:226](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L226)

Parses Mermaid source as a treemap diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidTreemapDocument>` The parse result. 

 `public MermaidParseResult<MermaidTreeViewDocument> ParseTreeView(string source)` [#](#method-parsetreeview-string) 

[MermaidParser.TreeView.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.TreeView.cs#L10)

Parses Mermaid source as a tree view document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidTreeViewDocument>` The parse result. 

 `public MermaidParseResult<MermaidVennDocument> ParseVenn(string source)` [#](#method-parsevenn-string) 

[MermaidParser.Venn.cs:12](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Venn.cs#L12)

Parses Mermaid source as a Venn diagram document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidVennDocument>` The parse result. 

 `public MermaidParseResult<MermaidWardleyDocument> ParseWardley(string source)` [#](#method-parsewardley-string) 

[MermaidParser.Wardley.cs:10](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Wardley.cs#L10)

Parses Mermaid source as a Wardley map document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidWardleyDocument>` The parse result. 

 `public MermaidParseResult<MermaidXYChartDocument> ParseXYChart(string source)` [#](#method-parsexychart-string) 

[MermaidParser.Typed.cs:184](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.Typed.cs#L184)

Parses Mermaid source as an XY chart document.

Parameters

**source string required**

The Mermaid source text.

Returns

 `MermaidParseResult<MermaidXYChartDocument>` The parse result. 

 ParseZenUml 2 overloads 

 `public MermaidParseResult<MermaidZenUmlDocument> ParseZenUml(string source)` [#](#method-parsezenuml-string) 

[MermaidParser.ZenUml.cs:7](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.ZenUml.cs#L7)

Parses a typed native ZenUML occurrence tree with captured source bounds.

Parameters

**source string required**

Returns

 `MermaidParseResult<MermaidZenUmlDocument>` 

 `public MermaidParseResult<MermaidZenUmlDocument> ParseZenUml(string source, MermaidParseOptions? options, CancellationToken cancellationToken = default)` [#](#method-parsezenuml-string-chartforgex-mermaid-mermaidparseoptions-threading-cancellationtoken) 

[MermaidParser.ZenUml.cs:11](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidParser.ZenUml.cs#L11)

Parses typed ZenUML occurrences with captured resource bounds and cancellation.

Parameters

**source string required**

**options ChartForgeX.Mermaid.MermaidParseOptions? required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

 `MermaidParseResult<MermaidZenUmlDocument>` 

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

<!-- PowerForge markdown artifact sha256:D218B6E959AA3C246F885A7E3DB085BE3606D7C97D7D9075684AC047202472A2 -->
