aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClay2022-08-24 00:12:04 +0000
committerGitHub2022-08-24 00:12:04 +0000
commit99b1e8ad89aa73b60b43a66a723c52f4b13b97ae (patch)
treeb69843c2f780bf10e833ba4083fe6fd3cbca279f
parente4c9d4082a139aac3aea4506918171b96e81f5b9 (diff)
Fix markdown indented code block rendering (#3503)
-rw-r--r--helix-term/src/ui/markdown.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs
index c53b3b66..a0b299e7 100644
--- a/helix-term/src/ui/markdown.rs
+++ b/helix-term/src/ui/markdown.rs
@@ -229,10 +229,7 @@ impl Markdown {
Event::End(tag) => {
tags.pop();
match tag {
- Tag::Heading(_, _, _)
- | Tag::Paragraph
- | Tag::CodeBlock(CodeBlockKind::Fenced(_))
- | Tag::Item => {
+ Tag::Heading(_, _, _) | Tag::Paragraph | Tag::CodeBlock(_) | Tag::Item => {
push_line(&mut spans, &mut lines);
}
_ => (),
@@ -240,17 +237,18 @@ impl Markdown {
// whenever heading, code block or paragraph closes, empty line
match tag {
- Tag::Heading(_, _, _)
- | Tag::Paragraph
- | Tag::CodeBlock(CodeBlockKind::Fenced(_)) => {
+ Tag::Heading(_, _, _) | Tag::Paragraph | 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,