Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Implement a TOC component #1127

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

techmannih
Copy link
Contributor

What kind of change does this PR introduce?
This PR introduces a new Table of Contents (TOC) component to improve the navigation within long documentation pages. It parses the markdown content and dynamically generates a list of links to the headers, making it easier for users to navigate the page

Issue Number:

@techmannih techmannih requested a review from a team as a code owner November 19, 2024 11:51
@techmannih
Copy link
Contributor Author

techmannih commented Nov 20, 2024

@valeriahhdez @Kalevins
We need to discuss the documentation sections for the following endpoints:

/implementers/interfaces
/understanding-json-schema/reference/annotations
/understanding-json-schema/reference/comments
/understanding-json-schema/reference/enum
/understanding-json-schema/reference/const
/understanding-json-schema/reference/null
/understanding-json-schema/reference/boolean
/understanding-json-schema/reference/type

Currently, there is no heading for these sections in the docs. Also, for the Table of Contents (TOC), can we include the titles of the page sections, or is there a better way to organize them? Let’s discuss how we can improve the structure and add appropriate headings and TOC elements.

@techmannih
Copy link
Contributor Author

@valeriahhdez Please review this PR

@valeriahhdez
Copy link
Contributor

Hi @techmannih,

I'm not sure I understand what you mean by "there's no heading for these sections in the docs". Can you please expand on that?

@techmannih
Copy link
Contributor Author

@valeriahhdez I mean, for these points, there is no heading and content available that can be added in TOC. In toc, we are adding heading

@valeriahhdez
Copy link
Contributor

Summary of our Slack discussion:

  • The endpoints' content lacks headings and therefore the TOC is empty when generated.
  • The documentation team will edit this documentation and reorganize its content by headings. This will improve the readers' experience by making it easier to scan and find information.
  • Editing the documentation is outside the scope of this PR, so we will create a separate issue for the task.

@valeriahhdez
Copy link
Contributor

Hi @DhairyaMajmudar, can you please help us review this PR?

@DhairyaMajmudar DhairyaMajmudar self-requested a review December 13, 2024 01:17
@DhairyaMajmudar
Copy link
Member

@techmannih pls. fix the failing ci

@techmannih techmannih force-pushed the TOC branch 2 times, most recently from 40ce79a to 54c355a Compare December 15, 2024 12:53
Copy link

github-actions bot commented Dec 16, 2024

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview 870ce15

@techmannih
Copy link
Contributor Author

@DhairyaMajmudar, I have fixed the lint errors. Only the type-checking workflow is still giving an error.

Copy link
Collaborator

@benjagm benjagm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @techmannih . At first look, it seems that you are repeating the same structure again and again in all pages, all with a lot of repeated code an static code. This is a typical scenario where is better to think about creating a standard component to make all this process much easier.

Check for the Layout.tsx component used to build the layouts. Maybe you can do this by default there.

What do you think?

Copy link

codecov bot commented Dec 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8676fc2) to head (870ce15).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1127   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          373       373           
  Branches        94        94           
=========================================
  Hits           373       373           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@techmannih
Copy link
Contributor Author

techmannih commented Dec 21, 2024

Yes @benjagm , I am following the previous TOC that was built for the blog pages. Please check this one.

And yes, I am using "on this page" in a static manner, which is being resolved now. I think you might have seen this in a static way because there are a lot of files, and each section has a separate YAML file. For blog pages, there's only one file, and all the YAML files are rendered within it.

But for the documentation, we are using separate files for each section. The TOC is already created; as per my understanding, I am just integrating it into each section

@benjagm
Copy link
Collaborator

benjagm commented Dec 27, 2024

I am following the previous TOC that was built for the blog pages. Please check this one.

My expectation with this PR is to avoid having to add the TOC to every single page. Instead, it would be great having it generated automatically at the layout level the same way we have the sidebar automatically generated.

Copy link
Collaborator

@benjagm benjagm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My expectation with this PR is to avoid having to add the TOC to every single page. Instead, it would be great having it generated automatically at the layout level the same way we have the sidebar automatically generated.

@techmannih
Copy link
Contributor Author

@benjagm Absolutely agree! Having the TOC automatically generated at the layout level would save a lot of time and ensure consistency. I will implement

@benjagm
Copy link
Collaborator

benjagm commented Jan 7, 2025

H i @techmannih . How is it going with the requested changes? Do you need help or advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[📝 Docs]: Implement a TOC component
4 participants