LZR parser behavior

Whitespace handling canaries

This page collects whitespace-sensitive markup that should render like browser HTML: editor indentation is noise, linebreaks inside phrasing content become spaces, and block-kind elements trim leading and trailing source whitespace.

Browser-like, predictable

Whitespace is a rendering contract.

Parser changes are judged against visible source, expected text, rendered output, and the reason the browser-like rule exists.

Trim block-leading and block-trailing editor noise. Preserve meaningful inline word separation. Collapse tabs, indentation, and linebreaks in phrasing flow. Never swallow text after inline elements.

Inline boundaries

Case Source Expected text Rendered sample Why
Inline span keeps following space <h1>The <span class=accent-blue>240fps</span> web engine</h1> The 240fps web engine

The 240fps web engine

Text after a phrasing child remains part of the same inline run.
Inline span keeps preceding space <p>Ship <span>small</span> changes</p> Ship small changes

Ship small changes

The explicit space before the inline child is meaningful content.
Nested strong inside span <p>A <span>very <strong>fast</strong></span> engine</p> A very fast engine

A very fast engine

Nested phrasing content should not reset spacing rules.
Punctuation does not force extra spacing <p>The <span>engine</span>.</p> The engine.

The engine.

Punctuation adjacency remains exact.
Adjacent inline tags preserve explicit separator <p><strong>Source</strong> / <em>Data</em> / <span>Rendered</span></p> Source / Data / Rendered

Source / Data / Rendered

Separators authored between inline tags are source truth.
Intentional double inline spaces collapse visually <p>Graph <span>owned</span> routes</p> Graph owned routes

Graph owned routes

HTML rendering collapses runs of spaces in normal flow.

Linebreaks and indentation

Case Source Expected text Rendered sample Why
Linebreak after inline becomes one space <p>The <span>240fps</span>\nweb engine</p> The 240fps web engine

The 240fps web engine

A linebreak in phrasing flow behaves like a space.
Linebreak before inline becomes one space <p>The\n<span>240fps</span> web engine</p> The 240fps web engine

The 240fps web engine

Newlines around inline children should not create missing words.
Indented inline child ignores editor tabs <p>The\n\t<span>240fps</span>\n\tweb engine</p> The 240fps web engine

The 240fps web engine

Indentation is editor structure, not user-facing text.
Space after linebreak is not doubled <p>The <span>240fps</span>\n web engine</p> The 240fps web engine

The 240fps web engine

A source newline plus an authored leading space does not double output spacing.
Block trims leading/trailing editor whitespace <h2>\n\tInspectable output\n</h2> Inspectable output

Inspectable output

Block wrappers discard leading and trailing indentation noise.
Block children remain separated <div>\n\t<span>Source</span>\n\t<span>Data</span>\n</div> Source Data
Source Data
Inline child elements inside a block remain separate text runs.

Headline-shaped canary