Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Upgrade `pulldown_cmark` to v0.12 (#17418)

Marshall Bowersb54d1aa95e1f
diff --git a/Cargo.lock b/Cargo.lock
index 316662e3937..7b1754966df 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 33f83430071..be5cb3f4374 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 84fbd776d90..4afceed8f1c 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 31306edc28f..09812aa67ac 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<usize>, 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<pulldown_cmark::Tag<'_>> 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<pulldown_cmark::Tag<'_>> 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 fcbf7c1e96b..e24ac552c16 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;