Markdown table of contents generator.
npm install mdtocs



Markdown table of contents generator:
```
mdtocs(string)
This library uses regex to parse Markdown headings. As a result, edge cases like headings with links and images won't be generated correctly. Inspired by the blog post.
#### Example
`js`
const { mdtocs } = require('mdtocs');
mdtocs('# Hello, World!'); // '- Hello, World!'
NPM:
`sh`
npm install mdtocs --save
Yarn:
`sh`
yarn add mdtocs
CDN:
`html`
Import with ES Modules:
`js`
import { mdtocs } from 'mdtocs';
Or require with CommonJS:
`js`
const { mdtocs } = require('mdtocs');
Generate table of contents from Markdown:
`js
mdtocs(
);
`Output:
`md
- Heading 1
- Heading 2
- Heading 3
`If the first argument is not a string, then an error will be thrown:
`js
mdtocs(); // TypeError: First argument must be a string
`Testing
Run tests with coverage:
`sh
npm test
`Run tests in watch mode:
`sh
npm run test:watch
`Lint files:
`sh
npm run lint
`Fix lint errors:
`sh
npm run lint:fix
``Release is automated with Release Please.