mirror of
https://github.com/helix-editor/helix.git
synced 2024-09-11 18:58:00 +03:00
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.
This commit is contained in:
parent
630d91168a
commit
bbcc89241f
@ -6,7 +6,7 @@
|
||||
|
||||
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 @@ fn push_line<'a>(spans: &mut Vec<Span<'a>>, lines: &mut Vec<Spans<'a>>) {
|
||||
|
||||
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 @@ fn push_line<'a>(spans: &mut Vec<Span<'a>>, lines: &mut Vec<Spans<'a>>) {
|
||||
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 @@ fn push_line<'a>(spans: &mut Vec<Span<'a>>, lines: &mut Vec<Spans<'a>>) {
|
||||
|
||||
// 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 @@ fn push_line<'a>(spans: &mut Vec<Span<'a>>, lines: &mut Vec<Spans<'a>>) {
|
||||
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],
|
||||
|
Loading…
Reference in New Issue
Block a user