I can see that the Railroad plugin uses a widget, but it’s a bit awkward to use, as the spec must either fit into an attribute or be in a separate tiddler.
It would feel so right to put the spec as the content of the DOM element. For this to work there would need a way to tag this element as “don’t parse the tree”, so that the wikiparser would skip it, and the widget would get an unparsed DOM and would be able to do whatever is needed with it.
For my case, which is also a multiline text spec that I want to convert to SVG, I am tempted to use a macro entirely written in javascript (which also feels awkward), just to have access to the unparsed content.
What do you think?