feat: Add full support for nested navigation in MkDocs configuration #37
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.
🚀 Feature: Full Support for Nested Navigation in MkDocs
📋 Summary
This PR implements complete support for nested navigation structures in the MkDocs
navsection, allowing documentation to maintain its hierarchical structure when published to Confluence.Closes: Addresses the limitation previously documented in README.md about flattening nested navigation.
🎯 Motivation
Previously, the action flattened all pages to a single level regardless of their nesting in the MkDocs configuration. This meant that hierarchical documentation structures were lost when publishing to Confluence, making it difficult to organize complex documentation.
Before:
After:
✨ What's New
1. Hierarchical Page Structure
Pages now maintain their parent-child relationships as defined in
mkdocs.yml:2. Arbitrary Nesting Depth
Supports unlimited nesting levels - organize your docs however makes sense for your project!
3. Smart Parent Assignment
🔧 Technical Implementation
Core Changes
1. Context Module (
lib/context.js)traverse()function to track parent-child relationships viaparentPathparameter2. LocalPage Model (
lib/models/local-page.js)parentPathproperty to store the section title that contains the page3. Confluence Syncer (
lib/confluence-syncer.js)syncPages()to handle hierarchical structures4. Documentation (
README.md)📊 How It Works
✅ Testing
All Existing Tests Pass
New Test Fixtures
Added comprehensive test fixture for nested structures:
Test Evidence
🔄 Backward Compatibility
✅ Fully backward compatible!
Existing configurations with flat navigation continue to work exactly as before:
All pages are created at root level (under home page) with
parentPath: null.📖 Usage Examples
Simple Nesting
Result in Confluence:
Deep Nesting
Result in Confluence:
🎨 Benefits
📝 Migration Guide
No migration required! This is a pure enhancement.
If you want to start using nested navigation:
mkdocs.ymlto use nested structure🔍 Code Quality
📚 Related Documentation
🙏 Acknowledgments
This implementation follows best practices for:
📋 Checklist