aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/markdown.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs
index a0b299e7..923dd73a 100644
--- a/helix-term/src/ui/markdown.rs
+++ b/helix-term/src/ui/markdown.rs
@@ -178,6 +178,21 @@ impl Markdown {
.map(|key| get_theme(key))
.collect();
+ // 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>" => {
+ in_code = true;
+ None
+ }
+ Event::Html(tag) if *tag == *"</code>" => {
+ in_code = false;
+ None
+ }
+ Event::Text(text) if in_code => Some(Event::Code(text)),
+ _ => Some(event),
+ });
+
for event in parser {
match event {
Event::Start(Tag::List(list)) => {