markdown: Fix rendering of inline HTML <code> tags (#43513)

Added support for rendering HTML `<code> `tags inside Markdown content.
Previously, these tags were ignored by the renderer and displayed as raw
text (inside LSP hover documentation).

Closes: #43166 

Release Notes:
- Fixed styling of `<code>` HTML tags in Markdown popovers.

Before:
<img width="445" height="145" alt="image"
src="https://github.com/user-attachments/assets/67c4f864-1fa7-46a9-bb25-8b07a335355d"
/>
After:
<img width="699" height="257" alt="image"
src="https://github.com/user-attachments/assets/8d784a75-28be-43cd-80b4-3aad8babb65b"
/>
This commit is contained in:
Arthur Schurhaus
2025-12-03 12:58:51 -03:00
committed by GitHub
parent 7e177c496c
commit c248a956e0

View File

@@ -1202,6 +1202,15 @@ impl Element for MarkdownElement {
builder.push_text(html, range.clone());
}
MarkdownEvent::InlineHtml => {
let html = &parsed_markdown.source[range.clone()];
if html.starts_with("<code>") {
builder.push_text_style(self.style.inline_code.clone());
continue;
}
if html.trim_end().starts_with("</code>") {
builder.pop_text_style();
continue;
}
builder.push_text(&parsed_markdown.source[range.clone()], range.clone());
}
MarkdownEvent::Rule => {