initial commit
This commit is contained in:
15
_javascript/modules/components/toc.js
Normal file
15
_javascript/modules/components/toc.js
Normal file
@@ -0,0 +1,15 @@
|
||||
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
|
||||
});
|
||||
|
||||
document.getElementById('toc-wrapper').classList.remove('d-none');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user