Skip to content

Commit d54d9b1

Browse files
committed
rustdoc: Fix generation of impl links. Closes #1953
1 parent 57af1e9 commit d54d9b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: src/rustdoc/markdown_index_pass.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ fn pandoc_header_id(header: str) -> str {
8686
fn remove_punctuation(s: str) -> str {
8787
let s = str::replace(s, "<", "");
8888
let s = str::replace(s, ">", "");
89+
let s = str::replace(s, "[", "");
90+
let s = str::replace(s, "]", "");
91+
let s = str::replace(s, "(", "");
92+
let s = str::replace(s, ")", "");
93+
let s = str::replace(s, "@", "");
94+
let s = str::replace(s, "~", "");
8995
ret s;
9096
}
9197
fn replace_with_hyphens(s: str) -> str {
@@ -97,8 +103,9 @@ fn pandoc_header_id(header: str) -> str {
97103
}
98104

99105
#[test]
100-
fn should_remove_brackets_from_headers() {
106+
fn should_remove_punctuation_from_headers() {
101107
assert pandoc_header_id("impl foo of bar<A>") == "impl-foo-of-bara";
108+
assert pandoc_header_id("fn@([~A])") == "fna";
102109
}
103110

104111
#[test]

0 commit comments

Comments
 (0)