Fix inline HTML comments being mishandled when inside backtick spans#523
Open
maennchen wants to merge 1 commit into
Open
Fix inline HTML comments being mishandled when inside backtick spans#523maennchen wants to merge 1 commit into
maennchen wants to merge 1 commit into
Conversation
The line scanner's `process_line` function used a regex to split any line containing `<!-- ... -->` into a block-level comment and trailing text, even when the comment appeared inside a backtick code span. This caused the backticks to be left unclosed and the comment to leak into the output. Fix by removing `process_line` and the `comment_rest` regex entirely — block-level comments at the start of a line are already handled correctly by `html_comment_complete`/`html_comment_start` in `_type_of`. Add a new `converter_for_inline_comment` to the inline parser so that `<!-- ... -->` appearing inline in text is emitted as a proper comment node rather than being HTML-escaped. Closes pragdave#518
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.
The line scanner's
process_linefunction used a regex to split any line containing<!-- ... -->into a block-level comment and trailing text, even when the comment appeared inside a backtick code span. This caused the backticks to be left unclosed and the comment to leak into the output.Fix by removing
process_lineand thecomment_restregex entirely — block-level comments at the start of a line are already handled correctly byhtml_comment_complete/html_comment_startin_type_of. Add a newconverter_for_inline_commentto the inline parser so that<!-- ... -->appearing inline in text is emitted as a proper comment node rather than being HTML-escaped.Closes #518