Also add an optional toggle button for it.
Three new config options have been added:
1. 'color_mode' which can be set to one of 'light', 'dark', or 'auto'.
Default is 'light' for backward compatability. The 'auto' color mode
will check the system settings and automaticaly switch to light or
dark mode on page load or when the system's color mode changes.
2. 'hljs_style_dark': the Highlight.js theme to use in 'dark_mode'.
Default is 'github-dark' which matches the light mode default of
'github'. The preexisting config option 'hljs_style' is used for
'light' mode.
3. 'user_color_mode_toggle':
Allow users to select their prefered color mode (light, dark, auto) from
within the browser and save their preference for future page loads. The
new config option 'user_color_mode_toggle' (default: 'False') can be
enabled to display a toggle menu in the nav bar. The default value of the
toggle menu on first load is the value set to 'color_mode'.
MkDocs' own documentation is now configured with 'color_mode: auto'.
Co-authored-by: Oleh Prypin <oleh@pryp.in>
The font files have been moved from 'mkdocs/themes/mkdocs/fonts/' to
'mkdocs/themes/mkdocs/webfonts'. The 'brands', 'regular', and 'solid'
collections (all free collections) have been included as has the
'v4-font-face' shim for backward compatability.
Javascript has been updated to Bootstrap version 5.3.2 and CSS has been
updated to the the Bootswatch Cerulean theme version 5.3.2. Adding support
for a dark mode to the mkdocs theme is now possible.
All local colors (in base.css, extra.css, etc.) are now defined using
Bootstrap variables so that any future color modes (such as dark mode)
will be consistent.
Admonition styles have also been fully fleshed out with all colors being
Bootstrap colors (via variables) rather than our own custom colors.
Note that while Bootstrap version 5 dropped a dependency on jQuery, the
mkdocs theme is still making use of jQuery at this time. However, future
changes could remove the need for this dependency.
Co-authored-by: Oleh Prypin <oleh@pryp.in>
This partly reverts changes in commit e755aaed7e as some of that functionality will be deprecated.
Several more edge cases are taken into account now.
Co-authored-by: Waylan Limberg <waylan.limberg@icloud.com>
If a pull request has applicable Ruff fixes or needs re-formatting with Black/isort, these will be automatically pushed to the pull request via https://pre-commit.ci/lite.html
Versions of these formatter tools are already pinned since commit c9cf11b941, so unexpected unrelated changes from just updating these tools will not happen.
Note that the actual pre-commit tool is not used, and there are no plans for that.
Add a new field `content_bytes`/`content_string` to read the content regardless of whether it's backed by the new style or still by `abs_src_path` (which is now not always present)
The previous attempt always computed these on the fly https://github.com/mkdocs/mkdocs/pull/3017
but now they will be cached after first access, so the performance penalty is avoided.
The fields can still be overwritten manually.
And one can ask the fields to be recomputed by using the `del` operation.
Use the latest page update time instead of the current time
Now the date of the gzip file will change only once per day, based on the pages' update date. The sitemap.xml itself also changes once per day already.