markdown: Recognize `<code>` tags with attributes as code (#8397)

pull/8399/head
Michael Davis 1 year ago committed by GitHub
parent b495ca429a
commit 01e281ce10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -184,7 +184,9 @@ impl Markdown {
// Transform text in `<code>` blocks into `Event::Code` // Transform text in `<code>` blocks into `Event::Code`
let mut in_code = false; let mut in_code = false;
let parser = parser.filter_map(|event| match event { 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; in_code = true;
None None
} }

Loading…
Cancel
Save