-
Notifications
You must be signed in to change notification settings - Fork 16
Migrate documentation to Zensical #67
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
Open
jonathan343
wants to merge
2
commits into
develop
Choose a base branch
from
zensical-migration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,59 @@ | ||
| /** | ||
| * Keep API Reference nav expanded on /clients/ pages and highlight active client. | ||
| * Uses Material for MkDocs document$ observable for instant navigation compatibility. | ||
| * Keep the active client highlighted and its nav section expanded across all | ||
| * of its API reference pages (/clients/<name>/...). | ||
| * | ||
| * Zensical already auto-expands "Available Clients" and highlights the active | ||
| * client on that client's own index page, but not on its nested symbol pages | ||
| * (operations/, enums/, structures/, unions/, errors/). This restores that | ||
| * orientation so the sidebar stays anchored while browsing a client's API. | ||
| */ | ||
| function expandClientsNav() { | ||
| if (!location.pathname.includes("/clients/")) return; | ||
| document.querySelectorAll(".md-nav__item--nested").forEach(function (item) { | ||
| var link = item.querySelector(":scope > .md-nav__link"); | ||
| if (link && link.textContent.trim().includes("Available Clients")) { | ||
| // Expand "All Available Clients" drop down | ||
| var toggle = item.querySelector(":scope > .md-nav__toggle"); | ||
| if (toggle) toggle.checked = true; | ||
| item.setAttribute("data-md-state", "expanded"); | ||
|
|
||
| // Highlight active client | ||
| var navItems = item.querySelectorAll(".md-nav__item .md-nav__link"); | ||
| navItems.forEach(function (navLink) { | ||
| if (navLink.href && location.pathname.includes(navLink.pathname)) { | ||
| navLink.classList.add("md-nav__link--active"); | ||
| } | ||
| }); | ||
| function highlightActiveClient() { | ||
| // Match ".../clients/<name>/..." and capture the client segment. | ||
| var match = location.pathname.match(/\/clients\/([^/]+)\//); | ||
| if (!match) return; | ||
|
|
||
| // Reconstruct the client's index path, e.g. "/clients/polly/", preserving | ||
| // any site base path (the docs are served under a sub-path in production). | ||
| var clientRoot = | ||
| location.pathname.slice(0, match.index) + "/clients/" + match[1] + "/"; | ||
|
|
||
| // Scope to the primary sidebar only. The secondary "On this page" TOC uses | ||
| // the same link classes, and its same-page anchors would otherwise all match | ||
| // clientRoot on a client's index page and get highlighted. | ||
| var sidebar = document.querySelector(".md-nav--primary"); | ||
| if (!sidebar) return; | ||
|
|
||
| // The client appears exactly once in the sidebar, so find it and stop — | ||
| // avoids scanning the rest of the nav (hundreds of links once many clients | ||
| // exist). | ||
| var links = sidebar.querySelectorAll(".md-nav__link[href]"); | ||
| var link = null; | ||
| for (var i = 0; i < links.length; i++) { | ||
| if (links[i].pathname === clientRoot && !links[i].hash) { | ||
| link = links[i]; | ||
| break; | ||
| } | ||
| }); | ||
| } | ||
| if (!link) return; | ||
|
|
||
| // Highlight the client whose pages we're currently viewing. | ||
| link.classList.add("md-nav__link--active"); | ||
|
|
||
| // Expand every collapsible ancestor (incl. "Available Clients") so the | ||
| // highlighted link is visible. Expansion is driven by the toggle checkbox. | ||
| var item = link.closest(".md-nav__item--nested"); | ||
| while (item) { | ||
| var toggle = item.querySelector(":scope > .md-nav__toggle"); | ||
| if (toggle) toggle.checked = true; | ||
| var parent = item.parentElement; | ||
| item = parent && parent.closest(".md-nav__item--nested"); | ||
| } | ||
| } | ||
|
|
||
| // Subscribe to Material's document$ observable for instant navigation support | ||
| document$.subscribe(expandClientsNav); | ||
| // Also run on initial page load | ||
| expandClientsNav(); | ||
| // Re-run on every instant-navigation page load; fall back to a one-time run if | ||
| // the document$ observable isn't available. | ||
| if (typeof document$ !== "undefined" && document$.subscribe) { | ||
| document$.subscribe(highlightActiveClient); | ||
| } else { | ||
| highlightActiveClient(); | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,2 @@ | ||
| mkdocs==1.6.1 | ||
| mkdocstrings[python]==1.0.0 | ||
| mkdocs-material==9.7.0 | ||
| mkdocs-literate-nav==0.6.1 | ||
| mkdocstrings[python]~=1.0.4 | ||
| zensical~=0.0.46 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements-docs.in -o requirements-docs.txt | ||
| click==8.4.2 | ||
| # via | ||
| # mkdocs | ||
| # zensical | ||
| deepmerge==2.1.0 | ||
| # via zensical | ||
| ghp-import==2.1.0 | ||
| # via mkdocs | ||
| griffelib==2.1.0 | ||
| # via mkdocstrings-python | ||
| jinja2==3.1.6 | ||
| # via | ||
| # mkdocs | ||
| # mkdocstrings | ||
| # zensical | ||
| markdown==3.10.2 | ||
| # via | ||
| # mkdocs | ||
| # mkdocs-autorefs | ||
| # mkdocstrings | ||
| # pymdown-extensions | ||
| # zensical | ||
| markupsafe==3.0.3 | ||
| # via | ||
| # jinja2 | ||
| # mkdocs | ||
| # mkdocs-autorefs | ||
| # mkdocstrings | ||
| mergedeep==1.3.4 | ||
| # via | ||
| # mkdocs | ||
| # mkdocs-get-deps | ||
| mkdocs==1.6.1 | ||
| # via | ||
| # mkdocs-autorefs | ||
| # mkdocstrings | ||
| mkdocs-autorefs==1.4.4 | ||
| # via | ||
| # mkdocstrings | ||
| # mkdocstrings-python | ||
| mkdocs-get-deps==0.2.2 | ||
| # via mkdocs | ||
| mkdocstrings==1.0.4 | ||
| # via | ||
| # -r requirements-docs.in | ||
| # mkdocstrings-python | ||
| mkdocstrings-python==2.0.5 | ||
| # via mkdocstrings | ||
| packaging==26.2 | ||
| # via mkdocs | ||
| pathspec==1.1.1 | ||
| # via mkdocs | ||
| platformdirs==4.10.0 | ||
| # via mkdocs-get-deps | ||
| pygments==2.20.0 | ||
| # via zensical | ||
| pymdown-extensions==11.0 | ||
| # via | ||
| # mkdocstrings | ||
| # zensical | ||
| python-dateutil==2.9.0.post0 | ||
| # via ghp-import | ||
| pyyaml==6.0.3 | ||
| # via | ||
| # mkdocs | ||
| # mkdocs-get-deps | ||
| # pymdown-extensions | ||
| # pyyaml-env-tag | ||
| # zensical | ||
| pyyaml-env-tag==1.1 | ||
| # via mkdocs | ||
| six==1.17.0 | ||
| # via python-dateutil | ||
| tomli==2.4.1 | ||
| # via zensical | ||
| watchdog==6.0.0 | ||
| # via mkdocs | ||
| zensical==0.0.46 | ||
| # via -r requirements-docs.in |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our release infrastructure uses this file to add the correct dependencies to the nested clients'
pyproject.toml. If we release this now before updating our infrastructure to also use zensical, this would remove the necessary dependencies for the docs to be built in the clients.I'm not sure how many people actually build individual client docs, but maybe we wait to merge this change until we update our release infrastructure?