sphinx-book-theme
sphinx-book-theme copied to clipboard
Support additional sidebar customisation in pydata-sphinx-theme
Context
The version of pydata-sphinx-theme version currently used, 0.8.0, has the following customisation for the sidebar:
-
show_nav_level
(setsshow_nav_level
, this theme supports it asshow_navbar_depth
) -
navigation_depth
(setsmaxdepth
) -
collapse_navigation
(setscollapse
)
https://github.com/pydata/pydata-sphinx-theme/blob/v0.8.0/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/_templates/sidebar-nav-bs.html
in the main
branch the same options are available but in a new file https://github.com/pydata/pydata-sphinx-theme/blob/e2b274ae842eccdb3e6a605ce5f2389a27a43550/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html
I need to customise the maxdepth
parameter, as our help has 5 levels of help topics, and the hardcoded value currently is 4. My employer may want to set collapse
as well. It seems to make sense to surface these configuration options together.
Proposal
Add support for customising the navigation_depth
and collapse_navigation
options.
This requires using the theme_navigation_depth
and theme_collapse_navigation
here https://github.com/executablebooks/sphinx-book-theme/blob/f425732ea1c2dd2f1a1ddaf0a89413a14b981baa/src/sphinx_book_theme/theme/sphinx_book_theme/components/sbt-sidebar-nav.html rather than hard coded values.
This is assuming we are happy using the same names for these option as in pydata-sphinx-theme. I suggest this is a good idea as it simplifies understanding these options when e.g. reading the pydata-sphinx-theme documentation. Although we have not done this with show_nav_level
/show_navbar_depth
, so maybe keeping consistant with that is more important.
Tasks and updates
- [ ] Decide on theme option names
- [ ] Possibly add options to
theme.conf
, and support them insbt-sidebar-nav.html
- [ ] Update documentation