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

Introduce slugifyWithState to avoid breaking change with slugify second argument #134

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

valeriangalliat
Copy link
Owner

#125 is a good suggestion but I'm worried some users pass directly some slugification modules as slugify argument e.g. one could do:

const slugify = require('@sindresorhus/slugify')

const md = require('markdown-it')()
  .use(require('markdown-it-anchor'), { slugify })

And @sindresorhus/slugify takes an optional options object as second argument. Adding state as second argument would break that.

While it's not the way I recommend using it (the readme specifies doing { slugify: s => slugify(s) }), I'd rather avoid risking a breaking change.

So this refactors #125 to 1. pass the whole state instead of state.env so people can do whatever they want with the whole thing, and 2. put this in a slugifyWithState option to avoid a potential breaking change.

@valeriangalliat valeriangalliat merged commit bfa8b79 into master Aug 24, 2024
@valeriangalliat valeriangalliat deleted the slugify-with-state branch August 24, 2024 23:10
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.

1 participant