statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.

Home Page:https://statiq.dev/web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mermaid diagram cli module

dpvreony opened this issue · comments

Greetings

Thanks for your efforts on this. I've been working on generating some mermaid diagrams via a module that calls the nodejs cli and a *.mmd pipeline

https://github.com/dpvreony/dpvreonywebsite/blob/main/src/DPVreony.Website/Features/MermaidDiagram/MermaidDiagramModule.cs

https://github.com/dpvreony/dpvreonywebsite/blob/main/src/DPVreony.Website/Features/MermaidDiagram/MermaidDiagramPipeline.cs

if this would be any use\interest\value i can raise a PR

Thanks again

Sorry for the extremely late reply 😬. I'm just catching up on some of the issues I missed over the last year.

This sounds really interesting. So you're creating mermaid diagrams at generation time? As SVGs? Are you still using/working on it?

I wonder if this would run in process using the embedded JacaScript engine as opposed through the node CLI. Do you know if there's anything special about running under node, or would the mermaid code theoretically work in any JavaScript runtime?

Note to self: it would be good if any future Mermaid module could handle rendering diagrams in-place too. One way to do that would be if the module rendered mermaid content in the document, then it would be up to the pipeline to hand it documents read straight from disk (I.e. .mmd files) or extracted from HTML (which would need to be glued back in too).

Greetings. No worries I appreciate how busy things can be.

When I get time I have been using it as part of the statiq pipeline. I have just kept it "simple" by using the NPM CLI as a minimum viable product. https://github.com/mermaid-js/mermaid-cli/blob/master/src/index.js probably shows exactly what you're thinking for in process.

As for "still working on it" when time permits :) i've found it useful to be able to brain dump and commit. an example is https://www.dpvreony.com/articles/designing-vetuviem/ in https://github.com/dpvreony/dpvreonywebsite/tree/main/src/DPVreony.Website/input/articles/designing-vetuviem

There's probably a few changes to make.

  • Accept a Flags enum for file extensions so you can produce multiple outputs?
  • Split out the NPM process from the pipeline to allow side by side options.
  • Add a ProcessMode (or insert better name here)
  • Document how to drive npm restore if that's the ProcessMode used
  • Injecting the config into the Module (on the execution context?)