mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-19 14:14:17 +00:00
feat: change TOC plugin to tocbot (#774)
This commit is contained in:
11
_javascript/modules/components/toc.js
Normal file
11
_javascript/modules/components/toc.js
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
});
|
||||
}
|
||||
@@ -4,3 +4,4 @@ export { imgExtra } from './components/img-extra';
|
||||
export { initLocaleDatetime } from './components/locale-datetime';
|
||||
export { initPageviews } from './components/pageviews';
|
||||
export { smoothScroll } from './components/smooth-scroll';
|
||||
export { toc } from './components/toc';
|
||||
|
||||
@@ -4,7 +4,8 @@ import {
|
||||
initLocaleDatetime,
|
||||
initClipboard,
|
||||
smoothScroll,
|
||||
initPageviews
|
||||
initPageviews,
|
||||
toc
|
||||
} from './modules/plugins';
|
||||
|
||||
basic();
|
||||
@@ -13,5 +14,6 @@ initTopbar();
|
||||
imgExtra();
|
||||
initLocaleDatetime();
|
||||
initClipboard();
|
||||
smoothScroll();
|
||||
toc();
|
||||
smoothScroll(); // must be called after toc is created
|
||||
initPageviews();
|
||||
|
||||
Reference in New Issue
Block a user