Skip to content

Is there a way to reliably programmatically escape/ignore html in mdx? #1477

Answered by ChristianMurphy
Stvad asked this question in Q&A
Discussion options

You must be logged in to vote

HTML and JSX are incompatible, mdx parses JSX.

There are a few options:

  1. validate HTML tags to avoid invalid content
  2. use https://github.com/remarkjs/remark#readme to parse HTML (mdx builds on remark, mdx replaces remark's HTML parser with a JSX parser)

Replies: 2 comments 20 replies

Comment options

You must be logged in to vote
18 replies
@Stvad
Comment options

@wooorm
Comment options

@Stvad
Comment options

@wooorm
Comment options

@Stvad
Comment options

Answer selected by Stvad
Comment options

You must be logged in to vote
2 replies
@wooorm
Comment options

@Stvad
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants