Repository navigation
Conversation
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.
When a code fence is open inside a block quote or list item, a following line that does not continue that container still goes through the closing-fence check. As a result, it either closes the fence, or it is silently dropped if it starts with fence characters but is not a valid closing fence:
In the second case the "
" line disappears. cmark and commonmark.js end the block quote at the unprefixed line, as fenced code cannot be continued lazily. The "```" therefore opens a new code block (`<pre><code>after\n</code></pre>`), and "" is kept as paragraph text (<p>``\nafter</p>). The same happens with list items (- ```\n code\n```\nafter).In
md_analyze_line(), the fenced code continuation branch ran even whenn_parents < ctx->n_containers. Its latern_parents == ctx->n_containerscheck only prevented the line from becoming code.md_is_closing_code_fence()had already turned a real closing fence intoMD_LINE_BLANK, and on failure it had advancedoffpast the fence characters. The branch is now entered only when all containers continue, so the line is analyzed like any other line that ends the container.Added three examples to
test/regressions.txt; they fail before the change and pass after.python3 scripts/run-tests.pypasses with a-WerrorDebug build.Found by differential testing against cmark.