Dhgms.DocFx.MermaidJs.Plugin
1.0.122
See the version list below for details.
dotnet add package Dhgms.DocFx.MermaidJs.Plugin --version 1.0.122
NuGet\Install-Package Dhgms.DocFx.MermaidJs.Plugin -Version 1.0.122
<PackageReference Include="Dhgms.DocFx.MermaidJs.Plugin" Version="1.0.122" />
paket add Dhgms.DocFx.MermaidJs.Plugin --version 1.0.122
#r "nuget: Dhgms.DocFx.MermaidJs.Plugin, 1.0.122"
// Install Dhgms.DocFx.MermaidJs.Plugin as a Cake Addin #addin nuget:?package=Dhgms.DocFx.MermaidJs.Plugin&version=1.0.122 // Install Dhgms.DocFx.MermaidJs.Plugin as a Cake Tool #tool nuget:?package=Dhgms.DocFx.MermaidJs.Plugin&version=1.0.122
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-cli 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
- https://dotnet.github.io/docfx/
- https://mermaid.js.org/
- https://github.com/mermaid-js/mermaid-cli
- https://github.com/mermaid-js/mermaid
- https://github.com/dpvreony/article-statiq-mermaid
- https://github.com/KevReed/DocFx.Plugins.PlantUml
Getting Started
Pre-requisites
You will need:
- NodeJS
- NPM
- A docfx project
The instructions below assume the DocFX project is called "docfx_project"
Setting up NodeJS
In your docfx project folder create a package.json file with content similar to:
{
"name": "docfx",
"version": "1.0.0",
"devDependencies": {
"@mermaid-js/mermaid-cli": "9.2.2"
}
}
Script and\or carry out a package restore using the following command
pushd docfx_project && npm install && popd
Setting up DocFX
Add a nuget package reference to "Dhgms.DocFX.Mermaid.Plugin" in your docfx_project
Update your docfx.json to include the template. This assumes you are using the default templates for the process. You need to put this plugin BEFORE your output template.
For HTML output:
"build": {
"template": [
"markdownmermaidjs",
"default"
]
}
For PDF output:
"pdf": {
"template": [
"markdownmermaidjs",
"pdf.default"
]
}
By default the plugin has the following behaviour:
- Uses inline emdedding in the HTML
- Creates png images
- Runs the mermaid-cli externally
You can adjust the settings by viewing the detailed documentation.
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 | Versions 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. |
-
net6.0
- Microsoft.AspNetCore.Mvc.Testing (>= 6.0.15)
- Microsoft.DocAsCode.MarkdigEngine.Extensions (>= 2.65.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.3)
- Microsoft.Playwright (>= 1.32.0)
- Nito.AsyncEx (>= 5.1.2)
- System.Reactive (>= 5.0.0)
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 | 959 | 4/17/2024 |
2.0.71 | 184 | 3/25/2024 |
2.0.62 | 254 | 3/7/2024 |
2.0.33 | 287 | 1/15/2024 |
2.0.30 | 129 | 1/12/2024 |
2.0.2 | 370 | 11/29/2023 |
2.0.1 | 167 | 11/28/2023 |
1.0.410 | 265 | 11/6/2023 |
1.0.386 | 202 | 10/20/2023 |
1.0.366 | 261 | 10/2/2023 |
1.0.315 | 461 | 8/26/2023 |
1.0.291 | 227 | 8/14/2023 |
1.0.275 | 199 | 8/4/2023 |
1.0.250 | 247 | 6/30/2023 |
1.0.224 | 259 | 6/12/2023 |
1.0.212 | 180 | 6/2/2023 |
1.0.198 | 192 | 5/24/2023 |
1.0.136 | 353 | 4/14/2023 |
1.0.122 | 285 | 4/7/2023 |
1.0.116 | 279 | 4/5/2023 |
1.0.110 | 230 | 4/3/2023 |
1.0.101 | 266 | 4/1/2023 |
1.0.99 | 241 | 3/31/2023 |
1.0.21 | 356 | 1/3/2023 |
1.0.19 | 329 | 1/3/2023 |