-
Notifications
You must be signed in to change notification settings - Fork 13k
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 options to set default theme (and other settings) #77213
Changes from all commits
2e10475
5cd96d6
d8a4497
709efd9
39b80cb
1d6c860
776e204
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,6 +269,26 @@ fn opts() -> Vec<RustcOptGroup> { | |
"sort modules by where they appear in the program, rather than alphabetically", | ||
) | ||
}), | ||
unstable("default-theme", |o| { | ||
o.optopt( | ||
"", | ||
"default-theme", | ||
"Set the default theme. THEME should be the theme name, generally lowercase. \ | ||
If an unknown default theme is specified, the builtin default is used. \ | ||
The set of themes, and the rustdoc built-in default is not stable.", | ||
"THEME", | ||
) | ||
}), | ||
Comment on lines
+272
to
+281
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is default-theme special cased? If you want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I would also be ok with getting rid of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The storage names are rather internal, and Indeed, as you can see from the implementation, Indeed, I think this fact about #77809 shows that my pre-#77809 approach of having a raw Notice that the stability caveats for the two options are rather different. Another aspect of this is that it might easily make sense to stabilise the |
||
unstable("default-setting", |o| { | ||
o.optmulti( | ||
"", | ||
"default-setting", | ||
"Default value for a rustdoc setting (used when \"rustdoc-SETTING\" is absent \ | ||
from web browser Local Storage). If VALUE is not supplied, \"true\" is used. \ | ||
Supported SETTINGs and VALUEs are not documented and not stable.", | ||
"SETTING[=VALUE]", | ||
) | ||
}), | ||
stable("theme", |o| { | ||
o.optmulti( | ||
"", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing that
--default-theme
breaks is you now have different behavior for--default-theme x
and--default-setting theme=x
- the first will setuse-system-theme=false
, the second will not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That is inevitable and deliberate. As you can see from the usage message we do not make any promises about the particular behaviour of
--default-setting
. The available settings and their semantics and not documented and not stable.Whereas the semantics of
--default-theme
are well-defined, and are implemented by setting the two internal settings.I do think it is worth keeping
--default-setting
even despite these caveats because in practice the storage settings are visible to users via their browser and of course if they look at the JS.The difference between
--default-setting
and--default-theme
is like the difference between firefox'sabout:config
andabout:preferences
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my question is why you would ever want to modify
default-setting
. All those settings are also configurable on a per-user basis onsettings.html
- do we really need so much flexibility as to make the 'default defaults' configurable too?