web/_javascript/modules/components/toc.js
2023-03-31 05:05:33 +08:00

13 lines
371 B
JavaScript

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