Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I embed HTML entities in text in a Hoplon page?

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?

like image 680
Micha Niskin Avatar asked Jan 20 '14 18:01

Micha Niskin


People also ask

What is the use of &nbsp in HTML?

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.

What is &amp in HTML?

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.

What is HTML &GT?

&gt; and &lt; 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( &gt; ) and entity numbers( &#60; ).

How do you display and in HTML?

& has a special meaning in HTML, it means the start of an 'entity'. To output a & itself, use the entity &amp; . There are 5 entities common to HTML and XML, &amp; , &lt; (<), &gt; (>), &quot; (") and &apos; ('), although the last two are often only necessary in attribute values.


1 Answers

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.

like image 176
Micha Niskin Avatar answered Jan 02 '23 12:01

Micha Niskin