-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Highlight crate links like normal links #75842
Conversation
r? @ollie27 (rust_highfive has picked a reviewer for you, use r? to override) |
@rustbot modify labels: T-rustdoc |
I'm waiting on a rustc build to see if this works - for some reason it's rebuilding LLVM... :( |
85482a6
to
4419e04
Compare
Fixed formatting |
format!("<li><a href=\"{}index.html\">{}</li>", ensure_trailing_slash(s), s) | ||
format!( | ||
"<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>", | ||
ensure_trailing_slash(s), | ||
s | ||
) |
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.
Using class mod should probably be temporary (I should probably be a separate class crate). However, the ul that this is in (starting on line 1065) already has class mod!
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 added a missing closing </a>
tag also.
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.
In the other link class="mod"
was also added.
r? @jyn514 |
I think ollie might actually have been a better reviewer, I don't know this part of the code very well ... let's since he has so much free time ;) |
Looks good to me. Is there anything else to be done here?
😝 |
I think I should add a new CSS class |
Actually, since we want the styles to be the same, it might be better to not add a separate class since it might get out of date if the module styles are updated. |
I wasn't able to verify that the styling looks correct since I've been having some issues building the compiler (https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/ICE.20when.20compiling). |
One final thing which is somewhat unrelated is that the title, description, and heading for the index page are all different: rust/src/librustdoc/html/render/mod.rs Lines 1047 to 1057 in d02a209
It might be good to consolidate them, but that could be done in a separate PR. |
@@ -1066,7 +1066,11 @@ themePicker.onblur = handleThemeButtonsBlur; | |||
krates | |||
.iter() | |||
.map(|s| { | |||
format!("<li><a href=\"{}index.html\">{}</li>", ensure_trailing_slash(s), s) | |||
format!( | |||
"<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>", |
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.
"<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>", | |
"<li><a class='mod' href='{}index.html'>{}</a></li>", |
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're using double quotes everywhere else, so for consistency, I think we should keep them.
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 saw that we also use single quotes for quite a lot of place too. From what I see, maybe more than double quotes.
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.
179 single quotes and 230 double quotes (looking for ='
and =\"
). I wonder how we ended up in this mess... We should clean that up.
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 not just make all single quotes? We don't need to escape that way..
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.
Had some cases where I saw:
<div onclick='func('clicked');'>...</div>
So mostly irrelevant here but still afraid me. Even more considering that for now, the generated UI isn't tested.
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 could change that to
<div onclick="func('clicked');">...</div>
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.
Or to:
<div onclick='func("clicked");'>...</div>
😛
@GuillaumeGomez I think this PR is ready. Do you want to merge? @pickfire or someone else could do a follow-up PR to make the quote character consistent in this file if that's what's decided upon. |
Can you post a screenshot of what this now looks like? |
Yes, just a screenshot before/after and then I think we're good to go! |
Still waiting on my build :) The before is at https://doc.rust-lang.org/nightly/nightly-rustc: |
Wow, my build is taking forever. I just stopped and started it in case that’s the issue. |
Yes, that sounds right. Try running with |
I have several gigabytes of free memory though, so would that still help? |
@bors r+ |
📌 Commit 4419e04 has been approved by |
Never could get my build to finish :( |
☀️ Test successful - checks-actions, checks-azure |
@camelid In case you want to retry to build doc locally: |
@GuillaumeGomez Thanks, I'll try that! |
The build completed successfully, but that index page is not the crate index, so it is not affected by this PR. I think I have to document the compiler to get the right page. |
@camelid try |
@jyn514 I'm curious: is there a reason that is not the default? |
Not sure, sorry. You could ask on zulip. My guess though is that most of the compiler docs are maintained out of tree at rustc-dev-guide.rust-lang.org so people don't look at the API docs as much? I use the online ones a lot though. |
Use double quote for rustdoc html r? `@GuillaumeGomez` Feels scary without escaping stuff when I looked at the code, probably susceptible to XSS. Follow up of rust-lang#75842
Fixes #75823.
Cc @jyn514