Rustdoc hacking?

Hi,

I'm curious about changing the style (colors and fonts) of rustdoc (cargo doc), as I'm not very satisfied with the current (default?) setting.

As a starting point, I'm thinking of experimenting with the font and color used in method names (such as this one).

My question is: where should I start looking at in the rust codebase for such changes? And a practical question: how much disk space I might need to hack rustdoc? (My laptop only has a small SSD).

Thanks

If you just want to modify a theme, you don't need to modify rustdoc itself. You can write your own custom themes as CSS files, and build docs with them. Use the --theme parameter.

If you have a Cargo project, and want to build it with a custom rustdoc CSS theme, use the cargo rustdoc command (and notice the -- placeholder that separates the Cargo parameter from the rustdoc one).

cargo rustdoc --open -- --theme my-theme.css

The default themes, and some other resources like JavaScript and icon SVGs, are found in rust/src/librustdoc/html/static in the Rust source tree.

5 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.