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

Fix incorrect TOC collapsing #63

Merged
merged 1 commit into from
Apr 17, 2022
Merged
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
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