Skip to content
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

Set color for <a> in a more straightforward way. #91102

Merged
merged 2 commits into from
Nov 23, 2021

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Nov 21, 2021

Previously, we set the default color for tags to black, and then had an override with a bunch of not() clauses to set anchors in
docblocks to blue.

Instead, we should set the default color for to blue (or equivalent in other themes), and override it for places like the sidebar or search results, where we don't want them to be styled as links.

Demo at https://rustdoc.crud.net/jsha/theme-anchor/std/string/struct.String.html. This should result in no visible changes.

r? @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 21, 2021
@jsha jsha added A-rustdoc-ui Area: rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 21, 2021
@GuillaumeGomez
Copy link
Member

It changes a few things:

Screenshot from 2021-11-21 15-26-53
Screenshot from 2021-11-21 15-28-17

Can you also provide a doc with usage of the "jump to def" feature? I think it'll change their color as well.

And finally: please add GUI tests for the two cases above and for links more generally. ;)

This makes it easier to find the test that needs fixing.
@jsha
Copy link
Contributor Author

jsha commented Nov 22, 2021

Here's a doc with the jump to def feature: https://rustdoc.crud.net/jsha/theme-anchor-rustls/src/rustls/cipher.rs.html#8-12. You were right, the links in the source view had the wrong color. I fixed that.

I also made a small tweak to the rustdoc-gui tester, so it would print full filenames on error. That's something I've run into trouble with before; it's not always clear what needs fixing, particularly when I was new on the project.

@rust-log-analyzer

This comment has been minimized.

@@ -0,0 +1,12 @@
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better enforce the theme used (I had some issues because my default theme isn't the light one). To do it, take a look here.

@GuillaumeGomez
Copy link
Member

I also made a small tweak to the rustdoc-gui tester, so it would print full filenames on error. That's something I've run into trouble with before; it's not always clear what needs fixing, particularly when I was new on the project.

Then it's a good idea, thanks!

Previously, we set the default color for <a> tags to black, and then
had an override with a bunch of not() clauses to set anchors in
docblocks to blue.

Instead, we should set the default color for <a> to blue (or equivalent
in other themes), and override it for places like the sidebar or search
results, where we don't want them to be styled as links.
@GuillaumeGomez
Copy link
Member

Thanks! r=me once CI pass.

@jsha
Copy link
Contributor Author

jsha commented Nov 22, 2021

@bors r=GuillaumeGomez rollup

@bors
Copy link
Contributor

bors commented Nov 22, 2021

📌 Commit a56559d has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 22, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 23, 2021
…askrgr

Rollup of 3 pull requests

Successful merges:

 - rust-lang#91102 (Set color for <a> in a more straightforward way.)
 - rust-lang#91143 (Update books)
 - rust-lang#91144 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cb77767 into rust-lang:master Nov 23, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 23, 2021
@jsha jsha deleted the theme-anchor branch November 28, 2021 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants