# MermaidRenderer

Parses Mermaid source and renders every supported family through the canonical static engine.

 Class  

`ChartForgeX.Mermaid`

**Namespace**

`ChartForgeX.Mermaid`

**Assembly**

`ChartForgeX.Mermaid`

**Source**

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

**Modifiers**

static

Parses Mermaid source and renders every supported family through the canonical static engine.

## Inheritance

- object
- MermaidRenderer

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Mermaid diagrams in .NET](/mermaid/) Guide 
  
  Every supported family, rendered from the source shown with it.
- [Playground](/playground/) Sample 
  
  Edit Mermaid or ChartForgeX markup and render it in the browser.
- [Mermaid support matrix](/docs/mermaid-support-matrix/) Guide 
  
  What each Mermaid family renders, what it keeps without drawing, and what is not supported yet.

 Filter members   

    Show inherited   

 

## Methods

 Render 2 overloads 

 `public static MermaidRenderResult Render(string source, MermaidRenderOptions? options = null)` [#](#method-render-string-chartforgex-mermaid-mermaidrenderoptions) 

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

Produces a reusable artifact and located diagnostics. Source with errors never produces an artifact.

Parameters

**source string required**

**options ChartForgeX.Mermaid.MermaidRenderOptions? = null optional**

Returns

 `MermaidRenderResult` 

 `public static MermaidRenderResult Render(string source, MermaidRenderOptions? options, CancellationToken cancellationToken)` [#](#method-render-string-chartforgex-mermaid-mermaidrenderoptions-threading-cancellationtoken) 

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

Parses and converts a source request with cooperative cancellation.

Parameters

**source string required**

**options ChartForgeX.Mermaid.MermaidRenderOptions? required**

**cancellationToken System.Threading.CancellationToken required**

Returns

 `MermaidRenderResult` 

 `public static MermaidRenderResult RenderParsed(MermaidParseResult<MermaidDocument> parsed, MermaidRenderOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-renderparsed-chartforgex-mermaid-mermaidparseresult-chartforgex-mermaid-mermaiddocument-chartforgex-mermaid-mermaidrenderoptions-threading-cancellationtoken) 

[MermaidRenderer.cs:27](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidRenderer.cs#L27)

Converts an existing parse outcome without reparsing or losing its located diagnostics.

Parameters

**parsed ChartForgeX.Mermaid.MermaidParseResult<ChartForgeX.Mermaid.MermaidDocument> required**

**options ChartForgeX.Mermaid.MermaidRenderOptions? = null optional**

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

Returns

 `MermaidRenderResult` 

 `public static byte[] ToPng(MermaidDocument document, MermaidRenderOptions? options = null)` [#](#method-topng-chartforgex-mermaid-mermaiddocument-chartforgex-mermaid-mermaidrenderoptions) 

[MermaidRenderer.cs:117](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidRenderer.cs#L117)

Renders an already parsed document to PNG.

Parameters

**document ChartForgeX.Mermaid.MermaidDocument required**

**options ChartForgeX.Mermaid.MermaidRenderOptions? = null optional**

Returns

 `byte[]` 

 `public static string ToSvg(MermaidDocument document, MermaidRenderOptions? options = null)` [#](#method-tosvg-chartforgex-mermaid-mermaiddocument-chartforgex-mermaid-mermaidrenderoptions) 

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

Renders an already parsed document to SVG.

Parameters

**document ChartForgeX.Mermaid.MermaidDocument required**

**options ChartForgeX.Mermaid.MermaidRenderOptions? = null optional**

Returns

 `string` 

 `public static VisualArtifact ToVisualArtifact(MermaidDocument document, MermaidRenderOptions? options = null)` [#](#method-tovisualartifact-chartforgex-mermaid-mermaiddocument-chartforgex-mermaid-mermaidrenderoptions) 

[MermaidRenderer.cs:73](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Mermaid/MermaidRenderer.cs#L73)

Converts a parsed document through its native family using shared host defaults.

Parameters

**document ChartForgeX.Mermaid.MermaidDocument required**

**options ChartForgeX.Mermaid.MermaidRenderOptions? = null optional**

Returns

 `VisualArtifact` 

## 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:DFC405893B2E295CF952CF53E5DC79E478FC65A058648EE0F376BEBA5C25F2A6 -->
