Skip to content

Match djot.js on empty-label references and whitespace-only item code lines - #352

Merged
dereuromark merged 2 commits into
masterfrom
conformance-lane-d
Nov 15, 2026
Merged

dereuromark merged 2 commits into
masterfrom
conformance-lane-d

Conversation

@dereuromark

@dereuromark dereuromark commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Conformance follow-ups from the lane C list (#351), checked against djot.js on current master. Two of the seven listed differences were parser accidents and are fixed here. Three are documented djot-php extensions and stay as they are. The other two are djot.js bugs, so djot-php keeps its behavior: see "Upstream bugs" below.

Empty-label reference definition in a quote

A []: p line in a quote is a reference definition, so it leaves no open paragraph and an unquoted line after it ends the quote. The container trackers required a non-empty label, unlike the definition parser.

Input:

> []: p
para

Before:

<blockquote>
<p>para</p>
</blockquote>

After, as djot.js:

<blockquote>
</blockquote>
<p>para</p>

Whitespace-only line in a list item code or raw block

A whitespace-only line inside a fence in a list item keeps the spaces past the content column, in tight and loose items. Before, it became an empty line.

Input:

- ``` =html
  x
   
  y
  ```

(The third line holds three spaces; one is left past the content column.)

Before:

<ul>
<li>
x

y
</li>
</ul>

After, as djot.js:

<ul>
<li>
x
 
y
</li>
</ul>

Left as is (djot-php extensions)

  • {word} boolean attributes ({y} gives y=""): documented in docs/guide/syntax.md ("Boolean Attribute Shorthand (Extension)") and docs/reference/enhancements.md#boolean-attribute-shorthand.
  • ^ caption with no table, image or quote before it stays a paragraph: part of the caption extension (docs/reference/enhancements.md#captions-for-images-tables-and-block-quotes, "No valid preceding block for caption - treat as regular paragraph" in BlockParser::tryParseCaption()), and BlockParserTest::testBlankBeforeAttachedCaptionKeepsListTight relies on it.
  • Consecutive : term lines share one definition: "Multiple Definition Terms" in docs/reference/enhancements.md.

The separate-line item attribute form (- x then {.c} on the <li>, soft-deprecated in BlockParser) is also a djot-php extension and is untouched; its output still differs from djot.js in empty-item shapes.

Upstream bugs (djot-php not changed)

Checks

  • ConformanceFollowupsTest: 8 cases, each asserted with warnings off and on, including both cell-tab shapes with the trimmed output. Each fix was reverted on its own after the commit, and every revert fails at least two cases.
  • Differential sweep against djot.js, 3 x 1,000 generated documents around these shapes (empty and labelled reference lines in quotes and lists, attribute lines in and between items, footnote definitions, cells with escapes, spaces and tabs, fences with whitespace-only lines in items and quotes): agreement 460 -> 735, 445 -> 736, 429 -> 698 with all four original fixes (the attribute and tab changes are now dropped), 0 regressions, output identical with warnings on and off.
  • Full phpunit, phpstan and phpcs pass.

…g cell tabs and whitespace-only item code lines

- A reference definition with an empty label (`[]: p`) in a quote leaves no
  open paragraph, so an unquoted line after it ends the quote. The container
  trackers required a non-empty label, unlike the definition parser.
- Attributes an item leaves without a target (an empty item holding only
  `{...}`, or a trailing `{...}` after a blank line) go to the next item's
  `<li>`, as in djot.js. A blank line before the next item drops them. Before,
  they reached the first block inside the next item.
- A footnote definition consumes the block attributes before it. Before, they
  passed through to the block after the note.
- Only spaces are trimmed at the end of a table cell. A trailing tab is cell
  text, as djot.js keeps it, also after an escaped space.
- A whitespace-only line in a code or raw block inside a list item keeps the
  spaces past the content column instead of becoming an empty line.
@dereuromark dereuromark added the bug Something isn't working label Nov 11, 2026
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.52%. Comparing base (544860e) to head (ad1bca2).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #352   +/-   ##
=========================================
  Coverage     93.52%   93.52%           
  Complexity     5060     5060           
=========================================
  Files           118      118           
  Lines         13246    13246           
=========================================
  Hits          12388    12388           
  Misses          858      858           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Attributes left without a block in a list item or footnote no longer
move to the next item: djot.js does this, but it is an upstream bug
(jgm/djot.js issue 175). Trailing tabs in table cells are trimmed again,
as proposed upstream in jgm/djot.js PR 176.
@dereuromark dereuromark changed the title Match djot.js on empty-label references, leftover attributes, trailing cell tabs and whitespace-only item code lines Match djot.js on empty-label references and whitespace-only item code lines Nov 11, 2026
@dereuromark
dereuromark marked this pull request as ready for review November 15, 2026 16:58
@dereuromark
dereuromark merged commit 619786e into master Nov 15, 2026
6 checks passed
@dereuromark
dereuromark deleted the conformance-lane-d branch November 15, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant