Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mermaid diagram cli module #951

Open
dpvreony opened this issue Mar 29, 2021 · 3 comments
Open

mermaid diagram cli module #951

dpvreony opened this issue Mar 29, 2021 · 3 comments

Comments

@dpvreony
Copy link

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

@daveaglick
Copy link
Member

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?

@daveaglick
Copy link
Member

daveaglick commented Mar 10, 2022

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).

@dpvreony
Copy link
Author

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?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants