Skip to content

Commit

Permalink
markdown: Recognize <code> tags with attributes as code (helix-edit…
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis authored and danillos committed Nov 21, 2023
1 parent f8563a5 commit 2e50413
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion helix-term/src/ui/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2e50413

Please sign in to comment.