Skip to content

Commit f6c3d1d

Browse files
committed
docs: no third level toc on command usage pages ("Description", "Examples")
1 parent 193c185 commit f6c3d1d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

docs/_templates/globaltoc.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<div class="sidebar-block">
22
<div class="sidebar-toc">
3-
{% set toctree = toctree(maxdepth=3, collapse=True, includehidden=True) %}
3+
{# Restrict the sidebar toc depth to two levels while generating command usage pages.
4+
This avoids superfluous entries for each "Description" and "Examples" heading. #}
5+
{% if pagename.startswith("usage/") and pagename not in (
6+
"usage/general", "usage/help", "usage/debug", "usage/notes",
7+
) %}
8+
{% set maxdepth = 2 %}
9+
{% else %}
10+
{% set maxdepth = 3 %}
11+
{% endif %}
12+
13+
{% set toctree = toctree(maxdepth=maxdepth, collapse=True) %}
414
{% if toctree %}
515
{{ toctree }}
616
{% else %}

docs/usage.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ Usage
3131
</script>
3232

3333
.. toctree::
34-
:hidden:
35-
3634
usage/general
3735

3836
usage/init

0 commit comments

Comments
 (0)