web/_javascript/modules/components/toc.js
2023-09-08 22:48:37 +08:00

13 lines
344 B
JavaScript

export function toc() {
if (document.querySelector('main h2')) {
// 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
});
}
}