Skip to content

fix: list-item {.x} line no longer terminates the list#186

Merged
dereuromark merged 3 commits into
masterfrom
fix/list-item-attr-line-terminator
May 20, 2026
Merged

fix: list-item {.x} line no longer terminates the list#186
dereuromark merged 3 commits into
masterfrom
fix/list-item-attr-line-terminator

Conversation

@dereuromark

Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where a postfix {...} line inside a list item silently terminated the list, causing any following indented content (blockquote, paragraph continuation, nested list) to escape into a sibling paragraph outside the list.

New rule

A standalone {...} line on an indented continuation attaches to the <li> only when it is the last content line of the item. If another block follows within the same item, the {...} reverts to a standard djot block attribute for that following block; the list / item are not terminated.

Before / after

Input:

- item
  {.x}
  > quote

Before:

<ul>
<li class="x">
item
</li>
</ul>
<p>&gt; quote</p>

After:

<ul>
<li>
item
<blockquote class="x">
<p>quote</p>
</blockquote>
</li>
</ul>

Tests

Five new test methods in tests/TestCase/DjotConverterTest.php covering: blockquote-after-attr, paragraph-after-attr, nested-list-after-attr, last-line baseline regression guard, and loose-list (blank-line) regression guard.

Docs

Updated docs/reference/enhancements.md and docs/guide/syntax.md to document the rule with a worked example.

Related

Part of the attribute-hardening sweep. See sibling issue #185 tracking jgm/djot#262 (marker-adjacent syntax — out of scope here).

Mark Scherer added 3 commits May 20, 2026 01:41
Adds failing tests describing the target rule: a {...} line on an
indented continuation attaches to the <li> only when it is the last
content line of the item. If another block follows it in the same
item, the {...} reverts to a standard djot block-attribute for that
following block and the list is NOT terminated.

Two regression guards (last-line and blank-line/loose) already pass.
The three new mid-item continuation tests fail against current master
and will be made green in the next commit.
Previously, a postfix {.x} line inside a list item silently
terminated the list-item / list, causing any following indented
content (blockquote, paragraph continuation, nested list) to escape
into a sibling paragraph outside the list.

Now: a {...} line attaches to the <li> only when it is the last
content line of the item. If another block follows it within the
same item, the {...} reverts to a standard djot block attribute for
that following block and the list / item remain intact.

Also tightens the nested-list test assertion to reflect that the
nested <ul> now correctly picks up the pushed-back block attribute.
@dereuromark dereuromark added the bug Something isn't working label May 19, 2026
@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.11%. Comparing base (6b90dfe) to head (bf0b39c).

Files with missing lines Patch % Lines
src/Parser/BlockParser.php 96.29% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #186      +/-   ##
============================================
+ Coverage     91.10%   91.11%   +0.01%     
- Complexity     3321     3331      +10     
============================================
  Files            99       99              
  Lines          8497     8521      +24     
============================================
+ Hits           7741     7764      +23     
- Misses          756      757       +1     

☔ View full report in Codecov by Sentry.
📢 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.

@dereuromark dereuromark merged commit b9198a6 into master May 20, 2026
6 checks passed
@dereuromark dereuromark deleted the fix/list-item-attr-line-terminator branch May 20, 2026 00:01
dereuromark added a commit that referenced this pull request May 20, 2026
Documents the governing principle ("attributes precede their target;
adjacency selects the tighter target where supported") and a single
table covering all djot-php attribute targets (block, inline, <li>,
<dt>, <dd>, <dl>, table row, table cell, marker-glyph not-addressable
note). Notes the start/type/reversed strip on <li>/<dd> (#187) and
the list-item last-content-line rule (#186).
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