growella/table-of-contents

Nested tables of contents

Opened this issue · 0 comments

Ideally, the plugin will be able to generate nested lists that follow the document outline.

<h2>Top-level heading</h2>
<h3>Sub-heading</h3>
<h4>Sub-sub-heading</h4>
<h3>Second sub-heading</h3>
<h2>Another heading</h2>

Given that post content, we should be capable of generating a list that looks like this:

  • Top-level heading
    • Sub-heading
      • Sub-sub-heading
    • Second sub-heading
  • Another heading

Just how deep the nested list goes would depend on two things: the available tags (H1 > H2 > H3 > H4 > H5 > H6) and the reserved-but-as-of-yet-unused depth shortcode attribute.