You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the remark-code-frontmatter and remark-code-extra plugins, I'm getting the following error:
index.js:566 Uncaught (in promise) Error: `runSync` finished async. Use `run` instead
at assertDone (index.js:566)
at Function.runSync (index.js:352)
at ReactMarkdown (react-markdown.js:107)
at renderWithHooks (react-dom.development.js:14985)
at mountIndeterminateComponent (react-dom.development.js:17811)
at beginWork (react-dom.development.js:19049)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
at invokeGuardedCallback (react-dom.development.js:4056)
at beginWork$1 (react-dom.development.js:23964)
Digging in, it looks like the remark-code-extra plugin is returning Promises, forcing the async flow.
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
Reacted by 0xPhaze, wong2, Matt Kindy, Xeu, Abdur-Rahman, NickChenヰ, ezzabuzaid, Raf (Raffaele Rialdi), Erik O'Leary, Tomeu and 2 more
Also, probably a very bad idea to use a plugin that hasn’t been updated in 3 years...
Haha... very true. I saw that the plugins were referenced on the list of plugins and still indicated they were "up to date". I guess that means different things to different people! 😆
I might take a stab at a PR, but maybe it's worth looking around to see if there are any newer plugins too. Thanks!
Perhaps I can help you if I know what you are looking for?
I like the idea of using the remark-code-frontmatter plugin and loading additional metadata into the code snippets. My use case is displaying code snippets, but having additional metadata to enable various features (when to show a copy button, a sample filename to display, etc.). Combining that with the remark-code-extra has made it super simple to wrap the code blocks.
FWIW... it's been working great and I haven't run into issues yet beyond needing the processor to run asynchronously. But, if there are other plugins you think can meet this need, I'll be happy to switch!
This is definitely a blocker for many scenarios and going to be a bigger one once react server components are more common and people would wanna put async code in plugins.
I've added more context on the PR
I am trying to build a remark plugin which requires async run and use it in react markdown. I am using this in a React Server Component
If this was a client-side component, I would have called the plugin in a hook (as a standalone remark plugin) and loaded the result in the react markdown plugin when the result was complete, allowing me to run the code synchronously
Since this is a server-side component, the result needs to be compiled on the server and I cannot use hooks or state. It would make things easier if the component (ReactMarkdown) itself is made asynchronous, allowing it to use run instead of runSync for plugins.
Such as?
With RSC, more people are going to use ReactMarkdown to render markdown on server side instead of using other technologies because it integrates with their frontend well and it is easier to maintain it in a single codebase. In such cases, async plugins can potentially be more common. This is the exact same thing I am facing. I was previously rendering md on server side manually with some limited format options. Now I can just use ReactMarkdown with RSC
Yes, looking for someone to do the work and investigate whether it works or not.
Not sure about the prop you mention here.
And I believe it to be hard to test and dependent on undocumented/experimental features (reactjs/rfcs#229) so that’s why I think marking the API as experimental and unstable for now is a good idea.
@x5engine this package is still actively maintained, and many plugins are supported.
If you have questions on how to use a specific plugin feel free to ask in the forum https://github.com/orgs/remarkjs/discussions
If you would like to accelerate this feature by contributing, some ideas are outlined in #680 (comment)
Comments focused on attacking maintainers here and on other threads are unhelpful, unwelcome, and against the code of conduct (CoC) https://github.com/remarkjs/.github/blob/main/code-of-conduct.md
Take a week to cool off, if you continue to break the CoC further actions, including a permanent ban from being able to access support channels could follow.
Reacted by Titus, Merlijn Vos, Remco Haszing and Paul Sachs
Activity
wooorm commentedon Apr 5, 2022
PR welcome!
github-actions commentedon Apr 5, 2022
wooorm commentedon Apr 5, 2022
Also, probably a very bad idea to use a plugin that hasn’t been updated in 3 years...
mikesir87 commentedon Apr 5, 2022
Haha... very true. I saw that the plugins were referenced on the list of plugins and still indicated they were "up to date". I guess that means different things to different people! 😆
I might take a stab at a PR, but maybe it's worth looking around to see if there are any newer plugins too. Thanks!
Add async processing support to support async plugins
wooorm commentedon Apr 6, 2022
That indication means that it did not start crashing when remark introduced a breaking change two 2 years ago, which did affect some plugins.
Perhaps I can help you if I know what you are looking for?
mikesir87 commentedon Apr 6, 2022
I like the idea of using the
remark-code-frontmatterplugin and loading additional metadata into the code snippets. My use case is displaying code snippets, but having additional metadata to enable various features (when to show a copy button, a sample filename to display, etc.). Combining that with theremark-code-extrahas made it super simple to wrap the code blocks.FWIW... it's been working great and I haven't run into issues yet beyond needing the processor to run asynchronously. But, if there are other plugins you think can meet this need, I'll be happy to switch!
ujjwalchadha8 commentedon Dec 2, 2022
This is definitely a blocker for many scenarios and going to be a bigger one once react server components are more common and people would wanna put async code in plugins.
I've added more context on the PR
wooorm commentedon Dec 2, 2022
Such as?
Why? I don’t see how RSC affects this issue.
ujjwalchadha8 commentedon Dec 3, 2022
I am trying to build a remark plugin which requires async run and use it in react markdown. I am using this in a React Server Component
If this was a client-side component, I would have called the plugin in a hook (as a standalone remark plugin) and loaded the result in the react markdown plugin when the result was complete, allowing me to run the code synchronously
Since this is a server-side component, the result needs to be compiled on the server and I cannot use hooks or state. It would make things easier if the component (ReactMarkdown) itself is made asynchronous, allowing it to use
runinstead ofrunSyncfor plugins.With RSC, more people are going to use ReactMarkdown to render markdown on server side instead of using other technologies because it integrates with their frontend well and it is easier to maintain it in a single codebase. In such cases, async plugins can potentially be more common. This is the exact same thing I am facing. I was previously rendering md on server side manually with some limited format options. Now I can just use ReactMarkdown with RSC
10 remaining items
remcohaszing commentedon Feb 13, 2024
I see. I remember we talked about it, but I didn’t see it in this issue and didn’t realize the idea was posted in that PR.
Is a PR welcome for that, or is more discussion needed?
wooorm commentedon Feb 13, 2024
Yes, looking for someone to do the work and investigate whether it works or not.
Not sure about the prop you mention here.
And I believe it to be hard to test and dependent on undocumented/experimental features (reactjs/rfcs#229) so that’s why I think marking the API as experimental and unstable for now is a good idea.
programming-with-ia commentedon Sep 5, 2024
programming-with-ia commentedon Sep 5, 2024
liuhq commentedon Nov 7, 2024
also the async problem from using shiki that is a code highlighter -> https://shiki.matsu.io/packages/rehype
x5engine commentedon Nov 29, 2024
x5engine commentedon Dec 2, 2024
ChristianMurphy commentedon Dec 2, 2024
@x5engine this package is still actively maintained, and many plugins are supported.
If you have questions on how to use a specific plugin feel free to ask in the forum https://github.com/orgs/remarkjs/discussions
If you would like to accelerate this feature by contributing, some ideas are outlined in #680 (comment)
Comments focused on attacking maintainers here and on other threads are unhelpful, unwelcome, and against the code of conduct (CoC) https://github.com/remarkjs/.github/blob/main/code-of-conduct.md
Take a week to cool off, if you continue to break the CoC further actions, including a permanent ban from being able to access support channels could follow.
Add support for async plugins
Add support for async plugins
github-actions commentedon Feb 20, 2025
wooorm commentedon Feb 20, 2025
Released in
9.1.0!