Open azrogers opened 3 days ago
It would be great to have access to at least one icon pack, too: https://mermaid.js.org/config/icons.html
Did some investigating on this issue:
doc/CMakeLists.txt
:
set(DOXYGEN_ALIASES mermaid{1}="\\htmlonly <div class=\\\"mermaid\\\"> ^^ \\endhtmlonly \\htmlinclude \\\"\\1.mmd\\\" \\htmlonly ^^ </div> \\endhtmlonly")
set(DOXYGEN_VERBATIM_VARS DOXYGEN_ALIASES)
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_LIST_DIR}/diagrams")
\mermaid{async}
to include the diagram from doc/diagrams/async.mmd
. We can then use HTML_HEADER
to include the Mermaid JavaScript file on each Doxygen page to turn the Mermaid code into an actual chart.mermaid.min.js
and latest icon pack .json file and include them in the repo. This would reduce the assets loaded by splitting apart the Mermaid code and the icons pack, to allow the icons to be lazy loaded.Instead, we can just grab a copy of the latest mermaid.min.js and latest icon pack .json file and include them in the repo. This would reduce the assets loaded by splitting apart the Mermaid code and the icons pack, to allow the icons to be lazy loaded.
Do you know of any downside to this? It sounds like a solid option.
My only small concern with generating the charts dynamically is that this could (but hopefully doesn't!) prevent them from working when the docs are loaded from a file URL. For example, if a user generates the docs locally and opens the index.html directly without hosting them with a web server.
The main downside is that it would be slightly more work (as in, three minutes of work versus two minutes) to keep it updated, as compared to changing the version number in the package.json. Not much of a downside. I believe if we include both the Mermaid JS file and the icons pack JSON file in the built docs, it should work offline.
Mermaid is a JavaScript-based diagramming tool that would be very useful for us to have in our documentation. It would make it easier to create and maintain flow charts, sequence diagrams, and any other sorts of diagrams and charts we need. Implementing Mermaid in Doxygen is very possible, but not trivial. This repository contains an example of one approach to implementing Mermaid, but it might not be the best. We should investigate our options here and implement a way to generate and include these charts in our documentation.