Skip to content

fix broken theme CSS links in the website #14379

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
Mar 9, 2025

Conversation

lapla-cogito
Copy link
Contributor

@lapla-cogito lapla-cogito commented Mar 9, 2025

Currently, some parts of the website's CSS are not being applied. This seems to be due to a broken link to the originally referenced CSS. I suspect rust-lang/mdBook#1368.

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 9, 2025
@BenoitZugmeyer
Copy link
Contributor

BenoitZugmeyer commented Mar 9, 2025

👋 Hi there, I just bumped into this issue and I was planning on submitting a PR. Using raw.githubusercontent.com won't work because files are served with Content-Type: text/plain and the browser will refuse to apply the style.

A potential solution could be to use jsdelivr.net like so:

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rust-lang/[email protected]/src/theme/css/variables.css"/> {# #}
    <link id="styleHighlight" rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rust-lang/[email protected]/src/theme/highlight.css"> {# #}
    <link id="styleNight" rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rust-lang/[email protected]/src/theme/tomorrow-night.css" disabled="true"> {# #}
    <link id="styleAyu" rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rust-lang/[email protected]/src/theme/ayu-highlight.css" disabled="true"> {# #}

The version could be omitted to resolve to the latest one, although I would discourage it as things might break in the future.

See jsdelivr docs.

@lapla-cogito
Copy link
Contributor Author

@BenoitZugmeyer Thanks for your comment! It looks like I assumed that type="text/css" was already present in each tag. So, as a fix, I considered adding the type attribute or loading these stylesheets via a CDN, as you mentioned. Since the latter option makes more sense, I went with that. Thanks again!

Copy link
Member

@Alexendoo Alexendoo left a comment

Choose a reason for hiding this comment

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

Thanks! Having them be versioned is great

@Alexendoo Alexendoo added this pull request to the merge queue Mar 9, 2025
Merged via the queue into rust-lang:master with commit 7bae269 Mar 9, 2025
10 checks passed
@eric-seppanen
Copy link

I suspect this caused css to be broken for all versions of the lints except master.
See #14494.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants