Skip to content

Commit

Permalink
Hide "Contents" on pages with multiple TOC trees (#613)
Browse files Browse the repository at this point in the history
If a document has more than one TOC tree directive and no other headings
on the page, an empty "Contents" section is rendered in the sidebar.
Adjusting the hide-toc logic to check if all entries in the TOC tree are
all local TOC tree entries.

Signed-off-by: James Knight <james.d.knight@live.com>
  • Loading branch information
jdknight committed May 6, 2024
1 parent 2ce7e89 commit 8087116
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/furo/__init__.py
Expand Up @@ -76,8 +76,8 @@ def has_not_enough_items_to_show_toc(
except IndexError:
val = True
else:
# There's only the page's own toctree in there.
val = len(self_toctree) == 1 and self_toctree[0].tagname == "toctree"
# There's only the page's own toctree(s) in there.
val = all(entry.tagname == "toctree" for entry in self_toctree)
return val


Expand Down

0 comments on commit 8087116

Please sign in to comment.