markdown-it-table-of-contents
Version:
A Markdown-it plugin for adding a table of contents to markdown documents
8 lines (7 loc) • 516 B
HTML
<h1 id="my-article">Article</h1>
<p>Using custom heading id attributes via markdown-it-attrs.</p>
<div class="table-of-contents"><ul><li><a href="#my-article">Article</a><ul><li><a href="#section-1">Welcome to the show</a></li><li><a href="#this-has-no-custom-id">This has no custom id</a></li></ul></li></ul></div>
<h2 id="section-1">Welcome to the show</h2>
<p>Note the anchor targets for TOC links.</p>
<h2>This has no custom id</h2>
<p>The headline above falls back to the slugify function as anchor target.</p>