From 136ef2881eacb500497a536854b1883a4eb0ac30 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sun, 27 Nov 2016 13:35:31 +0800 Subject: [PATCH] bump 0.3.0 --- lib/docsify.js | 17 ++++++++++------- lib/docsify.min.js | 2 +- lib/themes/buble.css | 1 + lib/themes/pure.css | 1 + lib/themes/vue.css | 1 + 5 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 lib/themes/buble.css create mode 100644 lib/themes/pure.css create mode 100644 lib/themes/vue.css diff --git a/lib/docsify.js b/lib/docsify.js index 18d0e86..f77b9c3 100644 --- a/lib/docsify.js +++ b/lib/docsify.js @@ -2114,7 +2114,7 @@ Prism.languages.js = Prism.languages.javascript; /** * @link from https://github.com/killercup/grock/blob/5280ae63e16c5739e9233d9009bc235ed7d79a50/styles/solarized/assets/js/behavior.coffee#L54-L81 */ -var tocToTree = function (toc) { +var tocToTree = function (toc, maxLevel) { var headlines = []; var last = {}; @@ -2122,6 +2122,7 @@ var tocToTree = function (toc) { var level = headline.level || 1; var len = level - 1; + if (level > maxLevel) { return } if (last[len]) { last[len].children = last[len].children || []; last[len].children.push(headline); @@ -2149,10 +2150,9 @@ var buildHeadlinesTree = function (tree, tpl) { return tpl }; -var genToc = function (toc) { - var tree = tocToTree(toc); - var result = buildHeadlinesTree(tree, '