-
Notifications
You must be signed in to change notification settings - Fork 921
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
Build the right-side table of contents from javascript #1049
base: main
Are you sure you want to change the base?
Conversation
Exciting! Can't wait for this! |
Thanks @jmichelgarcia, glad you like it! |
@fekete-robert would you be willing to rebase this against main? If you're not sure what that means, reply here and someone who does know how may be able to make time to guide you through that. |
b78d1df
to
99eacb0
Compare
😕 @fekete-robert did you mean to close this PR? |
Uses the https://tscanlin.github.io/tocbot/ library to build the sidebar toc if the following is set in your config.toml file: [params.jstoc] enable = true Note that by default, h2-h4 headings are included in the toc. To change that, provide a comma-separated list of headings like this: [params.jstoc] enable = true custom_headings = "h2, h3" custom_headings = "h2, h3" Compared to the default sidebar toc, this solution has the following benefits: - a marker shows the current location of the screen (useful for long pages) - shows the correct title even if the title contains a shortcode - shows the title in the toc even if it was included from another file
Hi @sftim, sorry I didn't intend to close it, just messed something up during the rebase. |
Should be ok now |
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.
I think in place of static/js/tocbot.min.js
we should import the unminified source, including a comment about its provenance.
My understanding is that Hugo can invoke a minifier as needed.
userguide/static/images/sidebar-toc-with-tocbot.png
doesn't seem to show any highlight.
@sftim : The highlighting is not very visible on the screenshot, because not the entire title is highlighted, just the section of the vertical splitbar next to the title. It's more apparent when you are actually scrolling on the page. |
How are we honoring the tocbot LICENSE? |
Tocbot is MIT-licensed which AFAIK permits free use - is there anything we
should do?
…On Tue, Oct 18, 2022 at 4:33 PM Tim Bannister ***@***.***> wrote:
How are we honoring the tocbot LICENSE?
—
Reply to this email directly, view it on GitHub
<#1049 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6AU3PZ3AC7ZMCEUZ6JZN3WD2YLDANCNFSM5Y3GHUZQ>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
BTW, many thanks for the thorough review!
On Tue, Oct 18, 2022 at 4:38 PM Robert Fekete ***@***.***>
wrote:
… Tocbot is MIT-licensed which AFAIK permits free use - is there anything we
should do?
On Tue, Oct 18, 2022 at 4:33 PM Tim Bannister ***@***.***>
wrote:
> How are we honoring the tocbot LICENSE?
>
> —
> Reply to this email directly, view it on GitHub
> <#1049 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AA6AU3PZ3AC7ZMCEUZ6JZN3WD2YLDANCNFSM5Y3GHUZQ>
> .
> You are receiving this because you modified the open/close state.Message
> ID: ***@***.***>
>
|
Hi, @fekete-robert. Thank you for your work and the update! This is a better and complete solution for the ToC feature.🙂 Although using the original tocbot code itself is allowed by MIT License, it also requires including the original MIT License in the copied code (please refer to the original Also, I'd recommend including the original URL and tocbot version so that we can easily track the version and refer to it during a future update. |
@shuuji3 Many thanks for spotting that, I've added the licenses and updated the js/css to use a newer version (4.21.0) |
Co-authored-by: chulcher <[email protected]>
I still have hope that this will get merged one day. 🥇 |
Me too. I realize that this PR pulls in tocbot.min.js from |
By default, Docsy shows the table of contents for the current page in the right sidebar using the built-in function of Hugo. You can replace that with a JavaScript-based ToC that uses the [https://tscanlin.github.io/tocbot/](Tocbot library) by setting the following in your
config.toml
file:Compared to the default sidebar ToC, this solution:
For a working example, see https://kube-logging.dev/docs/