diff --git a/make-example.js b/make-example.js index cf3916d7..0c0d199f 100644 --- a/make-example.js +++ b/make-example.js @@ -28,7 +28,8 @@ var siteConfig = { // we get an error without this, here, though "steal-stache": "^4.0.1", "steal-conditional": "^0.3.6", - "bit-docs-html-codepen-link": "^1.0.0" + "bit-docs-html-codepen-link": "^1.0.0", + "bit-docs-html-toc": "^1.1.1" }, staticDist: [ path.join(__dirname, "dist", "static") diff --git a/static/canjs.js b/static/canjs.js index ef6f5782..2f1c79de 100644 --- a/static/canjs.js +++ b/static/canjs.js @@ -156,6 +156,18 @@ function init() { sidebarViewModel.selectedPageName = window.docObject.name; } + // Set up the client-side TOC + var tocContainer = document.querySelector("#scroll-toc"); + var oldToc = document.querySelector("bit-toc"); + if (oldToc) { + tocContainer.removeChild(oldToc); + } + var newToc = document.createElement("bit-toc"); + newToc.depth = window.docObject.outline; + newToc.headingContainerSelector = "#right > article"; + newToc.scrollSelector = "#scroll-toc"; + tocContainer.appendChild(newToc); + hasShownSearch = true; } diff --git a/templates/content.mustache b/templates/content.mustache index 2639f860..728eded9 100644 --- a/templates/content.mustache +++ b/templates/content.mustache @@ -22,4 +22,6 @@ {{/with}} +
+