From a890a922ec41baca766320f7067010ab99b49804 Mon Sep 17 00:00:00 2001 From: "Connor Lay (Clay)" Date: Sun, 21 Aug 2022 20:01:02 -0700 Subject: [PATCH] Fix markdown indented code block rendering --- helix-term/src/ui/markdown.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index c53b3b6692fb2..62a36981733bb 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -231,7 +231,7 @@ impl Markdown { match tag { Tag::Heading(_, _, _) | Tag::Paragraph - | Tag::CodeBlock(CodeBlockKind::Fenced(_)) + | Tag::CodeBlock(_) | Tag::Item => { push_line(&mut spans, &mut lines); } @@ -242,15 +242,18 @@ impl Markdown { match tag { Tag::Heading(_, _, _) | Tag::Paragraph - | Tag::CodeBlock(CodeBlockKind::Fenced(_)) => { + | Tag::CodeBlock(_) => { lines.push(Spans::default()); } _ => (), } } Event::Text(text) => { - // TODO: temp workaround - if let Some(Tag::CodeBlock(CodeBlockKind::Fenced(language))) = tags.last() { + if let Some(Tag::CodeBlock(kind)) = tags.last() { + let language = match kind { + CodeBlockKind::Fenced(language) => language, + CodeBlockKind::Indented => "", + }; let tui_text = highlighted_code_block( text.to_string(), language,