Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Support the rustdoc theme system #24

Closed
Cldfire opened this issue Jan 3, 2019 · 5 comments
Closed

Support the rustdoc theme system #24

Cldfire opened this issue Jan 3, 2019 · 5 comments

Comments

@Cldfire
Copy link
Owner

Cldfire commented Jan 3, 2019

As pointed out in #23, rustdoc.css cannot be used by the new theme system in rustdoc. This is because I built the theme to sit on top of the existing rustdoc themes rather than replace them. It would be nice, however, to change this and fully support being integrated into the rustdoc theme system.

The only issue I see with this is that it would result in a greatly increased maintenance burden: any changes to rustdoc's themes would require the same changes to be made to my theme (and rustdoc changes quite a bit).

Anyhow, it's something to consider.

Relevant rustdoc documentation

@najamelan
Copy link
Contributor

I would like to work on this today. I just wonder what is the function of the rustdoc.css file? Given that as far as I can tell, stylish and co don't work on file:// urls.

I will make another file for now, but if we had a file that can work with rustdoc, it would seem that this would be the most appropriate filename for it...

@najamelan
Copy link
Contributor

najamelan commented Mar 9, 2019

Actually, I have to take that back. I spent all day on this, but the rustdoc theming is a royal mess. I don't see how I could do anything that makes sense without recompiling rustdoc, and for now I can't make the time for that. Moreover, I started looking into this because I thought it was not possible to inject stuff in a file:// url from a browser addon like stylish, but actually that's wrong.

I found the Code Injector for firefox, and just set a rule like .*target/doc.* and pasted in the rustdoc.css from this repository and off I go with ayu on cargo doc --open. In 30 seconds. Making a decent theming system for rustdoc would take weeks...

@Cldfire
Copy link
Owner Author

Cldfire commented Mar 10, 2019

Thanks for taking the time to look into this! I agree that it's probably a lot simpler to just override local docs via Stylish. I will open a separate issue to remind me to set that up sometime (#25).

@evanjs
Copy link

evanjs commented Oct 15, 2019

In spite of the comments regarding how this could silently fail when theme specs change in the future, I'm hopeful we'll be able to use ayu with the --theme option at some point, especially if it's stabilized soon.

Though, I'm much more hoping the themes between rustdoc and mdBook can be shared at some point in time...

@Cldfire
Copy link
Owner Author

Cldfire commented Apr 30, 2020

A couple weeks ago I took the time to clean everything up and turn this into a polished rustdoc theme. There's currently a PR open to include it officially with rustdoc: rust-lang/rust#71237

Hopefully you'll be a click away from using this theme everywhere soon! For now you can use the file with rustdoc's --theme option directly, see https://github.com/Cldfire/rust/blob/rustdoc-ayu-theme/src/librustdoc/html/static/themes/ayu.css

@Cldfire Cldfire closed this as completed Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants