Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use preview plugins? #380

Open
linojon opened this issue May 3, 2022 · 2 comments
Open

how to use preview plugins? #380

linojon opened this issue May 3, 2022 · 2 comments

Comments

@linojon
Copy link

linojon commented May 3, 2022

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
Copy link
Member

@linojon example:

<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

@linojon
Copy link
Author

linojon commented May 3, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants