Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for globaltoc_includeinternal, closes #86 #88

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Configuration Options
If true, TOC entries that are not ancestors of the current page are collapsed.
``globaltoc_includehidden``
If true, the global TOC tree will also contain hidden entries.
``globaltoc_includeinternal``
If false, the global TOC tree will not contain internal section headings
``theme_color``
The theme color for mobile browsers. Hex Color without the leading #.
``color_primary``
Expand Down
2 changes: 2 additions & 0 deletions sphinx_material/sphinx_material/globaltoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% set toctree_nodes = derender_toc(toctree, False) %}
<ul class="md-nav__list">
{%- for item in toctree_nodes recursive %}
{% if (theme_globaltoc_includeinternal|tobool) or not ("#" in item.href and not item.href.endswith("#")) %}
<li class="md-nav__item">
{% if "caption" in item %}
<span class="md-nav__link caption">{{ item.caption }}</span>
Expand All @@ -22,6 +23,7 @@
{%- endif %}
{% endif %}
</li>
{% endif %}
{%- endfor %}
</ul>
{# TODO: Fallback to toc? #}
Expand Down
4 changes: 3 additions & 1 deletion sphinx_material/sphinx_material/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ globaltoc_depth = 1
globaltoc_collapse = true
# If true, the global TOC tree will also contain hidden entries
globaltoc_includehidden = true
# If false, the global TOC tree will not contain internal section headings
globaltoc_includeinternal = true

# Colors
# The theme color for mobile browsers. Hex color.
Expand Down Expand Up @@ -109,4 +111,4 @@ version_json = "versions.json"
# Table classes to _not_ strip. Must be a list. Classes on this list are *not*
# removed from tables. All other classes are removed, and only tables with outclasses
# are styled by default.
table_classes =
table_classes =