Fix MkDocs API reference generation and navigation - #8
Merged
Conversation
The gen-files script was creating API stub pages, but static nav in mkdocs.yml excluded them and paths used reference/foo.md instead of reference/pdwidgets/foo/index.md, breaking reference/SUMMARY.md links. Remove static nav in favor of literate-nav from docs/SUMMARY.md, add API Reference section, rewrite the gen script following the mkdocstrings recipe, and enable symbol type headings in mkdocstrings. Co-authored-by: Brad Barnett <bdbarnett@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The gen-files script was creating API stub pages (
::: pdwidgets...), but they were not appearing in the published docs:mkdocs.ymlhad a staticnav:listing only Home/Getting started/Installation/Publishing. MkDocs logged: "pages exist but are not included in nav".reference/button.mdinstead ofreference/pdwidgets/widgets/button/index.md, soreference/SUMMARY.mdhad broken links likereference/reference/widgets/button.md.Solution
Mirrors the fix applied in PyDevices/palettes#4:
nav:; navigation now comes fromdocs/SUMMARY.mdvia literate-navdocs/SUMMARY.mdscripts/mkdocs_gen_ref_pages.pyto follow the mkdocstrings recipe (index.mdfor packages, paths relative tosrc/)show_root_heading/show_symbol_type_heading/show_symbol_type_tocin mkdocstringsVerification
python3 -m mkdocs buildcompletes without nav/link warnings. Generated pages (e.g.reference/pdwidgets/widgets/button/) include mkdocstrings API content with class and method headings.