-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
NFE: add dry run capabilities to default slugger #1728
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/markedjs/markedjs/8t7vm3sc9 |
@UziTech I've made the changes you requested, the only thing I wasn't sure on was how you wanted the option documented in the code. I've added basic JSDoc but I can't see an example of it being used similarly anywhere else in the codebase so happy to take it out 👍 |
JSDoc works fine. Documentation in the code could definitely be better. |
Not that it has too and it would be good to know. Does this affect special characters and asian character sets as that's been a topic: #664 Or, is it specifically giving the ability for a developer to intervene and verify themselves?? In either case, I will approve but not merge as this one feels a bit deeper than my understanding at present. |
This code should not affect how the heading id is actually generated so there will be no deviation from default behaviour on that front.
Exactly, this option is all about giving control to the developer who, for whatever reason, may want to generate heading ids without incrementing the Slugger's seen counter. At the moment there is no way to generate the heading id without causing the Slugger to mutate that internal counter. |
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Tony Brix <tony@brix.ninja>
@styfle I've added the test you recommended and committed all outstanding suggestions 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
🎉 This PR is included in version 1.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Marked version: 1.1.0
Markdown flavor: n/a
Description
This PR adds a feature that allows the developer to use the default slugger without updating the internal accumulator. I have seen a use case for this when developers are implementing their own custom renderers. For example, see this function in the TC39 temporal-proposal repository. The changes made can be summarized as:
Contributor
Committer
In most cases, this should be a different person than the contributor.