|
|
@ -229,10 +229,7 @@ impl Markdown {
|
|
|
|
Event::End(tag) => {
|
|
|
|
Event::End(tag) => {
|
|
|
|
tags.pop();
|
|
|
|
tags.pop();
|
|
|
|
match tag {
|
|
|
|
match tag {
|
|
|
|
Tag::Heading(_, _, _)
|
|
|
|
Tag::Heading(_, _, _) | Tag::Paragraph | Tag::CodeBlock(_) | Tag::Item => {
|
|
|
|
| Tag::Paragraph
|
|
|
|
|
|
|
|
| Tag::CodeBlock(CodeBlockKind::Fenced(_))
|
|
|
|
|
|
|
|
| Tag::Item => {
|
|
|
|
|
|
|
|
push_line(&mut spans, &mut lines);
|
|
|
|
push_line(&mut spans, &mut lines);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => (),
|
|
|
|
_ => (),
|
|
|
@ -240,17 +237,18 @@ impl Markdown {
|
|
|
|
|
|
|
|
|
|
|
|
// whenever heading, code block or paragraph closes, empty line
|
|
|
|
// whenever heading, code block or paragraph closes, empty line
|
|
|
|
match tag {
|
|
|
|
match tag {
|
|
|
|
Tag::Heading(_, _, _)
|
|
|
|
Tag::Heading(_, _, _) | Tag::Paragraph | Tag::CodeBlock(_) => {
|
|
|
|
| Tag::Paragraph
|
|
|
|
|
|
|
|
| Tag::CodeBlock(CodeBlockKind::Fenced(_)) => {
|
|
|
|
|
|
|
|
lines.push(Spans::default());
|
|
|
|
lines.push(Spans::default());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => (),
|
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Event::Text(text) => {
|
|
|
|
Event::Text(text) => {
|
|
|
|
// TODO: temp workaround
|
|
|
|
if let Some(Tag::CodeBlock(kind)) = tags.last() {
|
|
|
|
if let Some(Tag::CodeBlock(CodeBlockKind::Fenced(language))) = tags.last() {
|
|
|
|
let language = match kind {
|
|
|
|
|
|
|
|
CodeBlockKind::Fenced(language) => language,
|
|
|
|
|
|
|
|
CodeBlockKind::Indented => "",
|
|
|
|
|
|
|
|
};
|
|
|
|
let tui_text = highlighted_code_block(
|
|
|
|
let tui_text = highlighted_code_block(
|
|
|
|
text.to_string(),
|
|
|
|
text.to_string(),
|
|
|
|
language,
|
|
|
|
language,
|
|
|
|