Add nestedListsWithoutBlankLine lever; make blocksInterruptParagraphs interrupt consistently in lists#207
Merged
Conversation
…ificantNewlines via granular levers
…cantNewlines rewiring
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #207 +/- ##
============================================
+ Coverage 91.82% 91.87% +0.04%
- Complexity 3458 3470 +12
============================================
Files 104 104
Lines 9799 9829 +30
============================================
+ Hits 8998 9030 +32
+ Misses 801 799 -2 ☔ 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.
Summary
Adds two composable, opt-in list-nesting levers and deprecates the broad one, so paragraph interruption behaves the same at the top level and inside list items.
nestedListsWithoutBlankLinelever: a sublist nests inside a list item without a blank line (markdown-style compact lists). Nothing else nests. Available as a constructor flag,setNestedListsWithoutBlankLine(), andDjotConverter::withNestedListsWithoutBlankLine().blocksInterruptParagraphsmade consistent: it now also interrupts a list item's lead paragraph, so an indented non-list block nests inside the item, using the same lone-marker lookahead as the top level. Unambiguous openers (#, fenced code,:::,---) and real multi-line blocks nest; an ambiguous single-line marker (>comparison,|) stays literal. A lone> 5indented under a list item now behaves exactly like it does at the top level.significantNewlinesredefined: now equivalent toblocksInterruptParagraphs+nestedListsWithoutBlankLine, and deprecated. The broadnestedBlocksInListsis also deprecated (kept working, unchanged eager nesting).All levers are opt-in; no default behavior changes.
Implementation
BlockParser::allowsImmediateNestedBlock()drives both in-list nesting sites; the interrupt branch routes through the existingstartsNewBlockSignificant()lookahead so in-list and top-level interruption share one rule.