Add support for partial nav inclusion using anchor syntax#148
Open
jacobstr wants to merge 3 commits intobackstage:masterfrom
Open
Add support for partial nav inclusion using anchor syntax#148jacobstr wants to merge 3 commits intobackstage:masterfrom
jacobstr wants to merge 3 commits intobackstage:masterfrom
Conversation
This commit adds the ability to include only specific sections of a
navigation tree from an included mkdocs.yml file using anchor syntax.
Syntax: !include path/to/mkdocs.yml#SectionName
Changes:
- Parse anchor fragments from include paths (e.g., #Guides)
- Extract only the specified nav section from the included file
- Generate unique aliases by appending section names to avoid conflicts
- Update path resolution to handle anchored includes correctly
Example usage:
nav:
- Guides:
- My Section: "!include docs/other/mkdocs.yml#Guides"
This allows for more flexible documentation organization by reusing
specific sections of navigation trees without duplicating content or
including entire documentation hierarchies.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added comprehensive unit tests for anchor parsing, nav extraction, unique alias generation, and error handling - Updated CHANGELOG.md with new feature details for v1.2.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added test documenting potential alias collision scenario when site_name matches generated alias pattern (site_name-SectionName) - Updated limitations.md with clear example and workaround - Created claude.md to preserve original prompts and design context 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
f67bdfa to
27911d3
Compare
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.
Summary
This PR adds support for partial navigation inclusion using anchor syntax, allowing users to include only specific sections of a navigation tree from an included
mkdocs.ymlfile.Syntax
Use Case
This is particularly useful for monorepo documentation where you want to:
Changes
#Guides)Testing
Documentation
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com