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

WikiText parser mode transitions

22nd January 2022 at 6:42pm

This is a rough diagram whose lines mostly correspond to the parser mode transitions described below:

pragma modeinline modeblock mode<<<@@$$other block mode start punctinline modeblock mode close punctuationblank linehtml open tagtransclude widgetmacrocall

Start mode

By default the parser starts in block mode. However, a tiddler can instead be transcluded with inline mode in which case block mode WikiText will not be recognised.

At the start of text only, the parser will also recognise any pragma mode WikiText.

Transitions from pragma mode

At the start of text, the parser will recognise any pragma. If none are found then it will move to inline or block mode depending on the transclusion mode. If any pragma are found then it will continue looking for pragma until it finds one or more blank lines not followed by the start of a new pragma.

Transitions from block mode

When the parser encounters most block mode start punctuation it transitions to inline mode. This means he text enclosed by most block mode constructs will be parsed using inline mode.

Tip
The start "punctuation" for a paragraph is "invisible". Even for paragraphs the parser moves to inline mode

However, there are a few constructs whose enclosed text is parsed using block mode:

When the start punctuation for these are encountered, the enclosed text will continue to be parsed in block mode.

Horizontal rules are another special case. They do not enclose any text, so there is no opportunity for the parser to transition to inline mode.

Opening widget or HTML tags provide another way the parser can transition. When such a tag is not followed by a blank line, then the contents enclosed by the tag will be parsed in inline mode. See the HTML examples.

Transitions from inline mode