Auto merge of #54733 - GuillaumeGomez:stabilize-rustdoc-theme, r=ollie27,Dylan-DPC
Stabilize rustdoc theme options Closes #54730 This PR stabilizes the `--themes` (now `--theme`) and `--theme-checker` (now `--check-theme`) options, for allowing users to add custom themes to their documentation. Rustdoc includes two themes by default: `light` and `dark`. Using the `--theme` option, you can give rustdoc a CSS file to include as an extra theme for that render. Themes are named after the CSS file used, so using `--theme /path/to/your/custom-theme.css` will add a theme called `custom-theme` to the documentation. Even though the CLI flag to add a theme is getting stabilized, there's no guarantee that a theme file will always have the same effect on documentation generated with future versions of rustdoc. To aid in ensuring that a theme will work, the flag `--check-theme` is also available, which compares the CSS rules defined by a custom theme against the ones used in the `light` theme. If the `light` theme defines a CSS rule that the custom theme does not, rustdoc will report an error. (Rustdoc also performs this check for themes given to `--theme`, but only reports a warning when a difference is found.)
This commit is contained in:
@@ -252,13 +252,13 @@ fn opts() -> Vec<RustcOptGroup> {
|
||||
o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \
|
||||
program, rather than alphabetically")
|
||||
}),
|
||||
unstable("themes", |o| {
|
||||
o.optmulti("", "themes",
|
||||
stable("theme", |o| {
|
||||
o.optmulti("", "theme",
|
||||
"additional themes which will be added to the generated docs",
|
||||
"FILES")
|
||||
}),
|
||||
unstable("theme-checker", |o| {
|
||||
o.optmulti("", "theme-checker",
|
||||
stable("check-theme", |o| {
|
||||
o.optmulti("", "check-theme",
|
||||
"check if given theme is valid",
|
||||
"FILES")
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user