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

NFR: Only show its own tab's TOC when there are headings in tabs #1191

Closed
sxhuan opened this issue Jan 6, 2023 · 7 comments · Fixed by #2199
Closed

NFR: Only show its own tab's TOC when there are headings in tabs #1191

sxhuan opened this issue Jan 6, 2023 · 7 comments · Fixed by #2199
Assignees
Labels
enhancement New feature or request

Comments

@sxhuan
Copy link

sxhuan commented Jan 6, 2023

Request

If we can show the anchors owned by each tab only, I think it would be more make sense.
or, keep the current design - show all tabs anchors together but need support switch tab automatically while clicking the anchors which do not belong current tab.

Reproduce

eg. I have 3 tabs with their own anchors, if I click the anchor, not in the current tab nothing happened, it's confusing.

Screenshot 2023-01-05 at 4 26 47 PM

Using version

  • nextra 2.0.1
@shuding
Copy link
Owner

shuding commented Jan 6, 2023

This is an interesting question! I kinda think that headings inside tabs shouldn't be part of the ToC at all. Because the structure of a MD document should be static, and shaped like a tree.

@sxhuan
Copy link
Author

sxhuan commented Jan 6, 2023

From a practical perspective or scenario, IMO, I like the way only shows the current tabs anchor.
here is an example from Atlassian

@dionysuzx
Copy link

dionysuzx commented Jun 28, 2023

I believe this is a useful feature to have. Mainly because sometimes you want to abstract away certain parts of a MD document and only show what is necessary for the tab the reader is interested in. An example of how we use this is here: https://taiko.xyz/docs/guides/deploy-a-contract. The alternative is separate markdown documents or a longer one which "leaks" the abstraction a bit to the reader.

So just leaving my vote here for this feature!

@dimaMachina
Copy link
Collaborator

since these headings are in tabs which inside dynamic component we need to hide them

@ElementalCrisis
Copy link

I understand the reasoning behind hiding them as it was a bug but I do think having the option to show the correct headers for the selected Tab, like how Atlassian does it would also be a nice alternative.

@dimaMachina
Copy link
Collaborator

Atlassian has a different approach, each tab is a page with generated tocs, in nextra tabs are components inside page

In Atlassian when you click on tab pathname changes accordingly

@ElementalCrisis
Copy link

Ah I see, thanks for the clarification!

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

Successfully merging a pull request may close this issue.

5 participants