Hi,
I would like to transclude a tiddler within triple ticks. The {{}} syntax doesn’t seem to work in that case. Is there a workaround?
Thanks!
Hi,
I would like to transclude a tiddler within triple ticks. The {{}} syntax doesn’t seem to work in that case. Is there a workaround?
Thanks!
The HTML output produced by triple ticks is:
<pre><code>content here</code></pre>
Note that, by definition, a <code>
block does NOT parse any wikitext it contains. As a result, transclusions within triple ticks are not processed.
In contrast, if you were omit the triple ticks and write:
<pre>
{{TiddlerTitle}}
</pre>
or
<pre><$transclude tiddler="TiddlerTitle" mode="block"/></pre>
Then the contents of “TiddlerTitle” WILL be transcluded and displayed using a fixed-width font surrounded by a gray box.
I see, this could work. The only problem is that I also need syntax highlighting (done with the highlight plugin). I guess that wouldn’t be possible right?
Have a look at the CodeBlock widget which should support syntax highlighting as well:
Ah, so what would a complete example look like in this case? Can I use {{}}
inside code
string?
From the linked documentation:
<$codeblock code={{$:/editions/tw5.com/macro-examples/say-hi}}} />
Use the language attribute of the widget to specify the language for syntax highlighting.
oh, of course, face-palm. Thank you!!!
Actually, no, there’s a problem. I want the code to be partly from a tiddler and partly from what i supply. I.e. i need something like this:
<$codeblock code="{{some-common-tiddler}} blah blah"/>
The reason I need this is because I have a long command with lots of variations but one common part. I want to create different tiddlers for many variations keeping the common part in all of them to avoid repetition.
Use a filter to construct the code you want to show and assign it as a filtered attribute:
Example:
<$codeblock code={{{ [{some-common-tiddler}]addsuffix[blah blah]] }}} />
oh that’s so cool, could i create a global macro that would accept the blah blah
and spit out the right wiki markup?