Skip to content

Fix markdown highlighting of multi-line HTML tags#5422

Open
Gxrvish wants to merge 1 commit into
microsoft:mainfrom
Gxrvish:fix/markdown-multiline-html-tags
Open

Fix markdown highlighting of multi-line HTML tags#5422
Gxrvish wants to merge 1 commit into
microsoft:mainfrom
Gxrvish:fix/markdown-multiline-html-tags

Conversation

@Gxrvish

@Gxrvish Gxrvish commented Jul 25, 2026

Copy link
Copy Markdown

An indented line inside an HTML block was matched by the indented code block rule, which consumed the whole line as a string token and thus never entered the tag state. Continuation lines of the same tag then fell back to plain text.

Model CommonMark HTML blocks instead: a line that starts with at most 3 spaces of indent followed by an HTML tag enters a new htmlBlock state which lasts until the next blank line. Markdown block constructs, in particular indented code blocks, do not apply inside that state, so tags spanning multiple lines keep being tokenized as HTML.

Used Claude for help!! 🥂
Fixes: #5400

@Gxrvish

Gxrvish commented Jul 25, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

An indented line inside an HTML block was matched by the indented code
block rule, which consumed the whole line as a string token and thus
never entered the tag state. Continuation lines of the same tag then
fell back to plain text.

Model CommonMark HTML blocks instead: a line that starts with at most 3
spaces of indent followed by an HTML tag enters a new htmlBlock state
which lasts until the next blank line. Markdown block constructs, in
particular indented code blocks, do not apply inside that state, so tags
spanning multiple lines keep being tokenized as HTML.
@Gxrvish
Gxrvish force-pushed the fix/markdown-multiline-html-tags branch from a0c8807 to 156bf41 Compare July 25, 2026 07:16
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] Markdown Syntax: Nested Html tags inside of Markdown that span multiple lines render incorrectly

1 participant