[repo-assist] Add nested navigation categories via '/' in category front matter - #1337
github-actions[bot] wants to merge 2 commits into
Conversation
…matter Support 'category: Parent/Sub' syntax in document front matter. Documents using a slash separator are grouped under a parent nav header, with a sub-header rendered for each distinct sub-category beneath it. Documents without a sub-category remain listed directly under the parent. Existing flat categories are unchanged (no '/' -> identical output). Parent ordering uses the minimum categoryindex of any document under it, including those in its sub-categories. Closes #927. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/repo-assist Thanks for picking this up. I'm going to close this PR. The sidebar code is neat, but it only covers the rendering, and that is the easy part. The parts I flagged as hard in #927 (next/previous links, menu templates, several levels) are either missing or worked around. Previous/next links can disagree with the sidebar. The previous/next order still comes from sorting all pages by
It is not backwards compatible. Any existing category that contains a Custom menu templates get nothing. With a Only one level. The tests don't check much. The original requester has moved on and the issue has no 👍 yet, so I don't want to commit to a front-matter syntax now. I'll keep #927 open to see if other people want this. If they do, I would start differently:
|
🤖 This PR was created by Repo Assist, an automated AI assistant.
Closes #927
Summary
Adds support for one level of nested navigation categories using
/as a separator in thecategoryfront-matter field:This renders in the sidebar as:
Design choices, matching the approach originally proposed on the issue:
/was chosen as the separator to match Hugo/Docusaurus conventions.categorywith no/renders identically to today (verified by a dedicated regression test).categoryindexof any document under it, including documents in its sub-categories, so a parent doesn't need its own separate front-matter entry._menu_template.html(no built-in sub-header support in the templating system), sub-categories are flattened into their parent's single group so existing templates keep working unmodified.Implementation
src/fsdocs-tool/DocContent.fs:getNavigationEntriesFactorynow parsescategoryinto(parent, subCategory option), groups/sorts at both levels, and renders.nav-sub-headerlist items in the non-templated (default theme) path.docs/content/fsdocs-default.css: added.nav-sub-headerstyling (indented, smaller, same color family as.nav-header, with anactivestate).docs/content.fsx: documented the newcategory: Parent/Subsyntax.RELEASE_NOTES.md: added anUnreleased/Addedentry.Test Status
dotnet fantomas src tests docs --check— clean, no formatting issues.dotnet build FSharp.Formatting.sln -c Release— 0 errors, 0 warnings.dotnet test tests/fsdocs-tool.Tests— 33/33 passed (added 2 new tests: one exercising the nested-category rendering end-to-end, one confirming a flatcategoryrenders unchanged).dotnet test tests/FSharp.Literate.Tests --filter FullyQualifiedName~DocContent— 37/37 passed.dotnet test tests/FSharp.Literate.Tests(full suite) — 146/146 passed.Background
This reimplements the fix from #1105 (closed by
@dsymedue to unrelated merge conflicts against a large Suave migration, not because the feature itself was rejected) against the currentDocContent.fs/getNavigationEntriesFactorystructure, since the file has since been substantially refactored.Add this agentic workflow to your repo
To install this agentic workflow, run