2023-03-15 21:56:54 +03:00
|
|
|
export function toc() {
|
2024-01-30 03:22:03 +03:00
|
|
|
if (document.querySelector('main h2, main h3')) {
|
2023-03-31 00:05:33 +03:00
|
|
|
// see: https://github.com/tscanlin/tocbot#usage
|
|
|
|
tocbot.init({
|
|
|
|
tocSelector: '#toc',
|
2023-09-08 17:48:37 +03:00
|
|
|
contentSelector: '.content',
|
2023-03-31 00:05:33 +03:00
|
|
|
ignoreSelector: '[data-toc-skip]',
|
2023-09-03 15:20:14 +03:00
|
|
|
headingSelector: 'h2, h3, h4',
|
2023-03-31 00:05:33 +03:00
|
|
|
orderedList: false,
|
|
|
|
scrollSmooth: false
|
|
|
|
});
|
2024-04-28 22:36:16 +03:00
|
|
|
|
|
|
|
document.getElementById('toc-wrapper').classList.remove('d-none');
|
2023-03-31 00:05:33 +03:00
|
|
|
}
|
2023-03-15 21:56:54 +03:00
|
|
|
}
|