valeriangalliat / markdown-it-anchor

A markdown-it plugin that adds an `id` attribute to headings and optionally permalinks.
The Unlicense
291 stars 72 forks source link

Feature request: make start index configurable #74

Closed adamsoffer closed 3 years ago

adamsoffer commented 4 years ago

I noticed the index of anchors ids starts at index 2. It would be great if this start index could be configurable. My use case is that I'm usingmarkdown-toc which uses the same naming conventions for anchors but starts at 1.

valeriangalliat commented 3 years ago

Hey! That a good use case, I just released 6.0.0 with a uniqueSlugStartIndex option to configure that.

I also made the default 1 (which is why I bumped a major) because since it seems to be the default in most other packages (and on GitHub itself) I think it's probably a more sensible default than 2.

Cheers!

adamsoffer commented 3 years ago

Nice! Thanks @valeriangalliat