MermaidDocument Class
A diagram read from the Mermaid text format: its content, and the warnings about the valid parts that are not supported. The front matter (title, config), the %%{init: ...}%% directives, the %% comments and the accessibility statements are read for every type of diagram.
public sealed class MermaidDocumentProperties
| Name | Description |
|---|---|
| Content | Gets what the text describes: a Diagram of Meziantou.Framework.Diagrams, such as a FlowchartDiagram, or a MermaidChart drawn with Meziantou.Framework.Charts, such as a PieChart. Cast it to its type to read or change it. |
| DiagramType | Gets the keyword that declares the type of the diagram, such as flowchart or classDiagram. |
| SupportedDiagramTypes | Gets the keywords of the types of diagrams that can be read. |
| Warnings | Gets the parts of the text that are valid Mermaid but are not supported, and are ignored. |
Content
MermaidDocument.csGets what the text describes: a Diagram of Meziantou.Framework.Diagrams, such as a FlowchartDiagram, or a MermaidChart drawn with Meziantou.Framework.Charts, such as a PieChart. Cast it to its type to read or change it.
public ISceneSource Content { get; }Property value
DiagramType
MermaidDocument.csSupportedDiagramTypes
MermaidDocument.csGets the keywords of the types of diagrams that can be read.
public static IReadOnlyList<string> SupportedDiagramTypes { get; }Property value
Warnings
MermaidDocument.csGets the parts of the text that are valid Mermaid but are not supported, and are ignored.
public IReadOnlyList<MermaidWarning> Warnings { get; }Property value
Methods
| Name | Description |
|---|---|
| Parse(string, MermaidParseOptions?) | Reads a Mermaid text. |
| TryParse(string?, MermaidDocument?) | Tries to read a Mermaid text. |
| TryParse(string?, MermaidParseOptions?, MermaidDocument?, MermaidParseError) | Tries to read a Mermaid text. |
Parse(string, MermaidParseOptions?)
MermaidDocument.csReads a Mermaid text.
public static MermaidDocument Parse(string text, MermaidParseOptions? options = null)Parameters
textstring- The text.
optionsMermaidParseOptions?- The options, or
nullforMermaidParseOptions.Default.
Returns
MermaidDocument The document.
Exceptions
MermaidParseException- The text is not valid, or its type of diagram is not supported.
TryParse overloads
TryParse(string?, MermaidDocument?)
MermaidDocument.csTries to read a Mermaid text.
public static bool TryParse(string? text, out MermaidDocument? document)Parameters
textstring?- The text.
documentMermaidDocument?- The document, when the method returns
true.
Returns
bool true when the text is valid.
TryParse(string?, MermaidParseOptions?, MermaidDocument?, MermaidParseError)
MermaidDocument.csTries to read a Mermaid text.
public static bool TryParse(string? text, MermaidParseOptions? options, out MermaidDocument? document, out MermaidParseError error)Parameters
textstring?- The text.
optionsMermaidParseOptions?- The options, or
nullforMermaidParseOptions.Default. documentMermaidDocument?- The document, when the method returns
true. errorMermaidParseError- The error, when the method returns
false.
Returns
bool true when the text is valid.