feat: add table of contents navigation for docs pages (#1820)
What kind of change does this PR introduce?
- Feature: Added a table of contents to the "JSON data types" documentation section for better navigation
Issue Number:
- Closes #1820
Screenshots/videos:
If relevant, did you update the documentation?
- Yes, this PR enhances the existing documentation by adding navigation.
Summary This PR addresses the navigation challenges in the "JSON data types" section of the documentation by adding a table of contents at the top of each major JSON Schema data type page. The TOC provides quick access to subsections like "Required Properties," "Property Names," "Size," and "Pattern Properties," making it easier for users to explore and understand the schema features.
Key features:
- Auto-generated TOC based on heading levels (h2, h3)
- Smooth scrolling to sections
- Active section highlighting
- Responsive design (hidden on mobile)
- Follows existing design system
Does this PR introduce a breaking change?
- No, this is a non-breaking enhancement to the documentation.
Checklist
- [x] Read, understood, and followed the contributing guidelines
Hi @Suyog241005! Thanks a lot for your contribution!
I noticed that the following required information is missing or incomplete: kind of change description, completed checklist items
Please update the PR description to include this information. You can find placeholders in the PR template for these items.
Thanks a lot!
Hi @Suyog241005! Thanks a lot for your contribution!
I noticed that the following required information is missing or incomplete: kind of change description, completed checklist items
Please update the PR description to include this information. You can find placeholders in the PR template for these items.
Thanks a lot!
Hi @Suyog241005! Thanks a lot for your contribution!
I noticed that the following required information is missing or incomplete: kind of change description, completed checklist items
Please update the PR description to include this information. You can find placeholders in the PR template for these items.
Thanks a lot!
Hi @Suyog241005! Thanks a lot for your contribution!
I noticed that the following required information is missing or incomplete: kind of change description, completed checklist items
Please update the PR description to include this information. You can find placeholders in the PR template for these items.
Thanks a lot!
Hi @Suyog241005! Thanks a lot for your contribution!
I noticed that the following required information is missing or incomplete: kind of change description
Please update the PR description to include this information. You can find placeholders in the PR template for these items.
Thanks a lot!
Hi @Suyog241005! Thanks a lot for your contribution!
I noticed that the following required information is missing or incomplete: kind of change description
Please update the PR description to include this information. You can find placeholders in the PR template for these items.
Thanks a lot!
built with Refined Cloudflare Pages Action
⚡ Cloudflare Pages Deployment
| Name | Status | Preview | Last Commit |
|---|---|---|---|
| website | ✅ Ready (View Log) | Visit Preview | 5911b7cc5115f74fd05b505b732a08c0aa9d2a6b |
Codecov Report
:x: Patch coverage is 50.72464% with 34 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 95.15%. Comparing base (4e1e90a) to head (5911b7c).
:warning: Report is 16 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| components/TableOfContents.tsx | 50.72% | 34 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1872 +/- ##
===========================================
- Coverage 100.00% 95.15% -4.85%
===========================================
Files 30 31 +1
Lines 633 702 +69
Branches 196 219 +23
===========================================
+ Hits 633 668 +35
- Misses 0 34 +34
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Hey @Suyog241005 , for creating this pull request, have you removed some code or changed test behavior. If yes, please make sure your added code should coverage reports are uploaded correctly, means base and head might differ — e.g., missing reports, mismatched paths.
Hi @jagpreetrahi ! Thanks for the feedback.
Regarding the code coverage:
The new TableOfContents.tsx component currently doesn't have unit tests. I wanted to get feedback on the implementation approach first before writing tests.
I'm happy to add tests to improve coverage. Would you like me to add:
- Unit tests for the component rendering
- Tests for heading detection logic
- Tests for Intersection Observer behavior
- Tests for click/scroll interactions
Or should I wait for the implementation to be approved first, then add tests?
Let me know what you prefer and I'll be happy to add comprehensive test coverage!
@Utkarsh-123github what should we does here??
@jagpreetrahi It's been a while since this PR was opened.
Let me know if there's anything specific you’d like me to adjust or any tests/design changes needed to move this forward.