aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/markdown.rs
diff options
context:
space:
mode:
authorMichael Davis2024-02-06 00:32:25 +0000
committerBlaž Hrastnik2024-02-07 14:53:51 +0000
commitbbcc89241fd63b460ea7b1661a550f5b9eacba4c (patch)
tree1122a7039d941db633850731207b297867e22cc6 /helix-term/src/ui/markdown.rs
parent630d91168a7aa2a3da72a55266dee663565f6edf (diff)
Fix pulldown_cmark breaking changes to tag types
* Tags and TagEnd are now separate enums since <https://redirect.github.com/raphlinus/pulldown-cmark/pull/517>. * The `Tag::Heading` member has been changed from a tuple variant to a struct variant.
Diffstat (limited to 'helix-term/src/ui/markdown.rs')
-rw-r--r--helix-term/src/ui/markdown.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs
index 4d0c0d4a..5cf530ad 100644
--- a/helix-term/src/ui/markdown.rs
+++ b/helix-term/src/ui/markdown.rs
@@ -6,7 +6,7 @@ use tui::{
use std::sync::Arc;
-use pulldown_cmark::{CodeBlockKind, Event, HeadingLevel, Options, Parser, Tag};
+use pulldown_cmark::{CodeBlockKind, Event, HeadingLevel, Options, Parser, Tag, TagEnd};
use helix_core::{
syntax::{self, HighlightEvent, InjectionLanguageMarker, Syntax},
@@ -209,7 +209,7 @@ impl Markdown {
list_stack.push(list);
}
- Event::End(Tag::List(_)) => {
+ Event::End(TagEnd::List(_)) => {
list_stack.pop();
// whenever top-level list closes, empty line
@@ -249,7 +249,10 @@ impl Markdown {
Event::End(tag) => {
tags.pop();
match tag {
- Tag::Heading(_, _, _) | Tag::Paragraph | Tag::CodeBlock(_) | Tag::Item => {
+ TagEnd::Heading(_)
+ | TagEnd::Paragraph
+ | TagEnd::CodeBlock
+ | TagEnd::Item => {
push_line(&mut spans, &mut lines);
}
_ => (),
@@ -257,7 +260,7 @@ impl Markdown {
// whenever heading, code block or paragraph closes, empty line
match tag {
- Tag::Heading(_, _, _) | Tag::Paragraph | Tag::CodeBlock(_) => {
+ TagEnd::Heading(_) | TagEnd::Paragraph | TagEnd::CodeBlock => {
lines.push(Spans::default());
}
_ => (),
@@ -279,7 +282,7 @@ impl Markdown {
lines.extend(tui_text.lines.into_iter());
} else {
let style = match tags.last() {
- Some(Tag::Heading(level, ..)) => match level {
+ Some(Tag::Heading { level, .. }) => match level {
HeadingLevel::H1 => heading_styles[0],
HeadingLevel::H2 => heading_styles[1],
HeadingLevel::H3 => heading_styles[2],