Skip to content

Commit

Permalink
Merge pull request #63 from jbms/fix-toc-issue-62
Browse files Browse the repository at this point in the history
Fix incorrect TOC collapsing
  • Loading branch information
jbms committed Apr 17, 2022
2 parents 4b7f27a + 4a918a9 commit 8c96b11
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sphinx_immaterial/nav_adapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def visit_bullet_list(self, node: docutils.nodes.bullet_list):
)
)
raise docutils.nodes.SkipChildren
# Otherwise, just process the each list_item as direct children.
# Otherwise, just process each list_item as direct children.

def get_result(self) -> MkdocsNavEntry:
return MkdocsNavEntry(
Expand Down Expand Up @@ -390,10 +390,9 @@ def _traverse(entries: List[MkdocsNavEntry], parent_key: TocEntryKey):
for i, entry in enumerate(entries):
child_key = parent_key + (i,)
url = entry.url
if url is None:
continue
url = _strip_fragment(url)
url_map[url].append(child_key)
if url is not None and not entry.caption_only:
url = _strip_fragment(url)
url_map[url].append(child_key)
_traverse(entry.children, child_key)

_traverse(toc, ())
Expand Down

0 comments on commit 8c96b11

Please sign in to comment.