Skip to content

Drop lone-marker guard: markers interrupt under blocksInterruptParagraphs#210

Merged
dereuromark merged 1 commit into
masterfrom
feature/drop-bip-lone-marker-guard
Jun 3, 2026
Merged

Drop lone-marker guard: markers interrupt under blocksInterruptParagraphs#210
dereuromark merged 1 commit into
masterfrom
feature/drop-bip-lone-marker-guard

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

Drop lone-marker guard under blocksInterruptParagraphs

blocksInterruptParagraphs (and its significantNewlines alias) is an opt-in
markdown/chat-like mode. The lone-marker lookahead added to it suppressed
genuine blocks, not just ambiguous prose: because a quote or list with
lazy continuation is byte-for-byte identical to a wrapped comparison, the
guard silently dropped legitimate content with no blank line before it.

foo
> a real quote
that wraps onto the next line

became one paragraph instead of a blockquote; single-line and lazily
wrapped lists were lost the same way.

A user enabling this mode is asking for aggressive interruption, so a
line-leading marker now interrupts the paragraph again, with no lookahead:

  • -/*/+ and > interrupt unconditionally (at top level and inside
    list items, so a sublist nests there too).
  • | interrupts only when the line is a real table row
    (tableParser->isTableRow()), so a pipe in prose does not split a
    paragraph into stray blocks.
  • # headings, fences and divs are unchanged; ordered lists keep the
    CommonMark 1./1)-only rule.

The cost is that an ambiguous x = 5\n- 3 or if a\n> b is read as a
block in this mode, which is the expected bargain of an opt-in
markdown-like mode. The default (non-blocksInterruptParagraphs) behavior,
where no block interrupts a paragraph, is unchanged.

nestedListsWithoutBlankLine remains the smaller subset: it nests sublists
in list items but does not let other block types interrupt. Tests that
encoded the old lone-marker guard are updated to the new contract.

blocksInterruptParagraphs (and its significantNewlines alias) is an opt-in
markdown/chat-like mode. The lone-marker lookahead added to it suppressed
genuine blocks, not just ambiguous prose: because a quote or list with
lazy continuation is byte-for-byte identical to a wrapped comparison, the
guard silently dropped legitimate content with no blank line before it.

    foo
    > a real quote
    that wraps onto the next line

became one paragraph instead of a blockquote; single-line and lazily
wrapped lists were lost the same way.

A user enabling this mode is asking for aggressive interruption, so a
line-leading marker now interrupts the paragraph again, with no lookahead:

- `-`/`*`/`+` and `>` interrupt unconditionally (at top level and inside
  list items, so a sublist nests there too).
- `|` interrupts only when the line is a real table row
  (tableParser->isTableRow()), so a pipe in prose does not split a
  paragraph into stray blocks.
- `#` headings, fences and divs are unchanged; ordered lists keep the
  CommonMark 1./1)-only rule.

The cost is that an ambiguous `x = 5\n- 3` or `if a\n> b` is read as a
block in this mode, which is the expected bargain of an opt-in
markdown-like mode. The default (non-blocksInterruptParagraphs) behavior,
where no block interrupts a paragraph, is unchanged.

nestedListsWithoutBlankLine remains the smaller subset: it nests sublists
in list items but does not let other block types interrupt. Tests that
encoded the old lone-marker guard are updated to the new contract.
@dereuromark dereuromark added the enhancement New feature or request label Jun 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.88%. Comparing base (efee942) to head (c2a6530).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #210      +/-   ##
============================================
+ Coverage     91.87%   91.88%   +0.01%     
+ Complexity     3488     3470      -18     
============================================
  Files           104      104              
  Lines          9860     9839      -21     
============================================
- Hits           9059     9041      -18     
+ Misses          801      798       -3     

☔ 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 7d1b663 into master Jun 3, 2026
6 checks passed
@dereuromark dereuromark deleted the feature/drop-bip-lone-marker-guard branch June 3, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant