From documentation: Note that toHast.allowDangerousHTML does not work: it’s not possible to inject raw HTML with this plugin (as it’s mean to prevent having to use dangerouslySetInnerHTML).
But still there is a way to allow html tags. Thanks to ChristianMurphy suggestion.
I've made just couple improvements:
- Module rehype-dom-parse leads to error: 'document is not defined'. So I replace it with 'rehype-parse'.
- Extract rehypeParser from handler, so it's created only once.
- Also notice about
sanitize: false