Skip to content

Fix rustdoc styles for very old docs #1059

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

Merged
merged 1 commit into from
Sep 20, 2020
Merged

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Sep 19, 2020

Previously this used the selector link[type='text/css'][href*='normalize'] to inject the vendored HTML.
Unfortunately, this selector did not exist in very old versions of rustdoc.
Instead, this now adds the vendored.css stylesheet at the start of the <head> tag.

Closes #1005
r? @cynecx

@jyn514 jyn514 added A-frontend Area: Web frontend S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Sep 19, 2020
@jyn514 jyn514 force-pushed the old-docs branch 2 times, most recently from 829770a to 689bfbc Compare September 19, 2020 06:31
@jyn514
Copy link
Member Author

jyn514 commented Sep 19, 2020

Ugh, this brings back the issues in #992.

@jyn514
Copy link
Member Author

jyn514 commented Sep 19, 2020

Ok, I think the latest fix might have done it.
image

@jyn514 jyn514 force-pushed the old-docs branch 2 times, most recently from aef68ff to 5987e4f Compare September 19, 2020 06:36
@cynecx
Copy link
Contributor

cynecx commented Sep 19, 2020

I am not quite sure about order of elements inside the head element, in terms of semantic differences (I'd rather not put css before the viewport/charset meta tags).

An alternative fix would be to change the selector to link[type='text/css'][href*='rustdoc'], that would put the vendored css after normalize.css (or before rustdoc.css, thus supporting older docs too). That would work too because the vendored css does also contain a version of normalize.css.

@jyn514 Thoughts?

@jyn514
Copy link
Member Author

jyn514 commented Sep 19, 2020

This page does not have a rustdoc.css: https://docs.rs/syntex_syntax/0.54.0/syntex_syntax/ast/enum.MetaItemKind.html

@jyn514
Copy link
Member Author

jyn514 commented Sep 19, 2020

Oh whoops, it does have rustdoc-20161205-1.15.0-nightly-daf8c1dfc.css though. Yeah, that seems like a better approach.

Previously this used the selector link[type='text/css'][href*='normalize'] to inject the vendored HTML.
Unfortunately, this selector did not exist in very old versions of rustdoc.
Instead, this now adds the vendored.css stylesheet just before
rustdoc.css.
@cynecx
Copy link
Contributor

cynecx commented Sep 19, 2020

LGTM!

@jyn514 jyn514 merged commit 1fb61ec into rust-lang:master Sep 20, 2020
@jyn514 jyn514 added S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Sep 20, 2020
@jyn514 jyn514 removed the S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it label Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Web frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Styles are broken on old rustdoc pages
2 participants