Repository navigation
Match djot.js on empty-label references and whitespace-only item code lines - #352
Merged
Merged
Conversation
…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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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
marked this pull request as ready for review
November 15, 2026 16:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
[]: pline 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:
Before:
After, as djot.js:
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:
(The third line holds three spaces; one is left past the content column.)
Before:
After, as djot.js:
Left as is (djot-php extensions)
{word}boolean attributes ({y}givesy=""): documented indocs/guide/syntax.md("Boolean Attribute Shorthand (Extension)") anddocs/reference/enhancements.md#boolean-attribute-shorthand.^ captionwith 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" inBlockParser::tryParseCaption()), andBlockParserTest::testBlankBeforeAttachedCaptionKeepsListTightrelies on it.: termlines share one definition: "Multiple Definition Terms" indocs/reference/enhancements.md.The separate-line item attribute form (
- xthen{.c}on the<li>, soft-deprecated inBlockParser) 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.