Skip to content

Commit

Permalink
Rollup merge of rust-lang#111152 - lukas-code:markdown-parsers-are-ha…
Browse files Browse the repository at this point in the history
…rd, r=GuillaumeGomez

update `pulldown-cmark` to `0.9.3`

This PR updates `pulldown-cmark` to version `0.9.3`, which does two main things:
* Pulls in pulldown-cmark/pulldown-cmark#643 to fix rust-lang#111117
* Allows parsing strikethrough with single tildes, e.g. `~foo~` -> ~foo~. This matches the [GFM spec](https://github.github.com/gfm/#strikethrough-extension-).

Full changelog: pulldown-cmark/pulldown-cmark#646
  • Loading branch information
matthiaskrgr authored May 25, 2023
2 parents cade266 + c2a446a commit b35b134
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2779,9 +2779,9 @@ dependencies = [

[[package]]
name = "pulldown-cmark"
version = "0.9.2"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
dependencies = [
"bitflags",
"memchr",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
bitflags = "1.2.1"
pulldown-cmark = { version = "0.9.2", default-features = false }
pulldown-cmark = { version = "0.9.3", default-features = false }
rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
Expand Down
6 changes: 3 additions & 3 deletions src/doc/rustdoc/src/how-to-write-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ extensions:
### Strikethrough

Text may be rendered with a horizontal line through the center by wrapping the
text with two tilde characters on each side:
text with one or two tilde characters on each side:

```text
An example of ~~strikethrough text~~.
An example of ~~strikethrough text~~. You can also use ~single tildes~.
```

This example will render as:

> An example of ~~strikethrough text~~.
> An example of ~~strikethrough text~~. You can also use ~single tildes~.
This follows the [GitHub Strikethrough extension][strikethrough].

Expand Down
12 changes: 12 additions & 0 deletions tests/rustdoc-ui/unescaped_backticks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,15 @@ id! {
/// level changes.
pub mod tracing_macro {}
}

/// Regression test for <https://github.com/rust-lang/rust/issues/111117>
pub mod trillium_server_common {
/// One-indexed, because the first CloneCounter is included. If you don't
/// want the original to count, construct a [``CloneCounterObserver`]
/// instead and use [`CloneCounterObserver::counter`] to increment.
//~^ ERROR unescaped backtick
pub struct CloneCounter;

/// This is used by the above.
pub struct CloneCounterObserver;
}
14 changes: 13 additions & 1 deletion tests/rustdoc-ui/unescaped_backticks.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,18 @@ LL | | /// level changes.
change: [`rebuild_interest_cache`][rebuild] is called after the value of the max
to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max

error: unescaped backtick
--> $DIR/unescaped_backticks.rs:348:56
|
LL | /// instead and use [`CloneCounterObserver::counter`] to increment.
| ^
|
= help: the opening or closing backtick of an inline code may be missing
help: if you meant to use a literal backtick, escape it
|
LL | /// instead and use [`CloneCounterObserver::counter\`] to increment.
| +

error: unescaped backtick
--> $DIR/unescaped_backticks.rs:11:5
|
Expand Down Expand Up @@ -955,5 +967,5 @@ help: if you meant to use a literal backtick, escape it
LL | /// | table`( | )\`body |
| +

error: aborting due to 63 previous errors
error: aborting due to 64 previous errors

6 changes: 0 additions & 6 deletions tests/rustdoc/strikethrough-in-summary.rs

This file was deleted.

13 changes: 10 additions & 3 deletions tests/rustdoc/test-strikethrough.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#![crate_name = "foo"]

// @has foo/fn.f.html
// @has - //del "Y"
/// ~~Y~~
// Test that strikethrough works with single and double tildes and that it shows up on
// the item's dedicated page as well as the parent module's summary of items.

// @has foo/index.html //del 'strike'
// @has foo/index.html //del 'through'

// @has foo/fn.f.html //del 'strike'
// @has foo/fn.f.html //del 'through'

/// ~~strike~~ ~through~
pub fn f() {}

0 comments on commit b35b134

Please sign in to comment.