Skip to content

Commit

Permalink
fix(render): Toc rendering error, fixed #106
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Feb 28, 2017
1 parent 0aead89 commit 0d59ee9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/render/compiler.js
Expand Up @@ -106,8 +106,9 @@ export function sidebar (text, level) {
html = markdown(text)
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0]
} else {
const tree = genTree(toc, level)
const tree = cacheTree[currentPath] || genTree(toc, level)
html = treeTpl(tree, '<ul>')
cacheTree[currentPath] = tree
}

return html
Expand Down
2 changes: 1 addition & 1 deletion src/core/render/index.js
Expand Up @@ -75,7 +75,7 @@ export function renderMixin (proto) {

this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
const active = getAndActive('.sidebar-nav', true, true)
loadSidebar && subSidebar(active, subMaxLevel)
subSidebar(loadSidebar ? active : '', subMaxLevel)
// bind event
this.activeLink = active
scrollActiveSidebar()
Expand Down

0 comments on commit 0d59ee9

Please sign in to comment.