Skip to content

Collapse API Reference sidebar section by default - #14

Merged
imagirom merged 1 commit into
mainfrom
worktree-collapse-api-sidebar
Jul 20, 2026
Merged

Collapse API Reference sidebar section by default#14
imagirom merged 1 commit into
mainfrom
worktree-collapse-api-sidebar

Conversation

@imagirom

@imagirom imagirom commented Jul 20, 2026

Copy link
Copy Markdown
Owner

The generated API module tree is overwhelming when fully expanded, while the notebook sections are the most instructive part of the docs and should stay open.

Since Material's navigation.expand is all-or-nothing, this keeps it enabled and adds a small extra_javascript snippet that strips the expansion markers (md-toggle--indeterminate) from the API Reference subtree on page load. Clicking still toggles normally, and the active trail stays open when browsing API pages themselves.

Verified against a full mkdocs build (notebook execution disabled): only the API Reference toggles are collapsed, Notebooks untouched, active trail preserved on reference pages.

navigation.expand expands every nav section; a small extra_javascript
snippet strips the expansion from the API Reference subtree on load so
the large generated module tree starts collapsed while the notebook
sections stay expanded. The active trail is kept open on API pages.

Claude-Session: https://claude.ai/code/session_01CPvMrqdjt98QMvvoAQqRcz
@imagirom
imagirom merged commit 2ca6a07 into main Jul 20, 2026
5 checks passed
@imagirom
imagirom deleted the worktree-collapse-api-sidebar branch July 20, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant