JS-DevTools / rehype-toc

A rehype plugin that adds a table of contents (TOC) to the page

Home Page:https://jstools.dev/rehype-toc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide empty table of contents by default

ZachSaucier opened this issue · comments

Currently you can customize the installation to hide the table of contents if there are no items by doing this:

customizeTOC: (toc) => {
  if (toc.children[0].children.length > 0) {
    return toc;
  }
  return false;
},

I think this should be default functionality! 🙂