Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade pulldown-cmark to 0.10.0 #11

Merged
merged 3 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix!: Upgrade pulldown-cmark to version 0.10.0 and resolve breaking c…
…hanges
  • Loading branch information
ScratchCat458 committed Mar 27, 2024
commit 607457a2a826dde875df855f0ae7241e36356f33
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pulldown-cmark-toc"
version = "0.3.0"
version = "0.4.0-dev"
authors = ["Ross MacArthur <ross@macarthur.io>"]
edition = "2018"
description = "Generate a table of contents from a Markdown document."
Expand All @@ -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"
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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('`');
Expand Down