Open ethanmdavidson opened 2 years ago
Hi @ethanmdavidson, thanks for sharing your idea. I don't know how the mistletoe community, but I think it would be cool to have some "UML-like" diagrams support.
I have done some quick research, and it looks like there are various alternatives (each offering a different approach and set of features):
a) Pikchr - the easiest integration seems to be via calling a local OS-dependent executable which can be built from Pikchr's C source code (example: a filter for Pandoc which calls Pikchr). b) PlantUML - can be integrated by calling its Java jar, or by calling a (public) PlantUML server (see PlantUML Extension for Python-Markdown). c) Mermaid - probably the most lightweight integration via including its JavaScript in the resulting HTML page (an output example). Con: this would work just for HTML renderers.
So, when thinking out a solution, it would be good to think about how to make it as reusable (general) as possible. But of course, that will take some time, so maybe having something less universal, yet working, would also be great...
Back to Pikchr :), I think the best non-intrusive & simple approach would be calling it from Python as an external command, similar to the Pandoc example linked at point (a). From the many possible approaches, I would probably choose Python's subprocess.run()
to implement the call, as described for example here. (It looks like mistletoe doesn't call any external command / executable yet.)
Hi, I'm interested in contributing a Pikchr integration. Pikchr is written in C, so it looks like I'll need to call C from Python (pikchr integration docs). I don't work much with either python or C, but based on 10 minutes of research it looks like the easiest way to call C from Python is to use something like SWIG. This looks fairly easy, but I think it will involve changing the build process and I'm not sure about the implications in other areas (especially publishing to PyPi).
Please let me know: