Skip to content

Commit

Permalink
Rollup merge of #120443 - GuillaumeGomez:footnote-def-improvement, r=…
Browse files Browse the repository at this point in the history
…fmease

Fixes footnote handling in rustdoc

Fixes #100638.

You can now declare footnotes like this:

```rust
//! Reference to footnotes A[^1], B[^2] and C[^3].
//!
//! [^1]: Footnote A.
//! [^2]: Footnote B.
//! [^3]: Footnote C.
```

r? ``@notriddle``
  • Loading branch information
fmease authored Jan 29, 2024
2 parents 8b22789 + dad6802 commit 83b3958
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3004,11 +3004,11 @@ dependencies = [

[[package]]
name = "pulldown-cmark"
version = "0.9.3"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
checksum = "80eb9f69aec5cd8828765a75f739383fbbe3e8b9d84370bde1cc90487700794a"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.4.1",
"memchr",
"unicase",
]
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 @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
# tidy-alphabetical-start
bitflags = "2.4.1"
pulldown-cmark = { version = "0.9.3", default-features = false }
pulldown-cmark = { version = "0.9.5", default-features = false }
rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
Expand Down
15 changes: 15 additions & 0 deletions tests/rustdoc/footnote-definition-without-blank-line-100638.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![crate_name = "foo"]

//! Reference to footnotes A[^1], B[^2] and C[^3].
//!
//! [^1]: Footnote A.
//! [^2]: Footnote B.
//! [^3]: Footnote C.
// @has 'foo/index.html'
// @has - '//*[@class="docblock"]/*[@class="footnotes"]/ol/li[@id="fn1"]/p' 'Footnote A'
// @has - '//li[@id="fn1"]/p/a/@href' '#fnref1'
// @has - '//*[@class="docblock"]/*[@class="footnotes"]/ol/li[@id="fn2"]/p' 'Footnote B'
// @has - '//li[@id="fn2"]/p/a/@href' '#fnref2'
// @has - '//*[@class="docblock"]/*[@class="footnotes"]/ol/li[@id="fn3"]/p' 'Footnote C'
// @has - '//li[@id="fn3"]/p/a/@href' '#fnref3'

0 comments on commit 83b3958

Please sign in to comment.