mdtocs: Markdown to Table of Contents


mdtocs is a Markdown table of contents generator.

This project was inspired by the blog post “Markdown Table of Contents Generator”.

Install

npm:

$ npm install mdtocs

Yarn:

$ yarn add mdtocs

UNPKG:

<script src="https://unpkg.com/[email protected]/umd/mdtocs.min.js"></script>
<script>
  window.mdtocs.mdtocs(/* string */);
</script>

Usage

const { mdtocs } = require('mdtocs');
mdtocs('# Hello, World!');

Output:

- [Hello, World!](#hello-world)

See README for more details.



Please support this site and join our Discord!