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

Pass env to `slugify` #125

Closed Kaciras closed 2 weeks ago

Kaciras commented 1 year ago

Make it possible to prefix slugs differently in each render

shynome commented 3 months ago

want this too

valeriangalliat commented 3 months ago

I was thinking of passing the whole state param instead so this gives access to not only env but any other thing interesting in there... not sure if that makes sense

What do you use from state.env that you want to access from the slugify function?

shynome commented 3 months ago

want add prefix post.id

valeriangalliat commented 2 weeks ago

Cool, sorry for the delay - I just refactored this to pass the whole state instead of just env, so you can do state.env, and I put it in an alternative option slugifyWithState to avoid a possible breaking change with slugify

It's live with 9.1.0!