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

rustdoc: --extend-css option refers to ../static.files/theme.css but puts css in ../theme.css #110002

Closed
monkeydom opened this issue Apr 6, 2023 · 0 comments · Fixed by #110235
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@monkeydom
Copy link

When adding an --extend-css file, it seems that the file gets copied to the wrong location or that it is referenced incorrectly.

Steps:

> cargo new --lib ecss
     Created library `ecss` package
> cd ecss
> cat >custom.css <<<"body {background: red;}"
> RUSTDOCFLAGS="--extend-css $PWD/custom.css" cargo doc --open

Expected Results:

Red background in docs

Actual Results:

No red background

Notes:

Moving the theme.css to static.files/theme.css fixes the issue

> cp target/doc/theme.css target/doc/static.files/

Just for reference, this is the cmd line cargo generates:

rustdoc --edition=2021 --crate-type lib --crate-name ecss src/lib.rs -o /Users/dom/Data/Playground/rust/ecss/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=115 -C metadata=b5a7f46f1030585c -L dependency=/Users/dom/Data/Playground/rust/ecss/target/debug/deps --extend-css /Users/dom/Data/Playground/rust/ecss/custom.css --crate-version 0.1.0

and the header line in the index.html

<link rel="stylesheet" href="../static.files/theme.css">

Context & Version

> rustdoc --version
rustdoc 1.68.2 (9eb3afe9e 2023-03-27)

> sw_vers
ProductName:		macOS
ProductVersion:		13.3
BuildVersion:		22E252
@monkeydom monkeydom added the C-bug Category: This is a bug. label Apr 6, 2023
@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 9, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 12, 2023
…otriddle

Fix `--extend-css` option

Fixes rust-lang#110002.

The file was generated in the wrong folder so I moved it into `static.files` as it made more sense to have there instead of changing the path in the templates.

I also added a GUI test to ensure that this option won't break unexpectedly again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants