markdown-it-table-of-contents
Version:
A Markdown-it plugin for adding a table of contents to markdown documents
10 lines (9 loc) • 743 B
HTML
<h1 id="an-article">An article</h1>
<p>some text with soft break before toc</p>
<div class="table-of-contents"><ul><li><a href="#an-article">An article</a><ul><li><a href="#sub-heading-%3Cspan%3E1%3C%2Fspan%3E">Sub heading <span>1</span></a></li><li><a href="#sub-heading-2">Sub heading 2</a></li><li><a href="#3.2.-test-%2F-with%3B-special-characters">3.2. Test / with; special characters</a></li></ul></li></ul></div>
<h2 id="sub-heading-%3Cspan%3E1%3C%2Fspan%3E">Sub heading <span>1</span></h2>
<p>Some nice text</p>
<h2 id="sub-heading-2">Sub heading 2</h2>
<p>Some even nicer text</p>
<h2 id="3.2.-test-%2F-with%3B-special-characters">3.2. Test / with; special characters</h2>
<p>Let's test special characters</p>