It looks like you're new here. If you want to get involved, click one of these buttons!
<<showIf "showDesc" "Nature">>The tree is green.<<endShow>>This will only show the "The tree is green." text if showDesc is true and settings.describe is "Nature".
Comments
Then just call it with
where the "passage to display" has the text you want to conditionally show or not show. Then just make different widgets for different $settings.describe values.
For what you want you'd either have to write a custom macro or a custom helper function which you could simply use with the <<if>> macro.
For an example of the latter: (goes in Story JavaScript) Usage:
For now, I'm going to dive into the Macro API. Do you have any tips aside from the docs?
None come immediately to mind. Though, as a simple example, which matches case-insensitively:
A slightly more complicated example, which also verifies that the given argument is one of the possible settings.describe values—to protect against fat fingering:
Usage:
In your code, you used: Is there a difference from the example in the docs, which used:
I mean, I get that the one from the docs is iterating through the contents of each of the tags in the main macro (which I love and will be using). Is there a difference between using new Wikifier and jQuery().wiki()?
They do the same basic job, parsing the given content as SugarCube markup and injecting it someplace.
The <jQuery>.wiki() extension method is documented—meaning I'm committed to supporting it. As noted by its docs, it supports chaining, as one would expect from a jQuery method, and accepts an arbitrary number of content sources. It is also the recommended interface.
The publicly known Wikifier interface obviously isn't going anywhere—it's too entrenched as a legacy API—however, I do have plans to eventually replace the actual code behind it, so it's going to become a legacy shim at some point.