-
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
move most options to Hooks #1878
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/markedjs/markedjs/1q7bppk1q |
I'm all for more extendability. This seems fine to me, just skimming through, but maybe you @UziTech could help me understand better what this does differently than the existing |
For one it adds more opportunities suggested for extensibility in #1232 (comment) (namely The current highlight and sanitizer are overwritten if multiple extensions provide one. Also it provides a better way than using options like |
A middleware style would be interesting.... Would that be more performant too? |
Seems like marked is undergoing a lot of internal changes atm. Would now be good time to tackle async renderers (#458) or would it be better to wait until this is finished? |
It would be a great time to tackle async renderers. This PR is mostly a proof of concept. Sort of to flesh out the idea and see what problems we run into. |
want the lifecycle hooks badly. currently working on an extension that needs cleanup work: https://github.com/huaichaow/marked-toc-extension/blob/main/src/index.ts @UziTech can we prioritize this PR? |
@huaichaow ya I think the preprocess and postprocess hooks would be the most beneficial I'll start with just those. I'll try to get a PR for that this week. |
@huaichaow I'm not completely done with it but #2730 is what I am thinking. Feel free to review it and leave comments. |
Description
Move most options to Hooks.
This PR might not get merged until v3 but I wanted to throw it out there and see what people think.
The idea behind this is to add a way for extensions to hook into different parts of marked to do things like (sanitizing, escaping, highlighting, etc.) and allowing us to move a lot of the options to extensions.
Example:
TODO