Fix: Allow lists immediately after paragraphs (Issue #254)#260
Merged
Fix: Allow lists immediately after paragraphs (Issue #254)#260
Conversation
Add simple regex preprocessing to insert blank lines before list markers when they immediately follow a non-blank line. This provides CommonMark/GFM behavior where lists can interrupt paragraphs without requiring a blank line. Implementation: - Add MPPreprocessMarkdownForLists() function in MPRenderer.m - Regex matches list markers (-, *, +, or N.) after non-blank lines - Inserts blank line to work around Hoedown's strict spacing requirement Known edge cases (documented in code, intentionally not handled): - Lists inside fenced code blocks may be incorrectly modified - Lists inside indented code blocks may be incorrectly modified - Blockquotes may need special handling Tests: - Add 6 unit tests in MPRendererEdgeCaseTests.m for issue #254 - Update regression-issue34.html golden file for correct list rendering Related to #254
Contributor
Code Coverage ReportCurrent Coverage: 51.59% Coverage Details (Summary) |
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
MPPreprocessMarkdownForListsthat inserts a blank line before list markers when they immediately follow a paragraphTechnical Details
The fix is a minimal ~20 line preprocessor that:
-,*,+, or1.)Known edge cases documented in code:
- (void)method)Changes
MacDown/Code/Document/MPRenderer.m- Core preprocessor implementationMacDownTests/MPRendererEdgeCaseTests.m- 6 new unit testsTest plan
Related to #254