Skip to content

Add support for partial nav inclusion using anchor syntax#148

Open
jacobstr wants to merge 3 commits intobackstage:masterfrom
jacobstr:feature/anchor-based-partial-nav-inclusion
Open

Add support for partial nav inclusion using anchor syntax#148
jacobstr wants to merge 3 commits intobackstage:masterfrom
jacobstr:feature/anchor-based-partial-nav-inclusion

Conversation

@jacobstr
Copy link
Copy Markdown

@jacobstr jacobstr commented Feb 5, 2026

Summary

Note: I asked Claude to check for AI policies in the repo. Hoping such contributions are kosher.

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.yml file.

Syntax

nav:
  - Guides:
    - My Section: "!include docs/other/mkdocs.yml#Guides"

Use Case

This is particularly useful for monorepo documentation where you want to:

  • Surface specific sections of a documentation tree at the top level
  • Avoid duplicating navigation entries
  • Keep the full documentation tree available in its original location

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 naming conflicts
  • Update path resolution to handle anchored includes correctly

Testing

  • Added comprehensive unit tests for anchor parsing, nav extraction, unique alias generation, and error handling
  • All existing tests continue to pass

Documentation

  • Updated CHANGELOG.md with feature details for v1.2.0

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

jacobstr and others added 3 commits February 4, 2026 17:03
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>
@jacobstr jacobstr force-pushed the feature/anchor-based-partial-nav-inclusion branch from f67bdfa to 27911d3 Compare February 5, 2026 09:00
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