From 838881fea02f04937a8430671376eee8d53dcca7 Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Sat, 1 Jan 2022 23:34:46 +0100 Subject: [PATCH] Upgrade dependencies This commit upgrades all dependencies to their current latest versions. Most notably, this includes upgrades to the following most critical libraries: pulldown-cmark v0.8.0 -> v0.9.0 pulldown-cmark-to-cmark v7.1.1 -> v9.0.0 In total, these dependencies were upgraded: bstr v0.2.16 -> v0.2.17 ignore v0.4.17 -> v0.4.18 libc v0.2.101 -> v0.2.112 memoffset v0.6.4 -> v0.6.5 num_cpus v1.13.0 -> v1.13.1 once_cell v1.8.0 -> v1.9.0 ppv-lite86 v0.2.10 -> v0.2.16 proc-macro2 v1.0.29 -> v1.0.36 pulldown-cmark v0.8.0 -> v0.9.0 pulldown-cmark-to-cmark v7.1.1 -> v9.0.0 quote v1.0.9 -> v1.0.14 rayon v1.5.0 -> v1.5.1 regex v1.5.3 -> v1.5.4 serde v1.0.130 -> v1.0.132 syn v1.0.75 -> v1.0.84 unicode-width v0.1.8 -> v0.1.9 version_check v0.9.3 -> v0.9.4 --- Cargo.lock | 56 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 10 +++++----- src/lib.rs | 14 +++++++++----- 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a424523..5f135f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,9 +34,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bstr" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "memchr", ] @@ -251,9 +251,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.101" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "linked-hash-map" @@ -288,18 +288,18 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -330,9 +330,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "output_vt100" @@ -357,9 +357,9 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "pretty_assertions" @@ -375,18 +375,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.29" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] [[package]] name = "pulldown-cmark" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" +checksum = "acd16514d1af5f7a71f909a44ef253cdb712a376d7ebc8ae4a471a9be9743548" dependencies = [ "bitflags", "getopts", @@ -396,18 +396,18 @@ dependencies = [ [[package]] name = "pulldown-cmark-to-cmark" -version = "7.1.1" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bc14bc6b9f5881f240f9766414707ab24f972bcc3388589fe15b22fb15dc60d" +checksum = "3f94dc756ef5c50ad28ccea8428ba5de9f4dca1fff6516a26b85e0b125a70d17" dependencies = [ "pulldown-cmark", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" dependencies = [ "proc-macro2", ] @@ -535,9 +535,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.130" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" [[package]] name = "serde_yaml" @@ -583,9 +583,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.75" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" +checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b" dependencies = [ "proc-macro2", "quote", @@ -626,9 +626,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" @@ -638,9 +638,9 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" diff --git a/Cargo.toml b/Cargo.toml index 89b12ef..5d72574 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,15 +27,15 @@ doc = false [dependencies] eyre = "0.6.5" gumdrop = "0.8.0" -ignore = "0.4.17" +ignore = "0.4.18" lazy_static = "1.4.0" matter = "0.1.0-alpha4" pathdiff = "0.2.1" percent-encoding = "2.1.0" -pulldown-cmark = "0.8.0" -pulldown-cmark-to-cmark = "7.1.1" -rayon = "1.5.0" -regex = "1.5.3" +pulldown-cmark = "0.9.0" +pulldown-cmark-to-cmark = "9.0.0" +rayon = "1.5.1" +regex = "1.5.4" serde_yaml = "0.8.23" slug = "0.1.4" snafu = "0.6.10" diff --git a/src/lib.rs b/src/lib.rs index 1b52a09..f4b3fe7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,7 @@ pub use walker::{vault_contents, WalkOptions}; use frontmatter::{frontmatter_from_str, frontmatter_to_str}; use pathdiff::diff_paths; use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS}; -use pulldown_cmark::{CodeBlockKind, CowStr, Event, Options, Parser, Tag}; +use pulldown_cmark::{CodeBlockKind, CowStr, Event, HeadingLevel, Options, Parser, Tag}; use pulldown_cmark_to_cmark::cmark_with_options; use rayon::prelude::*; use references::*; @@ -792,14 +792,15 @@ fn reduce_to_section<'a, 'b>(events: MarkdownEvents<'a>, section: &'b str) -> Ma let mut filtered_events = Vec::with_capacity(events.len()); let mut target_section_encountered = false; let mut currently_in_target_section = false; - let mut section_level = 0; - let mut last_level = 0; + let mut section_level = HeadingLevel::H1; + let mut last_level = HeadingLevel::H1; let mut last_tag_was_heading = false; for event in events.into_iter() { filtered_events.push(event.clone()); match event { - Event::Start(Tag::Heading(level)) => { + // FIXME: This should propagate fragment_identifier and classes. + Event::Start(Tag::Heading(level, _fragment_identifier, _classes)) => { last_tag_was_heading = true; last_level = level; if currently_in_target_section && level <= section_level { @@ -855,7 +856,10 @@ fn event_to_owned<'a>(event: Event) -> Event<'a> { fn tag_to_owned<'a>(tag: Tag) -> Tag<'a> { match tag { Tag::Paragraph => Tag::Paragraph, - Tag::Heading(level) => Tag::Heading(level), + Tag::Heading(level, _fragment_identifier, _classes) => { + // FIXME: This should propagate fragment_identifier and classes. + Tag::Heading(level, None, Vec::new()) + } Tag::BlockQuote => Tag::BlockQuote, Tag::CodeBlock(codeblock_kind) => Tag::CodeBlock(codeblock_kind_to_owned(codeblock_kind)), Tag::List(optional) => Tag::List(optional),