Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set slugStartIndex #41

Merged
merged 6 commits into from
Nov 19, 2020
Merged

Add option to set slugStartIndex #41

merged 6 commits into from
Nov 19, 2020

Conversation

ErikMichelson
Copy link
Contributor

@ErikMichelson ErikMichelson commented Oct 10, 2020

Note: This PR is based on #39, which should be merged prior to this one. (done)

This PR adds the option slugStartIndex that allows to define a custom number to start the counting of suffixes for duplicate headings.

If #40 is merged before this, I will add the change in types of course with this PR too. (done)

Breaking: This PR sets the default value for slugStartIndex to 1 to be compatible with markdown-it-anchor v6 out of the box.

Example:

# heading
# heading

will now result in something like this (note the suffix "-1" instead of "-2").

<!-- this is only a snippet -->
<nav>
<ul>
<li><a href="#heading">heading</a></li>
<li><a href="#heading-1">heading</a></li>
</ul>
</nav>

Fixes #38

@mrdrogdrog
Copy link

Are there any news? We need this change (and a release) for hedgedoc/react-client#642 :/

@mrdrogdrog
Copy link

@nagaozen Please let us know if you have time to review the open PRs and create a new release. We need this fixes. If you don't have time, then let us know and we'll fork the project to apply the PRs ourself.

@nagaozen
Copy link
Owner

@mrdrogdrog Sincerely apologize, I'll take a look tonight. This project is tightly coupled with markdown-it-anchor so I'll review both packages and release'em.

@nagaozen nagaozen merged commit e2fd920 into nagaozen:master Nov 19, 2020
@nagaozen
Copy link
Owner

i'd to update the name of the option to uniqueSlugStartIndex to follow the markdown-it-anchor options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

markdown-it-anchor released 6.0.0 and the startIndex of unique slug changed to 1
3 participants