Could use pandoc-filter-diagram crate
https://crates.io/crates/pandoc-filter-diagram is a crate that does the rendering of diagram markup to SVG. It's heavily based on the code Subplot has for this, but is more general to use. It would make sense to me to use the crate and drop the code in Subplot, to reduce the amount of code in Subplot itself.