Compiling MDX at runtime #1862
-
I'm currently working with Thankfully, netlify CMS allows me to use a custom render function, so all I need to do is to convert my MDX to JSX at runtime within this function. I've managed to get this to work with I found there used to be an old package called
Any tips on how I can solve this issue? Any workarounds to compiling MDX at runtime? EDIT: Figured out the original issue was a problem with Webpack config, but now when I write components in my Markdown I get:
I assume this is because it parses the JSX as I'm writing it and throws an error since it's not been closed properly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
In MDX 2 runtime has been replaced with evaulate, you can see some examples of MDX 2 usage here: #1861
Yes, when handling JSX tags, MDX needs to JSX to be valid to render. I'm assuming this error is coming from an authoring system, if so a way to contain this client side is to use an error boundary https://reactjs.org/docs/error-boundaries.html |
Beta Was this translation helpful? Give feedback.
In MDX 2 runtime has been replaced with evaulate, you can see some examples of MDX 2 usage here: #1861
Yes, when handling JSX tags, MDX needs to JSX to be valid to render.
I'm assuming this error is coming from an authoring system, if so a way to contain this client side is to use an error boundary https://reactjs.org/docs/error-boundaries.html
To catch the error, and warn the author the syntax is invalid until the tag is closed, when the author has fixed the syntax error, it can preview again.