Skip to content

Commit

Permalink
fix(deps): tocbot has no initialization detection (#957)
Browse files Browse the repository at this point in the history
Resolves #957
  • Loading branch information
cotes2020 committed Mar 30, 2023
1 parent 8b4f99c commit 8225174
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions _javascript/modules/components/toc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
export function toc() {
// 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
});
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
});
}
}

0 comments on commit 8225174

Please sign in to comment.