Skip to content

Commit a890a92

Browse files
committed
Fix markdown indented code block rendering
1 parent 18909aa commit a890a92

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

helix-term/src/ui/markdown.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl Markdown {
231231
match tag {
232232
Tag::Heading(_, _, _)
233233
| Tag::Paragraph
234-
| Tag::CodeBlock(CodeBlockKind::Fenced(_))
234+
| Tag::CodeBlock(_)
235235
| Tag::Item => {
236236
push_line(&mut spans, &mut lines);
237237
}
@@ -242,15 +242,18 @@ impl Markdown {
242242
match tag {
243243
Tag::Heading(_, _, _)
244244
| Tag::Paragraph
245-
| Tag::CodeBlock(CodeBlockKind::Fenced(_)) => {
245+
| Tag::CodeBlock(_) => {
246246
lines.push(Spans::default());
247247
}
248248
_ => (),
249249
}
250250
}
251251
Event::Text(text) => {
252-
// TODO: temp workaround
253-
if let Some(Tag::CodeBlock(CodeBlockKind::Fenced(language))) = tags.last() {
252+
if let Some(Tag::CodeBlock(kind)) = tags.last() {
253+
let language = match kind {
254+
CodeBlockKind::Fenced(language) => language,
255+
CodeBlockKind::Indented => "",
256+
};
254257
let tui_text = highlighted_code_block(
255258
text.to_string(),
256259
language,

0 commit comments

Comments
 (0)