markdown-it-table-of-contents
Version:
A Markdown-it plugin for adding a table of contents to markdown documents
14 lines (13 loc) • 527 B
HTML
<!-- omit from toc -->
<h1>An article</h1>
<p>some text with hard break before toc</p>
<div class="table-of-contents"><ul><li><ul><li><a href="#sub-heading-1">Sub heading 1</a></li><li><a href="#sub-heading-2">Sub heading 2</a></li></ul></li><li><a href="#next-h1-section">Next h1 Section</a></li></ul></div>
<h2>Sub heading 1</h2>
<p>Some nice text</p>
<h2>Sub heading 2</h2>
<p>Some even nicer text</p>
<!-- omit from toc -->
<h2>Sub heading 3</h2>
<p>Ignore this heading in TOC</p>
<h1>Next h1 Section</h1>
<p>More text</p>