fix(docs): restore table of contents layout and parsing#505
Conversation
Restore the xl two-column grid for the TOC rail and parse raw MDX body instead of Velite HTML so headings are extracted correctly. Co-authored-by: Cursor <cursoragent@cursor.com>
Deploying animata with
|
| Latest commit: |
21fc463
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://53bbd835.animata.pages.dev |
| Branch Preview URL: | https://fix-docs-toc.animata.pages.dev |
📝 WalkthroughWalkthroughBlog and docs pages now derive tables of contents from parsed body content and update layouts to use a lg grid with a 200px sidebar; sidebar visibility and sidebar-nav styling were adjusted accordingly. ChangesTable of Contents Generation and Sidebar Layout
🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers:
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Use IBM Plex Sans at regular weight with foreground text in the docs sidebar. Co-authored-by: Cursor <cursoragent@cursor.com>
Move the TOC grid and visibility from xl to lg so the rail appears at 1024px. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
components/sidebar-nav.tsx (2)
343-343: 💤 Low valueConsider removing redundant font-weight declaration.
The
font-normalTailwind utility on line 343 setsfont-weight: 400, but the CSS rule atstyles/docs.css:18also explicitly setsfont-weight: 400for.docs-shell aside. Since the CSS selector is more specific, the Tailwind utility is effectively redundant.For cleaner maintainability, consider removing the
font-normalclass here and relying solely on the CSS rule.♻️ Proposed cleanup
- <div className="grid auto-rows-max grid-flow-row gap-0.5 text-sm font-normal text-foreground"> + <div className="grid auto-rows-max grid-flow-row gap-0.5 text-sm text-foreground">🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/sidebar-nav.tsx` at line 343, Remove the redundant Tailwind font utility by deleting "font-normal" from the className on the container div in components/sidebar-nav.tsx (the div with className starting "grid auto-rows-max grid-flow-row..."); rely on the existing CSS rule in styles/docs.css that sets font-weight: 400 for .docs-shell aside, and run a quick visual check of the sidebar to confirm no style regressions.
375-376: Ensure disabled sidebar-nav titles stay visually distinct (they rely onopacity-60+ inheritedtext-foreground)
- In
components/sidebar-nav.tsx, the disabled (non-link) row addscursor-not-allowed opacity-60, but the title span is onlytruncate(notext-muted-foreground), so the disabled state contrast comes mainly from opacity.- The item label does keep
text-muted-foreground, so the muted styling loss applies to the title text specifically.- This matches the broader pattern in the repo where disabled states often use
disabled:*opacity*(e.g.,components/ui/input.tsx,components/ui/command.tsx,components/ui/select.tsx); one exception isanimata/widget/water-tracker.tsxwhich usestext-muted-foregroundfor its disabled state.Consider reintroducing a muted/secondary text color for the disabled sidebar title if opacity alone isn’t sufficient for the intended hierarchy.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/sidebar-nav.tsx` around lines 375 - 376, The disabled sidebar row relies only on "opacity-60" (item.disabled) while the title span only has "truncate" and loses the muted color, so update the conditional classes in components/sidebar-nav.tsx to apply a muted/secondary text color to the title when item.disabled is true (use the same "text-muted-foreground" used by the item label) — target the title span and add a conditional class based on item.disabled so disabled titles use text-muted-foreground in addition to the existing opacity/cursor styles.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@components/sidebar-nav.tsx`:
- Line 343: Remove the redundant Tailwind font utility by deleting "font-normal"
from the className on the container div in components/sidebar-nav.tsx (the div
with className starting "grid auto-rows-max grid-flow-row..."); rely on the
existing CSS rule in styles/docs.css that sets font-weight: 400 for .docs-shell
aside, and run a quick visual check of the sidebar to confirm no style
regressions.
- Around line 375-376: The disabled sidebar row relies only on "opacity-60"
(item.disabled) while the title span only has "truncate" and loses the muted
color, so update the conditional classes in components/sidebar-nav.tsx to apply
a muted/secondary text color to the title when item.disabled is true (use the
same "text-muted-foreground" used by the item label) — target the title span and
add a conditional class based on item.disabled so disabled titles use
text-muted-foreground in addition to the existing opacity/cursor styles.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f9fe3282-4194-4484-a140-c84e84de9a33
📒 Files selected for processing (4)
app/(main)/blog/[[...slug]]/page.tsxapp/(main)/docs/[[...slug]]/page.tsxcomponents/sidebar-nav.tsxstyles/docs.css
🚧 Files skipped from review as they are similar to previous changes (2)
- app/(main)/blog/[[...slug]]/page.tsx
- app/(main)/docs/[[...slug]]/page.tsx
Restore the xl two-column grid for the TOC rail and parse raw MDX body instead of Velite HTML so headings are extracted correctly.
Summary by CodeRabbit
Style
Refactor