Added filtering in sidebar for ignoreSubHeading
This commit is contained in:
parent
d355272461
commit
6cc069cb9f
1 changed files with 5 additions and 2 deletions
|
|
@ -329,13 +329,17 @@ export class Compiler {
|
||||||
* Compile sidebar
|
* Compile sidebar
|
||||||
*/
|
*/
|
||||||
sidebar(text, level) {
|
sidebar(text, level) {
|
||||||
|
const {toc} = this
|
||||||
const currentPath = this.router.getCurrentPath()
|
const currentPath = this.router.getCurrentPath()
|
||||||
let html = ''
|
let html = ''
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
html = this.compile(text)
|
html = this.compile(text)
|
||||||
} else {
|
} 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>')
|
html = treeTpl(tree, '<ul>{inner}</ul>')
|
||||||
this.cacheTree[currentPath] = tree
|
this.cacheTree[currentPath] = tree
|
||||||
}
|
}
|
||||||
|
|
@ -360,7 +364,6 @@ export class Compiler {
|
||||||
for (let i = 0; i < toc.length; i++) {
|
for (let i = 0; i < toc.length; i++) {
|
||||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--
|
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--
|
||||||
}
|
}
|
||||||
|
|
||||||
const tree = cacheTree[currentPath] || genTree(toc, level)
|
const tree = cacheTree[currentPath] || genTree(toc, level)
|
||||||
|
|
||||||
cacheTree[currentPath] = tree
|
cacheTree[currentPath] = tree
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue