From b54d1aa95e1f37893cf13b4a827023cf5b0d44e6 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 5 Sep 2024 10:46:51 -0400 Subject: [PATCH] Upgrade `pulldown_cmark` to v0.12 (#17418) This PR upgrades `pulldown_cmark` to v0.12. There were a few breaking changes that needed to be accounted for: - The `BlockQuote` variant now has a `kind` attached. Right now we're ignoring it. - `pulldown_cmark` now emits tags for definition lists. This codepath has been left unimplemented, for now. ### Release Notes
raphlinus/pulldown-cmark (pulldown-cmark) ### [`v0.12.1`](https://redirect.github.com/pulldown-cmark/pulldown-cmark/releases/tag/v0.12.1): 0.12.1 [Compare Source](https://redirect.github.com/raphlinus/pulldown-cmark/compare/v0.12.0...v0.12.1) ##### Security - Fix O(n\*\*2) comment parser by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/941](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/941) ##### New features - impl From for String by [@​oconnor663](https://redirect.github.com/oconnor663) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/943](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/943) ##### Developers - Make dos-fuzzer part of the workspace by [@​kdarkhan](https://redirect.github.com/kdarkhan) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/945](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/945) ##### New Contributors - [@​oconnor663](https://redirect.github.com/oconnor663) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/943](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/943) - [@​kdarkhan](https://redirect.github.com/kdarkhan) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/945](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/945) **Full Changelog**: https://github.com/pulldown-cmark/pulldown-cmark/compare/v0.12.0...v0.12.1 ### [`v0.12.0`](https://redirect.github.com/pulldown-cmark/pulldown-cmark/releases/tag/v0.12.0): 0.12.0 [Compare Source](https://redirect.github.com/raphlinus/pulldown-cmark/compare/v0.11.3...v0.12.0) Thanks to all contributors! This release mainly adds the long awaited commonmark-hs description lists (under a flag) and enables the blockquote kind in `TagEnd` reverted in 0.11.2. #### Breaking changes - feat: re-add kind for BlockQuote in TagEnd by [@​Martin1887](https://redirect.github.com/Martin1887) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/940](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/940) - Refactor TextMergeStream by [@​ollpu](https://redirect.github.com/ollpu) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/931](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/931) #### New features - Implement commonmark-hs compatible definition lists by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/915](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/915) #### Other changes - Rename superlinear time fuzzer to `dos-fuzzer` by [@​ollpu](https://redirect.github.com/ollpu) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/938](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/938) **Full Changelog**: https://github.com/pulldown-cmark/pulldown-cmark/compare/v0.11.2...v0.12.0 ### [`v0.11.3`](https://redirect.github.com/pulldown-cmark/pulldown-cmark/releases/tag/v0.11.3): 0.11.3 [Compare Source](https://redirect.github.com/raphlinus/pulldown-cmark/compare/v0.11.2...v0.11.3) #### Security - Fix O(n\*\*2) comment parser by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/944](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/944) **Full Changelog**: https://github.com/pulldown-cmark/pulldown-cmark/compare/v0.11.2...v0.11.3 ### [`v0.11.2`](https://redirect.github.com/pulldown-cmark/pulldown-cmark/releases/tag/v0.11.2) [Compare Source](https://redirect.github.com/raphlinus/pulldown-cmark/compare/v0.11.1...v0.11.2) Revert BlockQuote kind to avoid breaking change. ### [`v0.11.1`](https://redirect.github.com/pulldown-cmark/pulldown-cmark/releases/tag/v0.11.1) [Compare Source](https://redirect.github.com/raphlinus/pulldown-cmark/compare/v0.11.0...v0.11.1) Thanks to all people involved in this release! The main change of this release is the reduction of the MSRV to 1.71.1, but it also includes a lot of bug fixes and a new mdBook for user-friendly documentation. #### Breaking changes - Add BlockQuoteKind to BlockQuote TagEnd by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/926](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/926) (reverted in v0.11.2) #### What's Changed - fix: CowStr deserialization when escaping by [@​aatifsyed](https://redirect.github.com/aatifsyed) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/895](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/895) - fix(test): fix generating spec tests doesn't work on Windows due to line-endings by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/903](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/903) - feat: add `-G` CLI option to enable GFM support by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/905](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/905) - feat: set `DefaultBrokenLinkCallback` as the default broken link callback of `OffsetIter` by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/901](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/901) - chore(doc): use `cargo add` to instruct how to install this crate as dependency by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/904](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/904) - fix typo by [@​jmbhughes](https://redirect.github.com/jmbhughes) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/909](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/909) - Fix parsing blocks inside alert body by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/908](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/908) - fuzz: fix building fuzzer and improve fuzzing coverage by enabling more parse options by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/910](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/910) - fix: fix warnings reported from nightly rustc by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/911](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/911) - fix: fix infinite loop when metadata delimiter is indented by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/913](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/913) - Raise the link cutoff from 5 to 32 by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/917](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/917) - Reduce MSRV to 1.71.1 by separating benchmarks into a new crate with CI enhancements by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/916](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/916) - Add guide book and deploy script for it by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/883](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/883) - ci: fix deploying the document to GitHub Pages and make the deploy job faster by [@​rhysd](https://redirect.github.com/rhysd) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/920](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/920) - Fix lone task list item bug by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/924](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/924) - Fix offset range around footnotes that look like images by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/925](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/925) - Update old footnote format to interrupt paragraph by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/928](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/928) - Fix confusing bug with back-to-back footnotes by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/930](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/930) - Add reproduction cases for [#​927](https://redirect.github.com/raphlinus/pulldown-cmark/issues/927) by [@​zoni](https://redirect.github.com/zoni) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/929](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/929) - Add regression test for [#​655](https://redirect.github.com/raphlinus/pulldown-cmark/issues/655) by [@​ollpu](https://redirect.github.com/ollpu) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/932](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/932) - Renovate the superlinear time fuzzer by [@​ollpu](https://redirect.github.com/ollpu) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/935](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/935) #### New Contributors - [@​aatifsyed](https://redirect.github.com/aatifsyed) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/895](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/895) - [@​jmbhughes](https://redirect.github.com/jmbhughes) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/909](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/909) - [@​zoni](https://redirect.github.com/zoni) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/929](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/929) **Full Changelog**: https://github.com/pulldown-cmark/pulldown-cmark/compare/v0.11.0...v0.11.1 ### [`v0.11.0`](https://redirect.github.com/pulldown-cmark/pulldown-cmark/releases/tag/v0.11.0): 0.11.0 [Compare Source](https://redirect.github.com/raphlinus/pulldown-cmark/compare/v0.10.3...v0.11.0) ##### Finally, the so long awaited math mode is here! Enable the option to use it. This release also includes other improvements and bugfixes, please see the changelog below for more details. Thanks to all contributors that has made possible this release! #### Breaking changes - Change `write_to_html` to allow `fmt::Write` by [@​stepantubanov](https://redirect.github.com/stepantubanov) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/870](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/870) #### New features - Math mode #### Bugfixes - \[0.11] Don't exit `scan_attribute` with the ix pointing at block quote by [@​notriddle](https://redirect.github.com/notriddle) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/873](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/873) - (Re)introduce simd feature to pulldown-cmark-escape by [@​ollpu](https://redirect.github.com/ollpu) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/880](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/880) - fix: remove unnecessary end_newline set by [@​tomcur](https://redirect.github.com/tomcur) in [https://github.com/pulldown-cmark/pulldown-cmark/pull/885](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/885) #### New Contributors - [@​duskmoon314](https://redirect.github.com/duskmoon314) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/874](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/874) - [@​stepantubanov](https://redirect.github.com/stepantubanov) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/870](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/870) - [@​tomcur](https://redirect.github.com/tomcur) made their first contribution in [https://github.com/pulldown-cmark/pulldown-cmark/pull/885](https://redirect.github.com/pulldown-cmark/pulldown-cmark/pull/885) **Full Changelog**: https://github.com/pulldown-cmark/pulldown-cmark/compare/v0.10.3...v0.11.0
Release Notes: - N/A --- Cargo.lock | 21 ++++++++++++++----- Cargo.toml | 2 +- crates/markdown/src/markdown.rs | 2 +- crates/markdown/src/parser.rs | 8 ++++++- .../markdown_preview/src/markdown_parser.rs | 6 +++--- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 316662e39370d011b25a91e07441981490196ae9..7b1754966df307452cc9b4cf5f4e0b29d61b4545 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6137,7 +6137,7 @@ dependencies = [ "lsp", "parking_lot", "postage", - "pulldown-cmark", + "pulldown-cmark 0.12.1", "rand 0.8.5", "regex", "rpc", @@ -6657,7 +6657,7 @@ dependencies = [ "linkify", "log", "node_runtime", - "pulldown-cmark", + "pulldown-cmark 0.12.1", "settings", "theme", "ui", @@ -6677,7 +6677,7 @@ dependencies = [ "linkify", "log", "pretty_assertions", - "pulldown-cmark", + "pulldown-cmark 0.12.1", "theme", "ui", "workspace", @@ -6772,7 +6772,7 @@ dependencies = [ "once_cell", "opener", "pathdiff", - "pulldown-cmark", + "pulldown-cmark 0.10.3", "regex", "serde", "serde_json", @@ -8607,6 +8607,17 @@ dependencies = [ "unicase", ] +[[package]] +name = "pulldown-cmark" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "666f0f59e259aea2d72e6012290c09877a780935cc3c18b1ceded41f3890d59c" +dependencies = [ + "bitflags 2.6.0", + "memchr", + "unicase", +] + [[package]] name = "pulldown-cmark-escape" version = "0.10.1" @@ -9185,7 +9196,7 @@ dependencies = [ "gpui", "language", "linkify", - "pulldown-cmark", + "pulldown-cmark 0.12.1", "theme", "ui", "util", diff --git a/Cargo.toml b/Cargo.toml index 33f834300716338602bb9f2b0bd52db636f2c0ef..be5cb3f43741f0a46850cbb3d6fe16625da85982 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -380,7 +380,7 @@ pretty_assertions = "1.3.0" prost = "0.9" prost-build = "0.9" prost-types = "0.9" -pulldown-cmark = { version = "0.10.0", default-features = false } +pulldown-cmark = { version = "0.12.0", default-features = false } rand = "0.8.5" regex = "1.5" repair_json = "0.1.0" diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs index 84fbd776d90e0bdaa9a289849040d9bae1b47b5a..4afceed8f1c4eae033d1ef17472a4738355a74b7 100644 --- a/crates/markdown/src/markdown.rs +++ b/crates/markdown/src/markdown.rs @@ -663,7 +663,7 @@ impl Element for MarkdownElement { builder.pop_div(); builder.pop_text_style() } - MarkdownTagEnd::BlockQuote => { + MarkdownTagEnd::BlockQuote(_kind) => { builder.pop_text_style(); builder.pop_div() } diff --git a/crates/markdown/src/parser.rs b/crates/markdown/src/parser.rs index 31306edc28f8c1307f80308eae9330afc5b4cb3a..09812aa67ac22417f7582ee5efc0b56af718f642 100644 --- a/crates/markdown/src/parser.rs +++ b/crates/markdown/src/parser.rs @@ -83,6 +83,7 @@ pub fn parse_markdown(text: &str) -> Vec<(Range, MarkdownEvent)> { pulldown_cmark::Event::TaskListMarker(checked) => { events.push((range, MarkdownEvent::TaskListMarker(checked))) } + pulldown_cmark::Event::InlineMath(_) | pulldown_cmark::Event::DisplayMath(_) => {} } } events @@ -271,7 +272,7 @@ impl From> for MarkdownTag { attrs, } } - pulldown_cmark::Tag::BlockQuote => MarkdownTag::BlockQuote, + pulldown_cmark::Tag::BlockQuote(_kind) => MarkdownTag::BlockQuote, pulldown_cmark::Tag::CodeBlock(kind) => match kind { pulldown_cmark::CodeBlockKind::Indented => { MarkdownTag::CodeBlock(CodeBlockKind::Indented) @@ -316,6 +317,11 @@ impl From> for MarkdownTag { }, pulldown_cmark::Tag::HtmlBlock => MarkdownTag::HtmlBlock, pulldown_cmark::Tag::MetadataBlock(kind) => MarkdownTag::MetadataBlock(kind), + pulldown_cmark::Tag::DefinitionList + | pulldown_cmark::Tag::DefinitionListTitle + | pulldown_cmark::Tag::DefinitionListDefinition => { + unimplemented!("definition lists are not yet supported") + } } } } diff --git a/crates/markdown_preview/src/markdown_parser.rs b/crates/markdown_preview/src/markdown_parser.rs index fcbf7c1e96bd075965e31c41cb0e63bbb42ebba6..e24ac552c16a491aef6c98a9668f2ae44e817f4f 100644 --- a/crates/markdown_preview/src/markdown_parser.rs +++ b/crates/markdown_preview/src/markdown_parser.rs @@ -139,7 +139,7 @@ impl<'a> MarkdownParser<'a> { let list = self.parse_list(order).await; Some(list) } - Tag::BlockQuote => { + Tag::BlockQuote(_kind) => { self.cursor += 1; let block_quote = self.parse_block_quote().await; Some(vec![ParsedMarkdownElement::BlockQuote(block_quote)]) @@ -654,10 +654,10 @@ impl<'a> MarkdownParser<'a> { // Record that we're in a nested block quote and continue parsing. // We don't need to advance the cursor since the next // call to `parse_block` will handle it. - Event::Start(Tag::BlockQuote) => { + Event::Start(Tag::BlockQuote(_kind)) => { nested_depth += 1; } - Event::End(TagEnd::BlockQuote) => { + Event::End(TagEnd::BlockQuote(_kind)) => { nested_depth -= 1; if nested_depth == 0 { self.cursor += 1;