Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert raw HTML into Elm component

Tags:

elm

How do I insert text - that I know to be 'safe' - directly into an Elm page.

i.e. what is text' in the following.

let str = "<h1>Hello World</h1>"
in div [] [ text' str ]

In practise I could get any valid HTML, so I don't want to build a parser, and I'd rather avoid a port as playing around wit the DOM can break the virtual dom diffing

like image 352
Simon H Avatar asked Apr 17 '16 12:04

Simon H


1 Answers

There are a few solutions discussed in this post. Seems the poster had success with using Markdown.toHtml.

like image 73
leeor Avatar answered Sep 27 '22 00:09

leeor