Dhgms.DocFx.MermaidJs.Plugin 1.0.212

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dhgms.DocFx.MermaidJs.Plugin --version 1.0.212
NuGet\Install-Package Dhgms.DocFx.MermaidJs.Plugin -Version 1.0.212
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="Dhgms.DocFx.MermaidJs.Plugin" Version="1.0.212" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dhgms.DocFx.MermaidJs.Plugin --version 1.0.212
#r "nuget: Dhgms.DocFx.MermaidJs.Plugin, 1.0.212"
#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.
// Install Dhgms.DocFx.MermaidJs.Plugin as a Cake Addin
#addin nuget:?package=Dhgms.DocFx.MermaidJs.Plugin&version=1.0.212

// Install Dhgms.DocFx.MermaidJs.Plugin as a Cake Tool
#tool nuget:?package=Dhgms.DocFx.MermaidJs.Plugin&version=1.0.212

DocFx MermaidJS

Mission Statement

To provide a plugin to convert MermaidJS notations to diagrams during the build of a DocFX project.

Introduction

This DocFX MermaidJS plugin is a wrapper around the mermaid NPM package. It is aimed at doing build time generation of the mermaid diagram so:

  • The syntax can be validated at build time.
  • The image is only built once.
  • The image can be embedded in a pdf.

Credits

Getting Started

v2 of this plug in only supports MarkDig, due to DocFx 2.60 deprecating support for DFM. The plug in model is significantly different in v2.60 as well and requires you to have your own application to run the DocFX generation.

1. Create a console application (or similar)

2. Add a nuget package reference to "Dhgms.DocFX.Mermaid.Plugin" in your docfx_project

3. Add the following initialisation

                var options = new BuildOptions
                {
                    // Enable MermaidJS markdown extension
                    ConfigureMarkdig = pipeline => pipeline.UseMermaidJsExtension(new MarkdownContext())
                };
                await Docset.Build("docfx.json", options);

You can see an example of this in

  1. The sample console application in this repository (github.com/dpvreony/docfx-mermaidjs/tree/main/src/Dhgms.DocFx.MermaidJs.Sample.Cmd)
  2. The console application in my main documentation repository (github.com/dpvreony/documentation/tree/main/src/docfx_project)

NOTES:

  • Currently only HTML generation is supported, PDF is not supported due to a breaking change in DocFX 2.60 which I'm looking to resolve with a PR.
  • Only inline PNG is supported, this is due to a limitation in the plug in model and adding new files to the file cache on the fly. I may revisit this in future. The plug in itself exposes SVG data if you want to play with it.

You can adjust the settings by viewing the detailed documentation.

4. Adding a diagram

In your markdown files add a code block with a mermaid descriptor like so:

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```

Then you can run the build and you should see the image output in place of the mermaid markdown syntax.

graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;

Viewing the documentation

The documentation can be found at https://dpvreony.github.io/docfx-mermaidjs/

Contributing to the code

See the contribution guidelines.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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
3.0.1 108 4/17/2024
2.0.71 134 3/25/2024
2.0.62 217 3/7/2024
2.0.33 241 1/15/2024
2.0.30 99 1/12/2024
2.0.2 345 11/29/2023
2.0.1 143 11/28/2023
1.0.410 241 11/6/2023
1.0.386 192 10/20/2023
1.0.366 229 10/2/2023
1.0.315 436 8/26/2023
1.0.291 201 8/14/2023
1.0.275 176 8/4/2023
1.0.250 215 6/30/2023
1.0.224 226 6/12/2023
1.0.212 152 6/2/2023
1.0.198 173 5/24/2023
1.0.136 326 4/14/2023
1.0.122 253 4/7/2023
1.0.116 244 4/5/2023
1.0.110 203 4/3/2023
1.0.101 241 4/1/2023
1.0.99 213 3/31/2023
1.0.21 332 1/3/2023
1.0.19 303 1/3/2023