This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

WikiText parser mode: transclusion examples

 22nd January 2022 at 6:08pm

Given the tiddler table-example defined with these contents:

|cell one|cell two|
|cell three|cell four|
then
wiki textrenders as
1
* {{table-example}}
* |cell one|cell two| |cell three|cell four|
2
* <div>

{{table-example}}
</div>
*
cell onecell two
cell threecell four
3
* <$transclude tiddler=table-example/>
* |cell one|cell two| |cell three|cell four|
4
* <$transclude tiddler=table-example></$transclude>
* |cell one|cell two| |cell three|cell four|
5
* <$transclude tiddler=table-example>

</$transclude>
*
cell onecell two
cell threecell four
6
* <$transclude tiddler=table-example mode=block/>
*
cell onecell two
cell threecell four

The list syntax is recognised in block mode and the enclosed contents are parsed using inline mode. When the parser encounters a wikitext transclusion it will use the current parse mode to parse the contents of the transcluded tiddler. The contents of the example tiddler contains table syntax which is only recognised in block mode.

Therefore, in #1 above the table syntax is not recognised. In #2 above, the blank line after the open div tag moves the parser back into block mode, the transcluded text inherits it and the table is recognised.

When transcluding tiddlers using the widget, the parse mode will be inline (#3 and #4 above) unless it is written as an open tag with a following blank line (#5 above).

Tip
See also WikiText parser mode: macro examples for similar examples. The only difference here is $transclude has a mode attribute (extra example #6) which allows the parse mode to be explicitly overridden rather than come implicitly based on the they way the tag is written


In these examples, the transclusions are at the top level instead of enclosed in list items:

wiki textrenders as
1
{{table-example}}
|cell one|cell two| |cell three|cell four|
2
<div>

{{table-example}}
</div>
cell onecell two
cell threecell four
3
<$transclude tiddler=table-example/>
|cell one|cell two| |cell three|cell four|
4
<$transclude tiddler=table-example></$transclude>
|cell one|cell two| |cell three|cell four|
5
<$transclude tiddler=table-example>

</$transclude>
cell onecell two
cell threecell four
6
<$transclude tiddler=table-example mode=inline/>
|cell one|cell two| |cell three|cell four|

Of these examples, only the two $transclude tags which are not followed by a blank line and the widget call using mode=inline are parsed using inline mode.

Tip
See also WikiText parser mode: macro examples for similar examples