Giter Site home page Giter Site logo

dpvreony / docfx-mermaidjs Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 600 KB

DocFX MermaidJs Image Generator Plugin

Home Page: https://docs.dpvreony.com/projects/docfx-mermaidjs/

License: MIT License

C# 99.86% Batchfile 0.14%
docfx docfx-plugin mermaid mermaidjs

docfx-mermaidjs's Introduction

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

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:

  • 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://docs.dpvreony.com/projects/docfx-mermaidjs/

Contributing to the code

See the contribution guidelines.

docfx-mermaidjs's People

Contributors

dependabot[bot] avatar dpvreony avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

docfx-mermaidjs's Issues

update readme

Is your feature request related to a problem? Please describe.
Readme is based on using DFM with NodeJS and MermaidCLI. MarkDig extension has less dependencies

Describe the solution you'd like
Show how to use in docfx 2.60

Describe alternatives you've considered
n/a

Additional context
n/a

Remove DFM markdown support

Is your feature request related to a problem? Please describe.
DFM flavour of Markdown is being removed in DocFX in favour of MarkDig. We've already put support in for MarkDig.

Describe the solution you'd like
Remove DFM code, increment major version as breaking change.

Describe alternatives you've considered
N/A

Additional context
N/A

reduce size of embedded resources

Is your feature request related to a problem? Please describe.
already stripped out a lot of resources by filtering down just to mjs and js files. but can reduce it further.

Describe the solution you'd like
being more selective i.e. just using the files for minified content.
look at compressing the resources and serving them as gzip stream etc.

Describe alternatives you've considered
n/a

Additional context
n/a

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • actions/setup-dotnet v4
  • glennawatson/setup-msbuild v1.0.3
  • github/codeql-action v3
  • github/codeql-action v3
  • windows 2022
.github/workflows/dotnet-core.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/setup-dotnet v4
  • microsoft/setup-msbuild 70b70342ae97ca98d5eaad06cafd26d30f9592a9
  • crazy-max/ghaction-virustotal v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/upload-artifact v4
  • actions/download-artifact v4
  • glennawatson/ChangeLog v1
  • actions/create-release v1
  • windows 2022
.github/workflows/lock.yml
  • dessant/lock-threads v5
npm
src/Dhgms.DocFx.MermaidJs.Plugin/package.json
  • mermaid 10.9.0
nuget
.config/dotnet-tools.json
  • snitch 2.0.0
  • dotmorten.omdgenerator 1.4.0
  • configvalidate 1.0.0
  • dotnet-sonarscanner 6.2.0
  • jetbrains.resharper.globaltools 2024.1.1
  • dotnet-outdated-tool 4.6.1
  • microsoft.cst.applicationinspector.cli 1.9.22
  • dotnet-project-licenses 2.7.1
  • docfx 2.76.0
  • microsoft.sbom.dotnettool 2.2.5
src/Dhgms.DocFx.MermaidJs.Plugin/Dhgms.DocFx.MermaidJs.Plugin.csproj
  • System.Reactive 6.0.0
  • System.Composition 8.0.0
  • ReactiveMarbles.ObservableEvents.SourceGenerator 1.3.1
  • Nito.AsyncEx 5.1.2
  • Microsoft.Playwright 1.43.0
  • Microsoft.Extensions.Logging.Abstractions 8.0.1
  • Microsoft.DocAsCode.MarkdigEngine.Extensions 2.67.5
  • Microsoft.AspNetCore.Mvc.Testing 8.0.4
src/Dhgms.DocFx.MermaidJs.Sample.Cmd/Dhgms.DocFx.MermaidJs.Sample.Cmd.csproj
  • Microsoft.DocAsCode.App 2.67.5
src/Directory.build.props
  • InclusivenessAnalyzer 1.3.0
  • Roslynator.Analyzers 4.12.2
  • stylecop.analyzers 1.2.0-beta.556
  • Nerdbank.GitVersioning 3.6.133
  • Dhgms.QualityAssurancePack 2.3.181
  • Microsoft.SourceLink.GitHub 8.0.0
  • Xunit.StaFact 1.1.11
  • xunit.runner.visualstudio 2.8.0
  • xunit.runner.reporters 2.8.0
  • xunit.analyzers 1.13.0
  • xunit 2.8.0
  • OpenCover 4.7.1221
  • NetTestRegimentation 1.7.48
  • Moq 4.20.70
  • Microsoft.NET.Test.Sdk 17.9.0
  • GitHubActionsTestLogger 2.3.3
  • Foundatio.Xunit 10.7.1
  • coverlet.msbuild 6.0.2
  • coverlet.collector 6.0.2
src/global.json
  • dotnet-sdk 8.0.204
  • MSBuild.Sdk.Extras 3.0.44

  • Check this box to trigger a request for Renovate to run again on this repository

add details around chromium setup and channel selection

Is your feature request related to a problem? Please describe.
originally the plug in was using chrome but is now using chromium.

Describe the solution you'd like

  • document the set up of chromium
  • add the ability to choose a chromium channel

Describe alternatives you've considered

Additional context

breaking changes in docfx 2.60 onward

Is your feature request related to a problem? Please describe.
DocFX 2.60 has substantial changes

  • CLI is now dotnet tool wrapper around Microsoft.DocAsCode
  • the plug in model is changing so you compile it into your own tool

Additional context
Right now investing time in overcoming the lack of environment variable support is not worthwhile as the 2.59 vs 2.60 way of working is quite different. accept v1 of this plug in needs to use msbuild template argument and lacks flexibility for html and pdf support via a single project and json file

make CI build multi platform

when looking into codespaces it came to light that the plug-in doesn't work out of the box on linux. adding a ci check would help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.