Javascript renderer

0 votes
asked May 1, 2020 in Wanted features by Julien
Having to spawn a JVM in static websites pipeline is a pain. It would be nice if the core parts of PlantUML were provided as a npm module, or at least abstracted things like files/etc so they would be easily transpilable. I tried transpiling the CLI jar to Javascript/WebAssembly with TeaVM but there are just too many errors.
commented May 1, 2020 by Julien

I managed to build a binary using Graal but unfortunately PlantUML depends on JNI so I think it's not a valid approach…

https://gist.github.com/jcayzac/0c1e2cb69cd6c89f4779557dbe18bab0

1 Answer

0 votes
answered May 1, 2020 by plantuml (295,000 points)
PlantUML does not use JNI. But for some diagrams, it needs to lauch GraphViz, so this can be an issue...

The good news is that GraphViz has been ported in Javascript (see https://plantuml.com/en/vizjs )

So theorically, it should be possible to have some transpilable version to JS of PlantUML.

However, this is a huge task...

If you have some times and a real experience in Java to JS conversion, we would be glad to help you to build such a version. But once again, get ready for rush hours :-)
commented May 23, 2020 by jfrotz (120 points)
I'm exporting my GitLab Wiki documentation with PlantUML plug-in into a Docusaurus instance.  Part of my prep copies in my markdown files (reading and extracting each of the inline PlantUML diagrams as source images.  I then process each PlantUML image file (.txt) through PlantUML CLI to generate an SVG.  Docusaurus very nicely loads the now static markdown + SVG reference very quickly.

The GitLab + PlantUML plugin (requires that you have a PlantUML server to call upon) is reasonable enough, but pre-generating everything makes traversal of the documentation a dream.
...