dnagir / ruby-haml-js

HAML-JS Tile and Rails 3.1 Template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to escape links in a text?

yangtheman opened this issue · comments

Hi,

More of a simple question than an issue....

One of the attributes for an object I return is sort of a message (text), and inside the message are a few links like the following.

<a href="http://fox.com">Fox</a> jumped over the <a href="http://moon.com">moon</a>

When I display this in hamljs template like the following, I get the literal text with html tags, instead of text with clickable links. How can I achieve this?

%p #{message}

Thank you so much in advance!

See the readme of the haml-js:

For interpolation, you may use #{} for escaped interpolation or !{} for unsafe interpolation.