documentation icon indicating copy to clipboard operation
documentation copied to clipboard

[ Bug report ] Allow linkable headers inside Tabs

Open lorensr opened this issue 3 years ago • 3 comments

Required

What is the issue?

Non-Go (default lang) h4s in the app dev guide aren't linkable.

What is the expected behavior?

Linkable.

Solutions

Two solutions that come to mind are:

  1. Different pages with different default (SSRed) langs, like docs.temporal.io/typescript/guide has TypeScript tab default selected.
  2. Rendering all langs on the page at once, and an onload script that changes lang if the hash isn't currently visible? The page would be pretty large and not sure how complex the script would be.

Related issues

Being able to link to an h3 section with a particular lang preselected. (Would be enabled by Solution 1)

Additional context (optional—the more we know, the faster it goes)

Screenshots:

image

lorensr avatar Jun 06 '22 16:06 lorensr

Linking this issue from Docusaurus. It is related by the fact that we can't link directly to tabbed content.

If this is fixed, we may add the ability to link to h4 nested in another tab.

rachfop avatar Jun 10 '22 15:06 rachfop

The app dev guide does support h4s. You just can't have the h4s in the source content - if the source content is going to be tabulated. The reason is because Docusaurus builds all of the h4s from each tab into the toc - which then makes some of the links in the toc unusable depending on the selected tab.

But that feels like a completely separate issue from being able to link to a selected tab - which I think would be a great feature. And it seems like @lorensr is making progress on that one with the framework.

flossypurse avatar Jun 11 '22 15:06 flossypurse

Changed the issue title to Allow linkable headers inside Tabs. h5s are fine, and don't appear in TOC, but they're not linkable—when I open

http://localhost:3000/application-development-guide/?lang=typescript#testh5-1

in branch h4, the browser stays at the top of the screen, unless the heading is in a Go Tab (the first Tab, which is displayed first, before the ?lang=typescript is processed and the tab is changed).

So in order for them to be linkable, I think the selected tab would need to SSRed. That may be implemented upstream as part of https://github.com/facebook/docusaurus/issues/7008

lorensr avatar Jun 30 '22 01:06 lorensr