mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-11-30 19:20:06 +08:00
Added filtering in sidebar for ignoreSubHeading
This commit is contained in:
parent
25e3cac66a
commit
fd4a42c3b5
@ -329,13 +329,17 @@ export class Compiler {
|
||||
* Compile sidebar
|
||||
*/
|
||||
sidebar(text, level) {
|
||||
const {toc} = this
|
||||
const currentPath = this.router.getCurrentPath()
|
||||
let html = ''
|
||||
|
||||
if (text) {
|
||||
html = this.compile(text)
|
||||
} else {
|
||||
const tree = this.cacheTree[currentPath] || genTree(this.toc, level)
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--
|
||||
}
|
||||
const tree = this.cacheTree[currentPath] || genTree(toc, level)
|
||||
html = treeTpl(tree, '<ul>{inner}</ul>')
|
||||
this.cacheTree[currentPath] = tree
|
||||
}
|
||||
@ -360,7 +364,6 @@ export class Compiler {
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--
|
||||
}
|
||||
|
||||
const tree = cacheTree[currentPath] || genTree(toc, level)
|
||||
|
||||
cacheTree[currentPath] = tree
|
||||
|
Loading…
Reference in New Issue
Block a user