Skip to content

Commit

Permalink
Updated to remove all headers under it
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcambose authored and timaschew committed Apr 23, 2019
1 parent 6cc069c commit 78f5564
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/render/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,15 @@ export class Compiler {
html = this.compile(text)
} else {
for (let i = 0; i < toc.length; i++) {
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--
if (toc[i].ignoreSubHeading) {
const deletedHeaderLevel = toc[i].level
toc.splice(i, 1)
// Remove headers who are under current header
for (let j = i; deletedHeaderLevel < toc[j].level && j < toc.length; j++) {
toc.splice(j, 1) && j-- && i++
}
i--
}
}
const tree = this.cacheTree[currentPath] || genTree(toc, level)
html = treeTpl(tree, '<ul>{inner}</ul>')
Expand Down

0 comments on commit 78f5564

Please sign in to comment.