markdown: Recognize `<code>` tags with attributes as code (#8397)
commit01e281ce107e57cc1865a0e09e89a8e8c79f2a4e
authorMichael Davis <mcarsondavis@gmail.com>
dateMon 25 Sep 2023, 21:05 (3 years ago)
parentb495ca4
helix-term/src/ui/markdown.rs+3−1
@@ -184,7 +184,9 @@ impl Markdown {
184184 // Transform text in `<code>` blocks into `Event::Code`
185185 let mut in_code = false;
186186 let parser = parser.filter_map(|event| match event {
187− Event::Html(tag) if *tag == *"<code>" => {
187+ Event::Html(tag)
188+ if tag.starts_with("<code") && matches!(tag.chars().nth(5), Some(' ' | '>')) =>
189+ {
188190 in_code = true;
189191 None
190192 }