-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make h2 headings hyperlinks #92057
Make h2 headings hyperlinks #92057
Conversation
Some changes occurred in HTML/CSS/JS. |
r? @CraftSpider (rust-highfive has picked a reviewer for you, use r? to override) |
src/librustdoc/html/render/mod.rs
Outdated
@@ -1068,8 +1068,9 @@ fn render_assoc_items_inner( | |||
write!( | |||
tmp_buf, | |||
"<h2 id=\"{id}\" class=\"small-section-header\">\ | |||
<a href=\"#{id}\">\ | |||
<span>Methods from {trait_}<Target = {type_}></span>\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trait_
is a link, so that won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for type_
btw.
Updated so the |
@@ -1129,6 +1129,7 @@ a.test-arrow:hover{ | |||
text-decoration: none; | |||
} | |||
|
|||
.small-section-header:hover a:before, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of this change, the anchor on Methods from Deref<Target = str>
targets str
, is blue and overlaps the text too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
k, I think I've got it with this latest revision. Pushed and update to the demo. |
@@ -23,7 +23,7 @@ assert-css: (".in-band a", {"color": "rgb(0, 0, 0)"}) | |||
|
|||
// We move the cursor over the "Implementations" title so the anchor is displayed. | |||
move-cursor-to: "h2#implementations" | |||
assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"}) | |||
assert-css: ("h2#implementations", {"color": "rgb(0, 0, 0)"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supposed to check that the anchor is displayed, which isn't tested here.
☔ The latest upstream changes (presumably #92609) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm going to set this aside for a while. The amount of work required to make everything work right is not worth the benefit. |
Fixes #90245.
Demo:
https://rustdoc.crud.net/jsha/linked-headers/std/string/struct.String.html