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.
Hi @Jerome at the moment there is no way to have the content of a particular widget parsed differently. Instead, in such situations, the recommended approach is a custom parse rule that matches a suitable syntax.
Part of the difficulty is that widgets are dynamic: for example, the <$genesis> widget dynamically creates a widget which is not necessarily known at parse time, making it impossible to know how the content should be parsed. We could make it work in some situations, but it would be hard to make the behaviour universally consistent.
It might make sense to add a custom rule to the railroad plugin, particularly since we don’t have any other examples of the technique in the core.
For example:
...railroad
start [:optional] {repeated +","} end
...