Skip to content

Compiling MDX at runtime #1862

Discussion options

You must be logged in to vote

In MDX 2 runtime has been replaced with evaulate, you can see some examples of MDX 2 usage here: #1861

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?

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.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@leo-petrucci
Comment options

@ChristianMurphy
Comment options

Answer selected by leo-petrucci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants