react-md-editor
react-md-editor copied to clipboard
Fix support for asynchronous plugins in rehypePlugins
Related to #662
Refactor Markdown component to support asynchronous plugins.
-
Markdown Component (
core/src/components/TextArea/Markdown.tsx)- Import
useStatefrom React. - Add
mdStrstate to manage the processed markdown string. - Refactor
useEffectto handle asynchronous processing of markdown usingrehype().process. - Update the return statement to use
mdStrstate.
- Import
-
Example Component (
www/src/Example.tsx)- Import
rehypePrettyCode. - Add
rehypePrettyCodetopreviewOptions.rehypePlugins.
- Import
-
Tests (
test/editor.test.tsx)- Add a test to verify that
MDEditorsupports asynchronous plugins. - Use an example async plugin that adds a class to the first node.
- Verify that the class is added to the preview node after processing.
- Add a test to verify that
@vishwamartur is attempting to deploy a commit to the kenny wong's projects Team on Vercel.
A member of the Team first needs to authorize it.
Any updates on this? I'd love to see it merged because I need to use async plugins.