I'm trying to render HTML entities in Hoplon using the following:
(a :href "#" :class "deck-prev-link" :title "Previous" "←")
But instead of an arrow, it's displaying the literal ←
in the rendered page.
What am I missing?
A commonly used entity in HTML is the non-breaking space: A non-breaking space is a space that will not break into a new line. Two words separated by a non-breaking space will stick together (not break into a new line). This is handy when breaking the words might be disruptive.
In HTML, the ampersand character (“&”) declares the beginning of an entity reference (a special character). If you want one to appear in text on a web page you should use the encoded named entity “ & ”—more technical mumbo-jumbo at w3c.org.
> and < is a character entity reference for the > and < character in HTML. It is not possible to use the less than (<) or greater than (>) signs in your file, because the browser will mix them with tags. for these difficulties you can use entity names( > ) and entity numbers( < ).
& has a special meaning in HTML, it means the start of an 'entity'. To output a & itself, use the entity & . There are 5 entities common to HTML and XML, & , < (<), > (>), " (") and ' ('), although the last two are often only necessary in attribute values.
So in case anyone is wondering, the answer is to either paste the "←" directly into the string like this:
(a :href "#" :class "deck-prev-link" :title "Previous" "←")
or to use the unicode escape in the string like this:
(a :href "#" :class "deck-prev-link" :title "Previous" "\u2190")
I found the unicode decimal code point for the leftward arrow here: List of XML and HTML Character Entity References.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With