Add GitHub style anchor tags to headers
npm install markdown-it-github-headings
var md = require('markdown-it')() .use(require('markdown-it-github-headings'), options)
The defaults will make the heading anchors behave as close to how GitHub behaves as possible.
|name of the class that will be added to the anchor tag|
|add a prefix to each heading ID. (see security note below)|
|Adds the icon next to each heading|
|reset the slugger counter between .render calls for duplicate headers. (See tests for example)||true|
If you have full control over the content, there is less of a risk, but be aware that strange bugs related to DOM Clobbering are still possible!
For more information, here are some good resources on the topic:
Check out marky-deep-links for an example (works great with browserify or webpack).
Contributions welcome! Please read the contributing guidelines first.