aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2023-09-26 02:05:19 +0000
committerGitHub2023-09-26 02:05:19 +0000
commit01e281ce107e57cc1865a0e09e89a8e8c79f2a4e (patch)
tree36382a4b94e64b2f61c332206b9dae4f1e70530c
parentb495ca429ad484e3c387d871a04a664252ebcd71 (diff)
markdown: Recognize `<code>` tags with attributes as code (#8397)
-rw-r--r--helix-term/src/ui/markdown.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs
index 3c8a9868..4d0c0d4a 100644
--- a/helix-term/src/ui/markdown.rs
+++ b/helix-term/src/ui/markdown.rs
@@ -184,7 +184,9 @@ impl Markdown {
// Transform text in `<code>` blocks into `Event::Code`
let mut in_code = false;
let parser = parser.filter_map(|event| match event {
- Event::Html(tag) if *tag == *"<code>" => {
+ Event::Html(tag)
+ if tag.starts_with("<code") && matches!(tag.chars().nth(5), Some(' ' | '>')) =>
+ {
in_code = true;
None
}