-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Add separate on-page navigation sidebar #475
Conversation
@microbouji 😮 Yay! Does the new babel site use something similar to I like |
Yep. Only difference is at babel the left sidebar is fixed in place too. I thought that would be too big of a change for all docusaurus sites. Now that I think about it, it is behind an opt-in flag so it could work. Let me know what you think, if I should make the left sidebar fixed as well. |
@microbouji I am game for that as an opt-in option as well. When the PR is complete, I can pull it in and test it on the Docusaurus site -- or you can too as you are developing it. |
I made some minor fixes and this is ready to review now. Add the |
This looks really good! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
…log Post pages
Motivation
This is how the table of contents generated from the document's headers can be displayed as a separate sticky sidebar on the right side of the document. I can write the corresponding docs when we finalize on all the ways the navigation can be displayed through the option
onPageNav
. This is currently using'separate'
. The other possible values could befalse
for no on-page navigation, or'inline'
to have it show up underneath the current item's link in the existing sidebar similar to #349.As for the heading tags used to generate the TOC the default is same as this:
topLevel
andsub
can be strings like above or arrays of strings.sub
can also be a falsy value or empty array to indicate the user only needs top level headings.Another example:
This will collect all h2, h3, and h4 tags as top headings and generate no sub headings.
Test Plan
All css rules are only applied in browsers that support the css sticky position, and larger than 1024px screens. With this option on (
onPageNav: 'separate'
) the menu wrapper becomes wider site-wide. That's the only change that affects all the site. All other css changes only affect doc pages.Related PRs
#474