[Repo Assist] Add nested navigation categories and fix front-matter value parsing#1105
Open
github-actions[bot] wants to merge 8 commits intomainfrom
Open
Conversation
- Support 'category: Parent/Child' syntax in document front matter. Documents using a slash separator are grouped under a parent nav header; a sub-header is rendered for each child group beneath it. Documents without a sub-category remain directly under the parent. Existing flat categories are unchanged (no '/' → identical output). Closes #927. - Fix FrontMatterFile.ParseFromLines to preserve the full value when a front-matter field contains more than one colon (e.g. 'title: F#: An Introduction'). Previously the text after the second colon was discarded. Co-authored-by: Copilot <[email protected]>
9 tasks
Contributor
|
/repo-assist adds unit and/or intergration tests for all this, including adding testing for relevant existing things that haven't been tested |
Contributor
Author
|
✅ Repo Assist completed successfully! |
…ationEntries - Add 8 unit tests for FrontMatterFile.ParseFromLines covering: - Standard YAML front-matter parsing - Preservation of colons in values (regression for PR #1105 fix) - Missing required fields return None - Non-numeric index returns None - .fsx-style front-matter ((**...*) delimiters) - Whitespace trimming - Empty input returns None - Add 10 unit tests for GetNavigationEntries covering: - No-category path emits Documentation header - Flat categories emit nav-header (no nav-sub-header) - Nested categories (Parent/Child) emit nav-sub-header - Parent name not rendered as nav-sub-header - Parent ordering by minimum CategoryIndex - Mixed nested and flat categories - Active page marking - ignoreUncategorized filter - index.md exclusion from navigation Co-authored-by: Copilot <[email protected]>
Contributor
Author
|
Commit pushed:
|
Contributor
Author
|
🤖 This is an automated update from Repo Assist. Added 18 new unit tests to
All 138 tests pass (was 120 before; +18 new).
|
…26-03-21-710ac1928ff78539
…26-03-21-710ac1928ff78539
…26-03-21-710ac1928ff78539
…26-03-21-710ac1928ff78539
…26-03-21-710ac1928ff78539
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Closes #927
Summary
Two improvements bundled together since both touch document front-matter handling:
1. Nested navigation categories (Task 3 — Issue Fix)
Documents can now declare a sub-category using
/as a separator in thecategoryfront-matter field:Backwards compatible: any category without
/renders exactly as before. Parent category order in the sidebar is determined by the minimumCategoryIndexof any document within that parent group.CSS: added
.nav-sub-headerstyle tofsdocs-default.css— indented, slightly smaller weight than the top-level header.Templating path: when
_menu_template.html/_menu-item_template.htmlare present, the nested structure is flattened to parent-level groups so existing custom templates continue to work without changes.2. Fix front-matter value parsing with
:in values (Task 5 — Coding Improvement)FrontMatterFile.ParseFromLinespreviously split each line on:and took only the second segment, discarding any additional:characters in the value. For example:The fix joins all parts after the first
:, preserving the full value.Changes
src/fsdocs-tool/BuildCommand.fs:GetNavigationEntries— addedparseNestedCategoryhelper,hasNestedCategoriesdetection, and a newelif hasNestedCategoriesrendering branch with parent/sub-group logic.docs/content/fsdocs-default.css: Added.nav-sub-headerCSS class (indented, normal weight, slight opacity reduction vs parent header).src/FSharp.Formatting.Common/Templating.fs:FrontMatterFile.ParseFromLines— join remaining parts after splitting on:.RELEASE_NOTES.md: Added entries under[Unreleased].Test Status
mainwithout changes — not caused by this PR)Design decisions
/character was chosen as the separator (matching the Repo Assist proposal in Nesting Document Categories #927 and conventions from other static site generators such as Hugo and Docusaurus).CategoryIndexamong its children, so no new front-matter key is required.