Recognize an indented list marker at a block boundary#232
Merged
Conversation
djot treats indentation as significant only for nesting, so a leading- indented list marker (` - item`, `\t- item`) at the top level or after a blank line is just a list. djot-php matched the marker against the raw line, so any leading whitespace made it fall through to a paragraph, diverging from the reference implementation. Match the marker on the de-indented line in tryParseList(); the leading indent still becomes the list's base indentation. Lazy-continuation lines (an indented marker continuing an open paragraph, or collected as a list item's continuation without a blank line) never reach tryParseList(), so that behavior is unchanged. Full unit suite and official djot corpus pass.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #232 +/- ##
=========================================
Coverage 91.89% 91.89%
Complexity 3523 3523
=========================================
Files 106 106
Lines 9958 9958
=========================================
Hits 9151 9151
Misses 807 807 ☔ View full report in Codecov by Harness. 🚀 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.
What
djot treats indentation as significant only for nesting (
doc/syntax.md: "Indentation is only significant for list item or footnote nesting"). So a leading-indented list marker at the top level, or after a blank line, is simply a list. Reference djot parses these as lists:- item<ul><li>item<p>- item</p>\t- item<ul><li>item<p>- item</p>1. item<ol><li>item<p>1. item</p>djot-php matched the marker against the raw line, so leading whitespace made
parseListItemMarkerfail and the line became a paragraph.Fix
Match the marker on the de-indented line in
tryParseList(). The leading indent still becomes the list's base indentation (nested lists already run with a non-zero base, so the existing machinery handles it).Lazy-continuation lines are unaffected, because they never reach
tryParseList():text/- item, no blank) is collected by the paragraph;- a/- b) is collected as that item's continuation.Both verified to still render as text.
Scope / known edge
This is the parser-side tab gap B from #230/#231. Covers the common case (uniform leading indent). One rare divergence remains: a first item indented with a less-indented sibling (
- a/- b) ends the list early in djot-php, where reference keeps one list. Vanishingly rare; left for the tab-stop work (gap C) if it matters.Verification
Full unit suite + official djot corpus pass (2498 tests).