Introduction
The $wikify
widget parses and renders a string of text and assigns the result to a specified variable. The new value of the variable is available to the content within the $wikify
widget.
Content and Attributes
The content of the $wikify
widget is the scope for the value assigned to the variable.
Attribute | Description |
---|---|
name | The name of the variable to assign |
text | The text to parse and render |
type | The ContentType of the text (defaults to text/vnd.tiddlywiki ) |
mode | The parse mode: block (the default) or inline |
output | Keyword indicating the desired output type, defaulting to text (see below) |
The available output types are:
Keyword | Description |
---|---|
text | Return the plain text of the rendered output (ie HTML tags are omitted) |
formattedtext | Return the plain text with simple text formatting of the rendered output (ie HTML tags are omitted) |
html | Return the rendered HTML of the output |
parsetree | Return a formatted JSON representation of the parse tree |
widgettree | Return a formatted JSON representation of the widget tree |
Examples
Using a widget as a value
If you use $wikify
, you can get the rendered output and use it as a value.
title | Output |
white text on purple is a good contrast
If you try to directly use a widget as a value, you will instead get the raw wikitext of the widget and not the rendered value.
<p><span style="color:white<$transclude $variable="contrastcolour" target={{target}} fallbackTarget=<<fallbackTarget>> colourA={{colourA}} colourB={{colourB}} />;background:purple;">↩︎
white text on purple is a good contrast↩︎
</span></p>
title | Output |
> colourA={{colourA}} colourB={{colourB}} />;background:purple;"> white text on purple is a good contrast
Accurate word count
If you use wikify, you can calculate an accurate word count.
title | Output |
Word count = 3
If a tiddler transclude some content, or use widgets to generate content, filters that try to calculate the word count won’t be accurate: they will instead count the raw text words.
<p>Word count = 35</p>
title | Output |
Word count = 5
Exporting rendered html
You can use $wikify
to copy your wikitext as a formated HTML.
title | Output |
<h2 class="">A nice list</h2><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>
Rendering parameterised SVG for use in stylesheets
The core svg icons use a parameter widget, making their use in stylesheets impossible without wikify.
title | Output |