diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2022-07-07 15:43:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 08:43:19 -0400 |
commit | 342a7f06ce153811cdb73c0a22be65893805e6d5 (patch) | |
tree | 6d76b6dc9a942c11314846d90b871a2d51b8b4cd | |
parent | a48ffc857c885501421e69a30b686d40a3b67a78 (diff) | |
download | numpydoc-342a7f06ce153811cdb73c0a22be65893805e6d5.tar.gz |
DOC: Add theme switcher and default to lightmode. (#414)
* DOC: Add theme switcher and default to lightmode.
* Make linter happy.
* Add workaround for theme versions that don't support mode switcher.
* Add comment about theme version checking in conf.
-rw-r--r-- | doc/conf.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/conf.py b/doc/conf.py index 4b36f7e..560334d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -85,9 +85,26 @@ html_theme_options = { "show_prev_next": False, "navbar_end": ["search-field.html", "navbar-icon-links.html"], } +# NOTE: The following is required for supporting of older sphinx toolchains. +# The "theme-switcher" templated should be added directly to navbar_end +# above and the following lines removed when the minimum supported +# version of pydata_sphinx_theme is 0.9.0 +# Add version switcher for versions of pydata_sphinx_theme that support it +import packaging +import pydata_sphinx_theme + +if packaging.version.parse(pydata_sphinx_theme.__version__) >= packaging.version.parse( + "0.9.0" +): + html_theme_options["navbar_end"].insert(0, "theme-switcher") + + html_sidebars = { "**": [], } +html_context = { + "default_mode": "light", +} html_title = f"{project} v{version} Manual" html_last_updated_fmt = "%b %d, %Y" |