uiwjs / react-md-editor

A simple markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-md-editor
MIT License
2.19k stars 160 forks source link

how to use preview plugins? #380

Open linojon opened 2 years ago

linojon commented 2 years ago

hi, i'm looking for an example how to use remark/plugins. Specifically, want to add variables to the markdown and view the rendered values in the preview (https://github.com/mrzmmr/remark-variables) (and/or write my own simple preprocessor that does a .replaceAll on the markdown text before it is passed to the previewer.) Thanks!.

jaywcjlove commented 2 years ago

@linojon example:

<MDEditor 
  previewOptions={{
    remarkPlugins: [],
    rehypePlugins: []
  }}
/>
linojon commented 2 years ago

Thank you for your quick reply. I've solved my question using examples you provided. Heres a codesandbox in case someone else wants a simple example https://codesandbox.io/s/nextjs-example-react-md-editor-forked-b06oxc?file=/pages/index.js