Closed aaronbieber closed 2 years ago
dangerousSetInnerHTML
is in htms "eyes" just a property, so it depends on the used rendering library to support it.
Sounds like you're using it with preact and preact supports it, even with htm: https://codesandbox.io/s/suspicious-parm-kyubbc
I believe I got some syntax wrong and will try again; @Kanaye's example obsoletes this issue so I'll close it.
I have a project where I am using HTM exclusively to build my components, and I have a component that needs to output some Markdown as HTML. I control this data, so I am not concerned about security risks in the Markdown to HTML conversion, but I can't find a way to output "raw HTML" from a component using HTM.
I've tried a number of React-oriented solutions, including
markdown-it-jsx
andreact-markdown
, but either they didn't work with Preact properly or just output the encoded HTML.The easiest way around this is to have a back door through
h()
that passes HTML text straight through, like React does withdangerouslySetInnerHTML
.I'm very open to the notion that there is some way to do this that I am missing.