From 91f04bc7bae2fb56ae11e3086553c4fdb0b68da0 Mon Sep 17 00:00:00 2001 From: Roms1383 Date: Sun, 16 Jun 2024 10:16:10 +0700 Subject: [PATCH] Upgrade pulldown-cmark to 0.13.0 --- Cargo.lock | 33 +++++++------------ Cargo.toml | 2 +- .../mdbook-html/src/html_handlebars/search.rs | 7 ++++ .../mdbook-remove-emphasis/Cargo.toml | 6 ++-- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d89f15ac..68302dd1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1359,7 +1359,7 @@ dependencies = [ "mdbook-markdown", "mdbook-renderer", "pretty_assertions", - "pulldown-cmark 0.10.3", + "pulldown-cmark", "regex", "serde", "serde_json", @@ -1373,7 +1373,7 @@ name = "mdbook-markdown" version = "0.5.0-alpha.1" dependencies = [ "log", - "pulldown-cmark 0.10.3", + "pulldown-cmark", "regex", ] @@ -1392,7 +1392,7 @@ name = "mdbook-remove-emphasis" version = "0.1.0" dependencies = [ "mdbook-preprocessor", - "pulldown-cmark 0.12.2", + "pulldown-cmark", "pulldown-cmark-to-cmark", "serde_json", ] @@ -1415,7 +1415,7 @@ dependencies = [ "log", "mdbook-core", "memchr", - "pulldown-cmark 0.10.3", + "pulldown-cmark", "serde", ] @@ -1816,9 +1816,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.10.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" +checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" dependencies = [ "bitflags 2.9.1", "memchr", @@ -1826,30 +1826,19 @@ dependencies = [ "unicase", ] -[[package]] -name = "pulldown-cmark" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" -dependencies = [ - "bitflags 2.9.1", - "memchr", - "unicase", -] - [[package]] name = "pulldown-cmark-escape" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3" +checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" [[package]] name = "pulldown-cmark-to-cmark" -version = "18.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e02b63adcb49f2eb675b1694b413b3e9fedbf549dfe2cc98727ad97a0c30650" +checksum = "e5b6a0769a491a08b31ea5c62494a8f144ee0987d86d670a8af4df1e1b7cde75" dependencies = [ - "pulldown-cmark 0.12.2", + "pulldown-cmark", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f027a20a..69af69a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ notify-debouncer-mini = "0.6.0" opener = "0.8.2" pathdiff = "0.2.3" pretty_assertions = "1.4.1" -pulldown-cmark = { version = "0.10.3", default-features = false, features = ["html"] } # Do not update, part of the public api. +pulldown-cmark = { version = "0.13.0", default-features = false, features = ["html"] } # Do not update, part of the public api. regex = "1.11.1" select = "0.6.1" semver = "1.0.26" diff --git a/crates/mdbook-html/src/html_handlebars/search.rs b/crates/mdbook-html/src/html_handlebars/search.rs index 0c067905..b14c9c67 100644 --- a/crates/mdbook-html/src/html_handlebars/search.rs +++ b/crates/mdbook-html/src/html_handlebars/search.rs @@ -200,6 +200,13 @@ fn render_item( // blocks, and worse case you have some noise in the index. body.push_str(&clean_html(&html)); } + Event::InlineMath(text) | Event::DisplayMath(text) => { + if in_heading { + heading.push_str(&text); + } else { + body.push_str(&text); + } + } Event::Start(_) | Event::End(_) | Event::Rule | Event::SoftBreak | Event::HardBreak => { // Insert spaces where HTML output would usually separate text // to ensure words don't get merged together diff --git a/examples/remove-emphasis/mdbook-remove-emphasis/Cargo.toml b/examples/remove-emphasis/mdbook-remove-emphasis/Cargo.toml index 1b55e291..8b2edd03 100644 --- a/examples/remove-emphasis/mdbook-remove-emphasis/Cargo.toml +++ b/examples/remove-emphasis/mdbook-remove-emphasis/Cargo.toml @@ -5,9 +5,9 @@ edition.workspace = true [dependencies] mdbook-preprocessor.workspace = true -pulldown-cmark = { version = "0.12.2", default-features = false } -pulldown-cmark-to-cmark = "18.0.0" -serde_json = "1.0.132" +pulldown-cmark = { workspace = true, default-features = false } +pulldown-cmark-to-cmark = "21.0.0" +serde_json.workspace = true [[bin]] name = "mdbook-remove-emphasis"