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

WikiText parser mode: macro examples

 22nd January 2022 at 6:09pm

With the macro boringtable defined as:

|cell one|cell two|
|cell three|cell four|
then
wiki textrenders as
1
* <<boringtable>>
* |cell one|cell two| |cell three|cell four|
2
* <div>

<<boringtable>>
</div>
*
cell onecell two
cell threecell four
3
* <$macrocall $name=boringtable/>
* |cell one|cell two| |cell three|cell four|
4
* <$macrocall $name=boringtable></$macrocall>
* |cell one|cell two| |cell three|cell four|
5
* <$macrocall $name=boringtable>

</$macrocall>
*
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 macro call it will use the current parse mode to parse the contents of the macro. The contents of the macro 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 macro call inherits it and the table is recognised.

When calling macros 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: transclusion examples for similar examples


These examples have slightly different behavior. In the previous section, the macro calls were enclosed within list items. In these examples, the macro calls are at the top level:

wiki textrenders as
1
<<boringtable>>
|cell one|cell two| |cell three|cell four|
2
<div>

<<boringtable>>
</div>
cell onecell two
cell threecell four
3
<$macrocall $name=boringtable/>
|cell one|cell two| |cell three|cell four|
4
<$macrocall $name=boringtable></$macrocall>
|cell one|cell two| |cell three|cell four|
5
<$macrocall $name=boringtable>

</$macrocall>
cell onecell two
cell threecell four

Of these examples, only the two $macrocall tags which are not followed by a blank line are parsed using inline mode.

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