Wikidot supports three distinct mechanisms for producing <br /> elements:
Implicit newline: a single NEWLINE token within a paragraph
becomes a <br />, unless it precedes a block-level element
(heading, list, blockquote, etc.) or another newline (paragraph break).
Backslash at end of line: \ followed by newline. The preprocessor
converts \\\n to a BACKSLASH_BREAK token (U+E000), which this
rule then handles. Wikidot preserves a space after the line break
in this case.
Underscore at end of line: _ followed by newline, or _ at the
start of a line followed by newline. This is a more explicit
line-break syntax.
All three rules mark their line-break elements with _preservedTrailingBreak
when the break was explicitly requested (backslash or underscore syntax),
so the paragraph postprocessor knows not to strip trailing breaks.
The newline rule suppresses line-breaks in several situations to avoid
spurious <br /> elements before block-level constructs.
Parses the various Wikidot line-break syntaxes.
Wikidot supports three distinct mechanisms for producing
<br />elements:Implicit newline: a single
NEWLINEtoken within a paragraph becomes a<br />, unless it precedes a block-level element (heading, list, blockquote, etc.) or another newline (paragraph break).Backslash at end of line:
\followed by newline. The preprocessor converts\\\nto aBACKSLASH_BREAKtoken (U+E000), which this rule then handles. Wikidot preserves a space after the line break in this case.Underscore at end of line:
_followed by newline, or_at the start of a line followed by newline. This is a more explicit line-break syntax.All three rules mark their line-break elements with
_preservedTrailingBreakwhen the break was explicitly requested (backslash or underscore syntax), so the paragraph postprocessor knows not to strip trailing breaks.The newline rule suppresses line-breaks in several situations to avoid spurious
<br />elements before block-level constructs.