[Repo Assist] Add nested navigation categories and fix front-matter value parsing#1105
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Draft
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 <223556219+Copilot@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.
🤖 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.