Repository navigation
Conversation
In this input the blank line is part of the fenced code block, which is only closed by the next list item: - a - ``` - b The blank line did not separate the items, but the list was made loose. Same for a blank line in a fenced code block of a nested list followed by more content of the outer item. cmark and commonmark.js keep these lists tight. A blank line in a fenced code block that is still open on the next line was part of the code block, so don't count it.
This branch has not been deployed
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.
In this input the blank line is inside the fenced code block. The fence is never closed, so the code block runs until the next list item starts:
commonmark-java made the list loose:
But the blank line is part of the code block (it shows up in the
<code>content), so it does not separate the items. cmark and commonmark.js keep the list tight (<li>a</li>,<li>b</li>). Same thing for a blank line in a fenced code block of a nested list, when more content of the outer item follows:Here the outer list should stay tight (
b</li>), but it got<p>b</p>.The fix: on the line after a blank line, if a fenced code block is still the active block, the blank line was part of that code block, so
ListBlockParserandListItemParserdon't count it. A blank line that ends a block quote around the fence still counts, so- > ~~~, blank line,- bstays loose, like cmark and commonmark.js.I left HTML blocks alone on purpose: for
- <!--, blank line,- b, cmark says loose and commonmark.js says tight.Tests: added 3 cases to
ListTightLooseTest. Before the fix, 2 of them fail (19 run, 2 failures). After the fix all 19 pass. Fullmvn testpasses (2305 incommonmark, all other modules green), andmvn spotless:checkpasses. Expected outputs are what cmark-gfm and commonmark.js 0.31.2 produce.