react-md-editor icon indicating copy to clipboard operation
react-md-editor copied to clipboard

how to use preview plugins?

Open linojon opened this issue 3 years ago • 2 comments

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!.

linojon avatar May 03 '22 12:05 linojon

@linojon example:

  • https://github.com/uiwjs/react-md-editor/issues/318#issuecomment-1002351325
  • https://github.com/uiwjs/react-md-editor/issues/335#issuecomment-1084523247
  • https://github.com/uiwjs/react-md-editor/issues/375#issuecomment-1099253093
  • https://github.com/uiwjs/react-md-editor/issues/371#issuecomment-1093643912
  • https://github.com/uiwjs/react-md-editor/issues/366#issuecomment-1092041069
<MDEditor 
  previewOptions={{
    remarkPlugins: [],
    rehypePlugins: []
  }}
/>
  • remarkPlugins (Array.<Plugin>, default: [])
    List of remark plugins to use. See the next section for examples on how to pass options
  • rehypePlugins (Array.<Plugin>, default: [])
    List of rehype plugins to use. See the next section for examples on how to pass options

jaywcjlove avatar May 03 '22 13:05 jaywcjlove

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

linojon avatar May 03 '22 16:05 linojon