Fix parsing of spaces in code#786
Merged
Martin1887 merged 1 commit intopulldown-cmark:masterfrom Jan 15, 2024
Merged
Conversation
The changed case in regression.txt actually aligns our behavior with [commonmark.js](https://spec.commonmark.org/dingus/?text=%3E%20%60%0A%3E%20%60&smart=1). Check the "HTML" tab. This change simplifies everything by having the code span maker read the text directly, instead of deciphering the tree with all the emphasis data and trimmed spaces (that still gets used if it later finds out that MaybeCode isn't code).
Collaborator
Author
|
CC https://talk.commonmark.org/t/code-span-with-leading-newline/4546 While fuzz testing vs commonmark-hs, I found a corner case with the ASCII string `
`This PR produces two spaces (it converts the newline to a space, and, since the resulting string contains only spaces, it leaves the two spaces alone), while commonmark.js only produces one. This is apparently ambiguous enough that markdown-it went with the same interpretation that I did, and it's a corner case that well-formatted documents shouldn't hit, but still. Full disclosure: the reference implementation treats newlines differently than this PR does. |
Collaborator
|
I understand the same, it is probably a corner-case bug of the reference implementation. |
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.
Fixes #661
The changed case in regression.txt actually aligns our behavior with commonmark.js. Check the "HTML" tab.
This change simplifies everything by having the code span maker read the text directly, instead of deciphering the tree with all the emphasis data and trimmed spaces (that still gets used if it later finds out that MaybeCode isn't code).