I’ve developed a plugin that postprocesses Markdown code blocks that have an iframe
language tagged on them, and then runs any JavaScript in that code block inside of an iframe. It’s pretty neat - you can build graphs with generic tools like plot, import ESM modules, do kind of a tiny subset of live-coding environments inside of Obsidian.
But toggling between editing the Markdown source and viewing the output is really bad DX, there’s a really slow iteration loop involved. I don’t want to run it like that - it’d be much better for this to be a widget that displays above an editable Markdown code block.
However, doing that is… pretty hard, and is intersecting with the less-documented parts of the Obsidian API. It looks like Obsidian has its own Markdown flavor, hypermarkdown, and the syntaxTree that you get if you write a ViewPlugin or StateField is that, and there doesn’t seem to be an actual element type for code blocks.
Are there any plugins that do this, or documentation for it? Meaning, a plugin that exposes a ViewPlugin or StateField and uses the syntax tree generated in order to get the code within a code block?