Disclaimer: I\'m brand new to Elm
I\'m fiddling around with the online Elm editor and I\'ve run into an issue. I can\'t find a way to get certain special charac
Why this is (intentionally) not so easy
The "makers" of Elm are understandably reluctant to give us a way to insert "special" characters into HTML text. Two main reasons:
How it's possible anyway
That said, the Elm user community has found a loophole that affords a workaround. For the reasons above, it's not recommended, especially not if your text is non-constant, i.e. comes from a source outside your program. Still, people will be wanting to do this anyway so I'm going to document it to save others the trouble I had digging everything up and getting it working:
import Json.Encode exposing (string)
elm-lang/core
so it should already be in your dependencies.import Html.Attributes exposing (property)
property "innerHTML"
and a JSON-Value representation of your text, e.g.:span [ property "innerHTML" (string " ") ] []