Skip to content

I want the toc to be initially all unfolded without any animation effects. #1616

Closed Answered by kungfux
jeongHwarr asked this question in Q&A
Discussion options

You must be logged in to vote

It's a good question and this is doable.

Create a file _javascript\modules\components\toc.js with the following content to override default TOC bot configuration:

export function toc() {
    if (document.querySelector('main h2, main h3')) {
      // see: https://github.com/tscanlin/tocbot#usage
      tocbot.init({
        tocSelector: '#toc',
        contentSelector: '.content',
        ignoreSelector: '[data-toc-skip]',
        headingSelector: 'h2, h3, h4',
        orderedList: false,
        scrollSmooth: false,
        collapseDepth: 6,
      });
    }
  }

collapseDepth is the setting you are looking for:

// How many heading levels should not be collapsed.
// For example, number 6 wil…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by jeongHwarr
Comment options

You must be logged in to vote
5 replies
@kungfux
Comment options

kungfux Mar 18, 2024
Collaborator

@jeongHwarr
Comment options

@kungfux
Comment options

kungfux Mar 19, 2024
Collaborator

@jeongHwarr
Comment options

@kungfux
Comment options

kungfux Mar 20, 2024
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants