Skip to content

How can I allow HTML-style <br> tags in markdown destined for React? #721

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

You must be logged in to vote

Short answer the flow is missing the option allowDangerousHtml and plugin rehype-raw, so HTML nodes aren't being passed through or parsed.
What you are looking for sounds a lot like https://github.com/remarkjs/react-remark, specifically https://remarkjs.github.io/react-remark/?path=/story/remark-component--mixed-html-sanitized and https://github.com/remarkjs/react-remark/blob/e9a248b672a69cec4deef4c8235b40d53ac52970/stories/remark-hook.stories.tsx#L76-L79

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ChristianMurphy
Comment options

@tremby
Comment options

@ChristianMurphy
Comment options

@tremby
Comment options

@tremby
Comment options

Answer selected by ChristianMurphy
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