-
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 source links look cleaner #92602
Conversation
Some changes occurred in HTML/CSS/JS. |
This comment has been minimized.
This comment has been minimized.
Looks good! I don't see the "stable since" change though? Also, the color of "source" looks a little too pale in the light theme. |
My original version added the "stable since" language but on reviewing the Zulip thread I saw there wasn't really consensus on that, and it's not the main point of the PR, so I reverted it (but forgot to update the PR description). I've now updated the PR description.
I'll bump it up a little. |
This comment has been minimized.
This comment has been minimized.
That looks better, although I think the links should be still deeper in color. The current color in some ways feels more distracting than if it were darker because it's on the edge of being less visible vs more visible. It just doesn't look right to me for whatever reason. |
Just pushed a version where they get normal opacity like any other link. Lemme know what you think (remember to hard-reload if needed). |
That looks better, thanks. |
Apart from my comment, looks good to me. |
So looks good to me. I see some 👎 signs on the first comment. @euclio @falaosu: What don't you like with this approach? |
My original objection was that the new text isn't visually distinct enough, though after reading the linked issue I see that there's a justification for this. That said, I don't think that this does a good enough job of communicating that these are clickable actions. The brackets in the current style do a good job of making it clear that these are buttons, and "-" communicates the same amount of information as "collapse" in fewer characters. For such commonly-used actions that are repeated across the page, we can use symbols to communicate these actions effectively, and that reduces overall clutter. "source" is maybe fine as a link visually, since it actually takes you to a separate page (though there's no underline on hover). I don't think collapse should just be a link, though, since it only performs an action on the current page. Assuming that we want to change the other "[-]"s on the page for consistency, I would expect a symbol like "▶︎" for each individual section, and "▼ collapse all" at the top. |
I'll add underline on hover.
I changed |
To be fair, this button at the top of the page is a bit on its own since its behaviour is different than the other collapse toggles. But at least I see your point. @jsha: Just realized that you didn't add a test for the text of the top collapse button (to check it's "expand"/"collapse" when it should). Could you add one as well please? And since you said you would add underline on hover, can you add a test for this as well please? |
Alright, I've pushed new code reverting the "collapse" text back to
Since this is reverted, no behavior here has changed. I'll look at adding a test for the
Will do. |
0679668
to
22ad738
Compare
FWIW, I liked the |
I liked it as well, maybe for another time... |
Thanks for the tests! Just one last question and it's good for me. :) |
8e55935
to
6b444ee
Compare
src/librustdoc/html/render/mod.rs
Outdated
@@ -315,8 +315,8 @@ impl AllTypes { | |||
<span class=\"out-of-band\">\ | |||
<span id=\"render-detail\">\ | |||
<a id=\"toggle-all-docs\" href=\"javascript:void(0)\" \ | |||
title=\"collapse all docs\">\ | |||
[<span class=\"inner\">−</span>]\ | |||
title=\"collapse all docs\">\ |
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.
Why these changes?
When I hover the source links, they don't get underlined. Could fix it and add a test for it too please? |
Change from syntaxy-looking [src] to the plain word "source".
The source link at the top of the page is part of the main-heading, where links get underline on hover. The source link to the right of the code headings is part of those headings, which don't get underline on hover. I think this PR is consistent with how we currently do things. If we want to add underline-on-hover everywhere, I'm in favor, but we shouldn't do it piecemeal. I pushed to remove the spurious diffs. Thanks for catching! |
It's fine as is then. I think it's worth discussing for a follow-up which links should be underlined or not but it's for later. r=me once CI pass and thanks! |
@bors r+ rollup |
📌 Commit 962c0a4 has been approved by |
@bors r=GuillaumeGomez |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 962c0a4 has been approved by |
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#92248 (Normalize struct tail type when checking Pointee trait) - rust-lang#92357 (Fix invalid removal of newlines from doc comments) - rust-lang#92602 (Make source links look cleaner) - rust-lang#92636 (Normalize generator-local types with unevaluated constants) - rust-lang#92693 (Release notes: add `Result::unwrap_{,err_}unchecked`) - rust-lang#92702 (Clean up lang_items::extract) - rust-lang#92717 (update miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Make "since" version numbers grey again (regressed in rust-lang#92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown.
Rustdoc style cleanups - Make "since" version numbers grey again (regressed in rust-lang#92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown Demo: https://rustdoc.crud.net/jsha/style-cleanups/std/string/struct.String.html r? `@GuillaumeGomez`
Change from syntaxy-looking [src] to the plain word "source".
Part of #59851
r? @GuillaumeGomez
Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html
Discussed on Zulip.