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

Feat:708 Remove ToC when one or less elements #710

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

Conversation

Jainex17
Copy link

@Jainex17 Jainex17 commented Apr 7, 2025

fixes: #708

before:
image

After:
wsScreenshot 2025-04-07 184426

Action:

  • In the code for getting the Table of Contents (TOC), we are calling a function twice:
  • If the TOC is found on the first call, it will display normally.
  • If the TOC length is 0 on the first call, we remove the TOC button and adjust the positions of the other buttons.
  • If the TOC is found on the second call, the TOC button will reappear.
  • If the TOC is not found in both calls, the TOC button remains removed, and the other buttons stay adjusted.

Note: There is another way to solve this by adjusting the entire navigation based on the TOC value, but it would require too many code changes in the repo. So, I went with this solution instead. If there's anything wrong, please let me know. Thanks

@Jainex17
Copy link
Author

Jainex17 commented Apr 8, 2025

@Jaifroid could you please take a look at this PR. Thanks

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.

Remove ToC when one or less elements
1 participant