Skip to content
Discussion options

You must be logged in to vote

Could you please let me know if MDX provides any built-in security mechanisms for handling potentially unsafe content? Having such a feature would be very helpful for implementing secure rendering in my current project.

MDX is inherently unsafe, it supports full JS, that is by design.
It offers complete flexibility to authors, with the trade off that you need to trust them.

The safe mode is: use markdown.

There are ways to render custom elements in markdown.
For example components in react-markdown https://github.com/remarkjs/react-markdown#appendix-b-components
or directives https://github.com/remarkjs/remark-directive

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ChristianMurphy
Comment options

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