-
-
Notifications
You must be signed in to change notification settings - Fork 3
feat(rules): support async markdown-it rules #6
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -76,7 +133,7 @@ export class MarkdownItAsync extends MarkdownIt { | |||
async renderAsync(src: string, env?: any): Promise<string> { | |||
this.options.highlight = wrapHightlight(this.options.highlight, this.placeholderMap) | |||
this.disableWarn = true | |||
const result = this.render(src, env) | |||
const result = await this.renderer.renderAsync(this.parse(src, env), this.options, env) |
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.
We couldn't do this as some plugins rely on replacing the md.render
function.
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 for the reply. I apologize for not reviewing too many plugin examples. Could you recommend some examples to help me improve? I'm confused that if multiple plugins are used, isn't there a risk that earlier plugins might be overridden by later ones? If there is some way to avoid that, maybe, we can use a similar approach.
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.
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.
@ronny1020 i think we exactly have this hen egg thing here:
there are plugins out there that do the overwriting.
and yeah - that would mean that they are eventually overwritting each other..
maybe they just doing something first and then calling the original?
in this case i think that maybe they are working all one after each other..
????
would need a testcase for this to exactly pin-point it..
maybe one of my test-setups can help as a starting point:
for a complex test-setup you can have a look at
- https://github.com/s-light/quasar-unplugin-vue-markdown-tests
- https://github.com/s-light/unplugin-vue-markdown-playground
i am happy if you have the motivation to test and setup things..
for my personal use-case for now i switched to a sync-only approach... (so i am in no need currently)
Description
support async markdown-it rules, and add test and doc
Linked Issues
Additional context