I’m trying to use the handy new-ish JSON operators to extract some text from a nested JSON tiddler (called rt) whose contents are generated by a script and render it.
The actual JSON stuff is working fine. But for some reason I cannot find a way to display the text that both:
- retains newlines (
\n) in the extracted text (I would be fine with it either treating them as wikitext-style breaks where two newlines are needed for a new paragraph, or treating them literally) - doesn’t try to parse the extracted text as wikitext
Directly using a <<variable reference>> to the extracted content displays newlines correctly (as long as it’s a block of its own with blank lines on either side), but it tries to parse the result as wikitext.
The <$text> widget fixes the wikitext problem, but it always results in inline-mode content, so it doesn’t display the newlines correctly.
The <$wikify> widget seems, at first glance, like it ought to be able to do this; it has options for output type and MIME type. But the type parameter is effectively not honored here, I’m assuming because when I write <<content>>, the content that’s been parsed as plain text gets parsed again as wikitext. Setting the output parameter of $wikify to text does inhibit parsing of wikitext, but it gobbles the newlines!
This is the closest I’ve gotten, but it still results in wikitext parsing:
<$vars linksfor={{{ [{rt}jsonextract[Some Tiddler Name]] }}}>
<$wikify name="content" text={{{ [<linksfor>jsonextract[0]jsonget[text]] }}} type="text/plain" output="formattedtext">
<<content>>
</$wikify>
</$vars>
I thought about trying to put a macro in somewhere to take advantage of parameters to $macrocall being wikified only once, but I can’t find a way to make this help because the content returned by the macro still ends up getting wikified again.
I’m out of ideas here – is there some widget or hack I’m not thinking of?