Skip to content

End a quoted paragraph in a list item at a bare quote marker - #317

Merged
dereuromark merged 1 commit into
masterfrom
fix/quote-marker-closes-item-paragraph
Oct 16, 2026
Merged

dereuromark merged 1 commit into
masterfrom
fix/quote-marker-closes-item-paragraph

Conversation

@dereuromark

Copy link
Copy Markdown
Contributor

Inside a list item or a definition, a quote line holding only > did not close the quoted paragraph, so the next unindented line was taken as lazy text and stayed in the item:

- > a
  >
b

djot.js ends the list and makes b a paragraph after it. djot-php kept b in the item. The same happened in a definition (: t, blank, > a, >, b) and with nested quotes.

The syntax description: the contents of a block quote "(minus initial >) are parsed as block-level content", so a bare > is a blank line inside the quote, and a "paragraph ends with a blank line or the end of the document". Once the paragraph is closed, b cannot continue it lazily. The item tracker now remembers how many quote levels the open paragraph sits in and closes it on a line with nothing after those markers. A > after plain item text is still text, as before.

Documents with this shape render differently, so this is labeled bc-breaking.

Measured against djot.js

On the 4853 generated block-family inputs, djot-php differed from djot.js 9790d4d on 852 after #316 and 849 with this change. None moved the other way. On the 1080 list item bodies from #316 nothing changed.

The new tests keep <p> inside a quote in a tight list item, where djot.js renders the text bare. That is the djot.js behavior that gives nested blocks the outer list's tightness, which this PR does not follow.

Inside a list item or a definition, a quote line holding only `>` did not
close the quoted paragraph, so the next unindented line was taken as lazy
text and stayed in the item:

    - > a
      >
    b

djot.js ends the list and makes `b` a paragraph after it. The syntax
description: the contents of a block quote "(minus initial `>`) are parsed
as block-level content", so a bare `>` is a blank line inside the quote,
and a "paragraph ends with a blank line or the end of the document". With
the paragraph closed, `b` is no lazy continuation. The item tracker now
remembers how many quote levels the open paragraph sits in and closes it on
a line with nothing after those markers.
@dereuromark dereuromark added bug Something isn't working bc-breaking labels Oct 16, 2026
@dereuromark
dereuromark merged commit 9207f80 into master Oct 16, 2026
4 checks passed
@dereuromark
dereuromark deleted the fix/quote-marker-closes-item-paragraph branch October 16, 2026 15:02
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.13%. Comparing base (5b9c33c) to head (64956db).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/Parser/BlockParser.php 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #317   +/-   ##
=========================================
  Coverage     93.13%   93.13%           
- Complexity     4757     4770   +13     
=========================================
  Files           118      118           
  Lines         12706    12721   +15     
=========================================
+ Hits          11834    11848   +14     
- Misses          872      873    +1     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bc-breaking bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant