-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Sidebar unification #84834
Sidebar unification #84834
Conversation
Some changes occurred in HTML/CSS/JS. |
da3097b
to
f809c87
Compare
This comment has been minimized.
This comment has been minimized.
568474d
to
14a5da9
Compare
// delayed sidebar rendering. | ||
window.initSidebarItems = function(items) { | ||
var sidebar = document.getElementsByClassName("sidebar-elems")[0]; | ||
var current = window.sidebarCurrent; | ||
var isModule = getNakedUrl().endsWith("/index.html"); | ||
|
||
function addSidebarCrates(crates) { |
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.
I moved this function here so it has access to the sidebar
variable from the scope instead of querying it like before.
block("keyword", "Keywords"); | ||
block("traitalias", "Trait Aliases"); | ||
if (sidebar) { | ||
if (!isModule) { |
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.
We don't want to render these info on a module (they are already on listed on its page).
@jyn514 This is now ready for review. I added a few comments on the changes to help you understand why I did the changes. |
14a5da9
to
97f4203
Compare
☔ The latest upstream changes (presumably #85022) made this pull request unmergeable. Please resolve the merge conflicts. |
I don't have time to review this. r? @jsha |
97f4203
to
c48a19a
Compare
And rebased too. :) |
c48a19a
to
6e72898
Compare
And of course I pushed the wrong branch once again... EDIT: fixed |
6e72898
to
c48a19a
Compare
Could you include a screenshot of before/after so I can get an idea of what has been changed or fixed? |
I fixed @Stupremee comment: now I simply check if the body has the So with this, I think it's good? r? @jsha |
☔ The latest upstream changes (presumably #85838) made this pull request unmergeable. Please resolve the merge conflicts. |
Linking in some related issues: #85759, #16328, #81031. The theme of these is that some people think the list of crates in the sidebar is much too long. For instance, I just did a quick check on The more I think about it the more I agree with what @Nemo157 said:
(BTW sorry if I gave the impression earlier that I fully support the approach here; I'm still thinking aloud about how I think this should work). We have a hierarchical structure of pages:
And the question is, at any given point in that structure, what navigation options should we offer in the sidebar? The minimalist view is "breadcrumb" style: from struct4, you have direct links to go to moduleC, moduleA, crate2, or the doc index page. If you want to get from struct4 to struct3, you need to go up to moduleA, then down to moduleB. We have breadcrumbs in place already at the top of the page: in A medium approach would be "siblings" style: from any given node in the hierarchy, you have links to go to all siblings. So struct4 has a link to struct5; moduleB has a link to moduleC; crate1 has a link to crate1. A maximal approach would be "siblings of all parents:" from any given node, you have links to all siblings, and also the siblings of all your parent nodes. Right now I think we have a bit of a mix. If you're at struct1, the sidebar will list func1 (a sibling) and moduleA (a sibling), but also crate1 (a parent's sibling). After writing all that, here's what I think would be consistent:
I would also say we have a general problem that the logic of the sidebar is not discoverable. For instance, https://docs.rs/rustls/0.19.1/rustls/struct.DangerousClientConfig.html. The first part of the sidebar is "things that exist on this page." Then it says |
Here's a small prototype of what I think should happen for the crates listing. It uses a regex to determine "on a crate page;" a real version would do better. https://github.com/rust-lang/rust/compare/master...jsha:crates-have-neighbors?expand=1 Demo of generated docs for hyper: https://hoffman-andrews.com/rust/crates-have-neighbors-hyper/hyper/index.html Demo of generated docs for library/std: |
I'm a bit sad about the crates being only listed at the top level but if I'm the only one finding it illogical and a bit annoying to go to the crate level to have access to it, then so be it.
This is a good idea!
I'll instead add a new |
* Fix bug in module sidebar: the list of items was from the parent module
…s in rustdoc-gui tool
7149cb5
to
45d9a20
Compare
So I did the following:
|
45d9a20
to
9b637fa
Compare
// This option shows what puppeteer "code" is run | ||
// "--debug", | ||
// This option disable the headless mode, allowing you to see what's going on. | ||
// "--no-headless", | ||
// The text isn't rendered by default because of a lot of small differences | ||
// between hosts. | ||
// "--show-text", |
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.
Is this intended to be here but commented out?
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.
Absolutely. Both options are very useful when adding/debugging a test. I have added and removed them a few times already so this time I decided to leave them commented with some doc.
@bors r+ Looks good! 🎉 |
📌 Commit 9b637fa has been approved by |
☀️ Test successful - checks-actions |
This PR does a few things:
The other changes (on bootstrap mostly) were to allow to generate multiple crates in a same folder so that we can ensure that clicking on the crates in the sidebar works as expected.
I added a rustdoc-gui test to ensure everything is where it should be.
r? @jyn514