marcosh
marcosh

Reputation: 9008

Elm - do not escape html string

The documentation of ELM Html clearly states that

It will escape the string so that it appears exactly as you specify

How should I do then if I want to escape the string, instead?

For example, suppose I have the string "“", how could I render it as ?

Upvotes: 3

Views: 1439

Answers (2)

Jason Mahr
Jason Mahr

Reputation: 71

I recently created an Elm package that solves this. If you use text' "“" it'll render “ instead of the escape code. Also works with "“", "“", and the hex entity "“". Should work when fetching from an API. Hope this helps!

Upvotes: 4

Chad Gilbert
Chad Gilbert

Reputation: 36375

The only way around that limitation is to use unicode characters instead of escaping. That is, your rendered HTML will actually contain the unicode rather than the html-escaped value of “

See this related discussion.

Upvotes: 1

Related Questions