Drop lone-marker guard: markers interrupt under blocksInterruptParagraphs#210
Merged
Merged
Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
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.
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 insidelist 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 theCommonMark 1./1)-only rule.
The cost is that an ambiguous
x = 5\n- 3orif a\n> bis read as ablock 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.