diff --git a/lib/docsify.js b/lib/docsify.js index 0d43d523..0833b1d3 100644 --- a/lib/docsify.js +++ b/lib/docsify.js @@ -2141,7 +2141,7 @@ var buildHeadlinesTree = function (tree, tpl) { if (!tree || !tree.length) { return '' } tree.forEach(function (node) { - tpl += "
  • " + (node.title) + "
  • "; + tpl += "
  • " + (node.title) + "
  • "; if (node.children) { tpl += "
  • "; } @@ -2150,8 +2150,11 @@ var buildHeadlinesTree = function (tree, tpl) { return tpl }; -var genToc = function (toc, maxLevel) { - var tree = tocToTree(toc, maxLevel); +var genToc = function (toc, opts) { + var tree = Array.isArray(opts.sidebar) + ? opts.sidebar + : tocToTree(toc, opts['max-level']); + return buildHeadlinesTree(tree, '