Skip to content

Commit

Permalink
add support for globaltoc_includeinternal, closes bashtage#86
Browse files Browse the repository at this point in the history
  • Loading branch information
infinity0 committed Dec 4, 2020
1 parent 3c3d153 commit 2cc999d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
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 =

0 comments on commit 2cc999d

Please sign in to comment.