Skip to content

Commit

Permalink
Merge pull request #74 from timostroehlein/navigation-depth
Browse files Browse the repository at this point in the history
feat: add toctree_maxdepth option to specify depth shown in sidebar
  • Loading branch information
lepture authored Jan 9, 2025
2 parents 04172bb + 5ddebc7 commit 9d42f18
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/contributing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ server with:

.. code-block:: shell
python server.py
python serve.py
Build static
~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions docs/customisation/sidebar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The above configuration will only expand the first level of the global table of
Shibuya sphinx theme also provides other options to control the toctree_ function:

- toctree_collapse: equals to ``collapse``, ``False`` by default.
- toctree_maxdepth: equals to ``maxdepth``, ``4`` by default.
- toctree_titles_only: equals to ``titles_only``, ``True`` by default
- toctree_includehidden: equals to ``includehidden``, ``True`` by default

Expand Down
2 changes: 1 addition & 1 deletion src/shibuya/theme/shibuya/layout/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="sy-scrollbar p-6">
{%- include "partials/globaltoc-above.html" %}
<div class="globaltoc" data-expand-depth="{{ theme_globaltoc_expand_depth }}">
{%- set globaltoc = toctree(collapse=theme_toctree_collapse, titles_only=theme_toctree_titles_only, includehidden=theme_toctree_includehidden) -%}
{%- set globaltoc = toctree(collapse=theme_toctree_collapse, maxdepth=theme_toctree_maxdepth, titles_only=theme_toctree_titles_only, includehidden=theme_toctree_includehidden) -%}
{{ expandtoc(globaltoc, theme_globaltoc_expand_depth) }}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/shibuya/theme/shibuya/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nav_links_align =

# default global toc collapse
toctree_collapse =
toctree_maxdepth = 4
toctree_titles_only = True
toctree_includehidden = True
globaltoc_expand_depth = 0
Expand Down

0 comments on commit 9d42f18

Please sign in to comment.