PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
254 stars 202 forks source link

Support Mermaid as a source language for diagrams #2133

Open rbeezer opened 2 months ago

rbeezer commented 2 months ago

This would be similar to how <latex-image> behaves, but driven by a node executable, not TeX.

Not trivial, but good models exist, and would be a good way for a contributor to touch a lot of code.

https://mermaid.js.org/

ascholerChemeketa commented 2 months ago

What output formats do you want to support?

I think that out of the box, Mermaid tends to produce prettier output than GraphViz (credit to @bjones1 for reminding us of it). But, if you want to output images for use in non-html formats (or for JS-less HTML), that would involve the Mermaid CLI: https://www.npmjs.com/package/@mermaid-js/mermaid-cli/v/8.11.4 Which would involve node. (Node will probably also be necessary for any CSS/JS bundling solution, but this would turn it into a dependency for non-HTML-based builds.).

GraphViz would integrate more tightly with the existing Python build structure. There are libraries for making git history diagrams that might help with the project that got you (@rbeezer) thinking about this. https://github.com/jlinoff/git2dot