Skip to content

[Repo Assist] Add nested navigation categories and fix front-matter value parsing#1105

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-frontmatter-nestedcat-2026-03-21-710ac1928ff78539
Draft

[Repo Assist] Add nested navigation categories and fix front-matter value parsing#1105
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-frontmatter-nestedcat-2026-03-21-710ac1928ff78539

Conversation

@github-actions
Copy link
Contributor

🤖 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 the category front-matter field:

---
category: Reference/API
categoryindex: 2
index: 1
---
```

The sidebar renders this as a parent header with indented sub-headers beneath it:

```
Collections           ← .nav-header (parent)
  Arrays              ← .nav-sub-header (child)
    - Pattern Matching
  Lists               ← .nav-sub-header (child)
    - Destructuring with Cons
    - Pattern Matching
Reference             ← .nav-header (parent)
  - Getting Started   ← direct item under parent (no sub-category)
  API                 ← .nav-sub-header
    - Markdown
    - Literate

Backwards compatible: any category without / renders exactly as before. Parent category order in the sidebar is determined by the minimum CategoryIndex of any document within that parent group.

CSS: added .nav-sub-header style to fsdocs-default.css — indented, slightly smaller weight than the top-level header.

Templating path: when _menu_template.html / _menu-item_template.html are 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.ParseFromLines previously split each line on : and took only the second segment, discarding any additional : characters in the value. For example:

title: F#: An Introduction   # was captured as "F#" — now correctly " F#: An Introduction"

The fix joins all parts after the first :, preserving the full value.

Changes

  • src/fsdocs-tool/BuildCommand.fs: GetNavigationEntries — added parseNestedCategory helper, hasNestedCategories detection, and a new elif hasNestedCategories rendering branch with parent/sub-group logic.
  • docs/content/fsdocs-default.css: Added .nav-sub-header CSS 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

  • ✅ Build succeeded (0 errors; 1 pre-existing warning FS0760)
  • ✅ All tests pass: 281 Markdown, 30 CodeFormat, 8 fsdocs-tool, 32 Literate, 88 ApiDocs
  • ℹ️ One pre-existing infrastructure crash in the test runner (reproducible on main without changes — not caused by this PR)

Design decisions

  • The / 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).
  • Depth is limited to one level (parent/child) for simplicity. Deeper nesting could be added later if needed.
  • Parent category ordering is determined automatically by the minimum CategoryIndex among its children, so no new front-matter key is required.

Generated by Repo Assist ·

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@d1d884596e62351dd652ae78465885dd32f0dd7d

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nesting Document Categories

0 participants