Skip to content

Fix inline HTML comments being mishandled when inside backtick spans#523

Open
maennchen wants to merge 1 commit into
pragdave:masterfrom
maennchen:jm/inline_quoted_comment
Open

Fix inline HTML comments being mishandled when inside backtick spans#523
maennchen wants to merge 1 commit into
pragdave:masterfrom
maennchen:jm/inline_quoted_comment

Conversation

@maennchen
Copy link
Copy Markdown

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 #518

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug with nested HTML comments inside backquotes

1 participant