From 51e0a9d462ae38017bce067f1868e2f911e20e73 Mon Sep 17 00:00:00 2001 From: Elijah Potter Date: Tue, 12 Mar 2024 10:22:03 -0600 Subject: [PATCH] feat: updated `pulldown-cmark` --- Cargo.lock | 13 ++++++++++--- harper-core/Cargo.toml | 2 +- harper-core/src/parsers/markdown.rs | 8 ++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9f3c8874..8459154d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1017,16 +1017,23 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +checksum = "dce76ce678ffc8e5675b22aa1405de0b7037e2fdf8913fea40d1926c6fe1e6e7" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "getopts", "memchr", + "pulldown-cmark-escape", "unicase", ] +[[package]] +name = "pulldown-cmark-escape" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5d8f9aa0e3cbcfaf8bf00300004ee3b72f74770f9cbac93f6928771f613276b" + [[package]] name = "quote" version = "1.0.35" diff --git a/harper-core/Cargo.toml b/harper-core/Cargo.toml index 2a006be6..aec71f69 100644 --- a/harper-core/Cargo.toml +++ b/harper-core/Cargo.toml @@ -14,7 +14,7 @@ is-macro = "0.3.0" itertools = "0.12.1" once_cell = "1.19.0" paste = "1.0.14" -pulldown-cmark = "0.9.3" +pulldown-cmark = "0.10.0" serde = { version = "1.0.197", features = ["derive"] } smallvec = { version = "1.13.1", features = ["serde"] } thiserror = "1.0.57" diff --git a/harper-core/src/parsers/markdown.rs b/harper-core/src/parsers/markdown.rs index 7068a46b..6b5ed955 100644 --- a/harper-core/src/parsers/markdown.rs +++ b/harper-core/src/parsers/markdown.rs @@ -38,8 +38,8 @@ impl Parser for Markdown { }); } pulldown_cmark::Event::Start(tag) => stack.push(tag), - pulldown_cmark::Event::End(pulldown_cmark::Tag::Paragraph) - | pulldown_cmark::Event::End(pulldown_cmark::Tag::Item) => tokens.push(Token { + pulldown_cmark::Event::End(pulldown_cmark::TagEnd::Paragraph) + | pulldown_cmark::Event::End(pulldown_cmark::TagEnd::Item) => tokens.push(Token { span: Span::new_with_len(traversed_chars, 1), kind: TokenKind::Newline(1) }), @@ -69,8 +69,8 @@ impl Parser for Markdown { } if !(matches!(tag, Tag::Paragraph) - || matches!(tag, Tag::Link(..)) - || matches!(tag, Tag::Heading(..)) + || matches!(tag, Tag::Link { .. }) + || matches!(tag, Tag::Heading { .. }) || matches!(tag, Tag::Item) || matches!(tag, Tag::TableCell) || matches!(tag, Tag::Emphasis)