Embed Raw HTML in Elm Component

How to insert text - which I know as "safe" - right onto the elm page.

i.e. what text' is next.

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

In practice, I can get any valid HTML, so I don’t want to create a parser, and I would rather avoid using a port, since the DOM can violate a virtual domain that is different

+6
source share
2 answers

There are several solutions discussed in this post . The poster seems to have been successful using Markdown.toHtml .

+4
source

To discuss the accepted answer, this helped me:

Install the tag library.

 elm-package install evancz/elm-markdown 

To make your HTML into a div

 import Markdown div [] [ Markdown.toHtml [] str ] 
+4
source

All Articles