Treat childless file: subdir/index.md as a single-page folder#3471
Treat childless file: subdir/index.md as a single-page folder#3471cotti wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 19 minutes and 23 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR adds documentation for deep-linked Sequence Diagram(s)sequenceDiagram
participant TocEntry as docset.yml TOC entry
participant Converter as TocItemYamlConverter.ReadYaml
participant Navigation as navigation rendering
participant Collector as error collector
TocEntry->>Converter: file: reference/.../index.md
alt childless deep-linked index.md
Converter-->>Navigation: FolderRef with FolderIndexFileRef
else bare root index.md
Converter-->>Navigation: IndexFileRef
else deep-linked entry with children
Converter-->>Navigation: FileRef with children
end
Navigation-->>Collector: zero errors
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Mpdreamz
left a comment
There was a problem hiding this comment.
Thanks for the fix — the implementation is correct and the test coverage is solid. A few things to address before merging:
Comment verbosity
The four-line comment block in TableOfContentsYamlConverters.cs re-narrates the bug history. That belongs in the commit/PR description, not the source. Trim to one line:
// Sugar: "file: subdir/index.md" without children → single-page folder to avoid silent nav drop.
if (children.Count == 0 && fileOnly.EndsWith("/index.md", StringComparison.Ordinal))Docs framing
The PR description calls folder: + file: index.md "the unintuitive workaround" but that has always been the preferred canonical form. The docs section should reflect this — e.g.:
"This is shorthand for the explicit
folder:+file:form, which remains the preferred approach for folders that also have additional children."
Missing docs: behavior under folder: + children:
The test FolderWithChildlessIndexFileChildrenKeepsEveryEntry shows the sugar works inside a parent folder's children: list too, but the docs don't mention it. This is the primary real-world use case (e.g. 100+ single-page integrations under a reference/ folder):
toc:
- folder: reference
file: index.md
children:
- file: 1password/index.md # → becomes its own FolderRef
- file: activemq/index.md # → becomes its own FolderRefEach entry becomes its own subsection; none "steals" the parent's index. Worth a short mention in the docs since it's the main usage pattern.
toc: version scope
The version: key goes through a separate converter branch. Please confirm whether file: subdir/index.md under a versioned toc entry is also covered (or explicitly out of scope). If it still silently drops there, that's worth a follow-up issue at minimum.
Minor: test class docstring
The class-level <summary> block in DeepLinkedIndexFileTests.cs is multi-paragraph. Project convention is no multi-paragraph docstrings — either drop it or fold to one line.
83724b0 to
778baaa
Compare
|
Thanks for the review @Mpdreamz — addressed in 778baaa (also rebased onto latest
On |
A childless `file: subdir/index.md` entry resolved to a bare leaf that competed with its siblings for the parent's index slot and was silently dropped from the navigation, forcing authors to use a `folder:` workaround. Treat it as sugar for a folder with an index file so the full path works as expected. Entries that declare children keep their virtual-file semantics. Fixes #764 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Condense the converter comment to one line, reframe the navigation docs to present folder: + file: as the preferred canonical form, document the shorthand under a parent folder's children: list (the main use case), and fold the test class docstring to a single line per project convention. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
778baaa to
a657395
Compare
Why
Closes #764. Authors expect to add single-page subdirectories to the TOC with the natural full path:
Instead, every such childless
file: subdir/index.mdentry was silently dropped from the navigation, with no error. The only workaround was the unintuitivefolder:+file: index.mdform (or renaming files toreference/1password.md).What
A childless
file:entry pointing at a subdirectoryindex.mdpreviously resolved to a bare leaf that competed with its siblings for the parent's index slot — losing that race meant it never appeared in the tree (and in nested cases its path got doubled).The YAML converter now treats such an entry as sugar for
folder: subdirwith a singlefile: index.mdchild, so it becomes its own single-page subsection and the full-path form works as documented. Entries that declare explicitchildrenare untouched and keep their existing virtual-file (deep-linking) semantics, so the change is backward compatible.Covered by new regression tests in
DeepLinkedIndexFileTests.cs(conversion, backward-compat for bareindex.mdand entries with children, rendering as a plain link, multiple siblings under a parent folder, and no path-doubling under a virtual-file parent). Navigation behavior is documented under "Deep-linkedindex.mdfiles" in the navigation config docs.Made with Cursor