Generic Graphics Plugin

I just came across manim - it looks fantastic: https://www.manim.community/

It takes a python file, processes it with an external program, and creates an image or a movie of the mathematical objects you’ve defined.

I thought it would be great to make a plugin to embed it in code blocks, just like mermaid diagrams.

Then, I saw a pull request for the GraphViz plugin (GitHub - QAMichaelPeng/obsidian-graphviz: Graphviz plugin for obsidian md.) - similar idea, just runs a different command.

This makes me think that rather than cloning that plugin and adapting it, perhaps there’s a way to create something generic that deals with:

  • looking for a code box of a certain type
  • saving the contents as a file
  • processing that file with an external program (with custom args)
  • showing that in the display as an image, movie or other embed.

I could be wrong, but it feels like there are probably multiple tools/languages where this could be applied, and if all one had to do was put in a language name, executable path, arguments spec and something about what comes out, it would be pretty close to end user configurable

I’m currently playing around with making a Manim integration plugin but it’s… a pain to be frank. On Windows it might work better but due to how Obsidian is distributed on Linux (all in containerized environments ie: Flatpak, Snap or AppImage) external tools like Manim (other tools are affected equally) are at least to my knowledge pretty much impossible to use. I’m still (slowly in what little free time I have) continuing with the plugin but I doubt anyone outside of actual developers will want to or even be able to use it, as my current “solution” needs a locally hosted “manim render server” to be running that the obsidian plugin talks with. If all these words mean nothing to you: It’s hard, no “one click install” and even then kinda janky.

PS: I’ve taken a look at the Graphviz plugin and it seems they’re using the exact way I tried and failed at due to the sandboxing - so either they’re using the community made .deb or they are on Windows (or Mac?) where the .exe is not containerized - none of which is an option for me to use unfortunately. If you (or someone else) has any idea how this could move forward in a more user friendly and less janky way I’m open to hear it