MarkdownRenderX.Avalonia.Mermaid 12.1.3.8

dotnet add package MarkdownRenderX.Avalonia.Mermaid --version 12.1.3.8
                    
NuGet\Install-Package MarkdownRenderX.Avalonia.Mermaid -Version 12.1.3.8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MarkdownRenderX.Avalonia.Mermaid" Version="12.1.3.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MarkdownRenderX.Avalonia.Mermaid" Version="12.1.3.8" />
                    
Directory.Packages.props
<PackageReference Include="MarkdownRenderX.Avalonia.Mermaid" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MarkdownRenderX.Avalonia.Mermaid --version 12.1.3.8
                    
#r "nuget: MarkdownRenderX.Avalonia.Mermaid, 12.1.3.8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MarkdownRenderX.Avalonia.Mermaid@12.1.3.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MarkdownRenderX.Avalonia.Mermaid&version=12.1.3.8
                    
Install as a Cake Addin
#tool nuget:?package=MarkdownRenderX.Avalonia.Mermaid&version=12.1.3.8
                    
Install as a Cake Tool

Mermaid Diagrams for MarkdownRenderX.Avalonia

English | 简体中文

Renders ```mermaid fenced code blocks as native SVG diagrams inside MarkdownRenderX.Avalonia. No WebView, no browser, no JavaScript runtime — everything is pure .NET.

<PackageReference Include="MarkdownRenderX.Avalonia.Mermaid" Version="12.1.3.7" />

Usage

Register once at application startup:

using MarkdownRenderX.Avalonia.Mermaid;

MermaidExtension.Register();

That is all — no StyleInclude, no resource dictionary, no extra initialization. Because FluentAvalonia.MarkdownRender is a companion package built on the same core, the same single registration also enables Mermaid in FAMR.

```mermaid
flowchart LR
    A[Start] --> B{Decision}
    B -- yes --> C[Done]
    B -- no  --> A
```

Supported diagrams

Layout and parsing are provided by Mermaider, which supports flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, mind maps, timelines, Kanban boards and more. Refer to its documentation for the exact syntax coverage.

This is a native re-implementation, not the Mermaid.js runtime: advanced Mermaid.js features (custom themes, %%{init}%% directives, click handlers, plugins) are not available. Unsupported input falls back to the built-in syntax-highlighted code block instead of breaking the document.

Themes

MermaidExtension.Instance.Theme = MermaidTheme.Dark;   // Auto (default) | Light | Dark
MermaidExtension.Instance.MaxHeight = 400;             // 0 = unlimited

Auto samples the application's current theme when a diagram is rendered, and picks a light or dark palette. Because the output is a static SVG image, changing the application theme at runtime does not recolour diagrams already on screen; render them again (or set the theme explicitly) to pick up the change.

How it works

  1. The core package's IMarkdownNodeRenderer extension point intercepts a FencedCodeBlock whose info string is mermaid.
  2. MermaidRenderer.RenderSvg parses and lays out the diagram, producing an SVG.
  3. Mermaider's SVG relies on CSS custom properties (var(--fg)), color-mix() and rem units, none of which Svg.Skia understands. SvgCssFlattener expands those expressions into literal hex colours and removes the unsupported <style> block.
  4. SvgSource.LoadFromStream + SvgImage draws the result through SkiaSharp.

If parsing fails, the renderer returns null, so the core falls back to showing the original fenced code block. The reason is available at MermaidExtension.Instance.LastError for diagnostics.

Third-party notices

See THIRD_PARTY_NOTICES.md. Mermaider and Sugiyama are MIT-licensed; this package embeds no fonts and no image assets.

Source comments are in Chinese; contributions in English are welcome.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
12.1.3.8 84 11/7/2026
12.1.3.7 89 11/7/2026

Initial release. Renders Mermaid fenced code blocks natively through Mermaider + Svg.Skia, with CSS variable flattening so Svg.Skia can display the generated SVG correctly.