From 50f1163a0e70982cc81185eeaa10131841c03546 Mon Sep 17 00:00:00 2001 From: Hayden Brown Date: Sun, 31 Mar 2024 18:30:30 +1000 Subject: [PATCH] Upgrade pulldown-cmark to 0.10.0 (#11) --- Cargo.toml | 2 +- src/lib.rs | 6 +++--- src/render.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2789376..b97c66a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,5 +12,5 @@ categories = ["text-processing"] [dependencies] once_cell = "1.18.0" -pulldown-cmark = { version = "0.9.3", default-features = false } +pulldown-cmark = { version = "0.10.0", default-features = false } regex = "1.9.3" diff --git a/src/lib.rs b/src/lib.rs index e6110fd..f1f5926 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ use std::fmt::Write; use std::slice::Iter; pub use pulldown_cmark::HeadingLevel; -use pulldown_cmark::{Event, Options as CmarkOptions, Parser, Tag}; +use pulldown_cmark::{Event, Options as CmarkOptions, Parser, Tag, TagEnd}; pub use render::{ItemSymbol, Options}; pub use slug::{GitHubSlugifier, Slugify}; @@ -127,13 +127,13 @@ impl<'a> TableOfContents<'a> { for event in events { let event = event.borrow(); match event { - Event::Start(Tag::Heading(level, _, _)) => { + Event::Start(Tag::Heading { level, .. }) => { current = Some(Heading { events: Vec::new(), level: *level, }); } - Event::End(Tag::Heading(level, _, _)) => { + Event::End(TagEnd::Heading(level)) => { let heading = current.take().unwrap(); assert_eq!(heading.level, *level); headings.push(heading); diff --git a/src/render.rs b/src/render.rs index 0d66f25..53c6ce0 100644 --- a/src/render.rs +++ b/src/render.rs @@ -5,7 +5,7 @@ use std::fmt; use std::fmt::Write; use std::ops::RangeInclusive; -use pulldown_cmark::{Event, HeadingLevel, Tag}; +use pulldown_cmark::{Event, HeadingLevel, Tag, TagEnd}; use crate::slug::{GitHubSlugifier, Slugify}; @@ -46,8 +46,8 @@ where for event in events { let event = event.borrow(); match event { - Event::Start(Tag::Emphasis) | Event::End(Tag::Emphasis) => buf.push('*'), - Event::Start(Tag::Strong) | Event::End(Tag::Strong) => buf.push_str("**"), + Event::Start(Tag::Emphasis) | Event::End(TagEnd::Emphasis) => buf.push('*'), + Event::Start(Tag::Strong) | Event::End(TagEnd::Strong) => buf.push_str("**"), Event::Text(s) => buf.push_str(s), Event::Code(s) => { buf.push('`');