My theme preference in local documentation does not synchronize nor persist across different html files, even of the same crate.
I am using Firefox, if that matters, and if it is not possible to achieve this then can I configure cargo doc which settings to set by default?
It’s not so trivial to achieve with local HTML files, as far as I am aware, though I can’t claim to know the relevant web technologies well enough to be able to tell you it’s impossible to work around somehow (nor do I know whether or not Firefox would make it easier).
If you want to work around this as a user, you could try e.g. running a local web server to serve crate documentation.
For instance, if you have python installed, you should be able to simply do (from the top-level directory of your crate)
cargo doc # make sure we build the documentation first
python3 -m http.server -d target/doc # start the web-server included with python
then find your documentation entry point under localhost:8000/name_of_crate…/, and it should keep the settings synchronized between different sub-pages.
(other ports [like 12345] can be specified like python3 -m http.server -d target/doc 12345, if you’d like multiple instances in parallel and avoid the clashes)
1 Like