Cldfire / ayu-rs

CSS for Rustlang websites based on the ST3 theme Ayu
Other
76 stars 7 forks source link

Support the rustdoc theme system #24

Closed Cldfire closed 4 years ago

Cldfire commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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: https://github.com/rust-lang/rust/pull/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