sidebar(text, level) {
    const { toc } = this;
    const currentPath = this.router.getCurrentPath();
    let html = '';

    // compile sidebar from _sidebar.md
    if (text) {
      return this.compile(text);
    }
    // compile sidebar from content's headings toc
    for (let i = 0; i < toc.length; i++) {
      if (toc[i].ignoreSubHeading) {
        const deletedHeaderLevel = toc[i].depth;
        toc.splice(i, 1);
        // Remove headers who are under current header
        for (
          let j = i;
          j < toc.length && deletedHeaderLevel < toc[j].depth;
          j++
        ) {
          toc.splice(j, 1) && j-- && i++;
        }

        i--;
      }
    }

    const tree = this.cacheTree[currentPath] || genTree(toc, level);
    html = treeTpl(tree);
    this.cacheTree[currentPath] = tree;
    return html;
  }
Compile sidebar, it uses _sidebar.md (or specific file) or the content's headings toc to render sidebar.
@param {String} text Text content from the sidebar file, maybe empty
@param {Number} level Type of heading (h<level> tag)
@returns {String} Sidebar element