medfreeman / markdown-it-toc-and-anchor

markdown-it plugin to add a toc and anchor links in headings
MIT License
60 stars 35 forks source link

feat: add `anchorLinkPrefix` option #27

Closed ruanyf closed 5 years ago

ruanyf commented 7 years ago

Allows you to add a prefix to the generated header ids, e.g. section-.

markdownIt().use(markdownItTocAndAnchor, {
  anchorLinkPrefix: 'section-'
}).render('# hello world')

//  <h1 id="section-hello-world">
//    <a class="markdownIt-Anchor" href="#section-hello-world">#</a>
//     hello world
//  </h1>'