question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Html entities are automatically escaped

See original GitHub issue

It seems that Vue.js templating language auto-escape strings. I made a filter that wrap urls to links, but the printed results is escaped html.

I couldn’t find any mention of this in the docs.

Is there a way to avoid escaping? Should’nt it be a filter instead? Like this:

<p>{{ unsafe_string | escape }}</p>

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

20reactions
rayfrancocommented, Oct 16, 2016

@InstanceOfMichael This answer was only for Vue 1.x. But if you are using Vue 2.x, you should use computed properties to apply filters combined with v-html.

http://vuejs.org/guide/syntax.html#Raw-HTML

13reactions
yyx990803commented, Jun 20, 2014

You can use {{{ unsafe_string }}} for raw html. (docs here: http://vuejs.org/guide/#Mustache_Bindings in the third note box)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fastest method to escape HTML tags as HTML entities?
Here's one way you can do this: var escape = document.createElement('textarea'); function escapeHTML(html) { escape.textContent = html; return escape.
Read more >
HTML Escape Characters: Complete List of HTML Entities
Number Symbol Entity Name Code Description 9 Tab &Tab &#9 Tab 10 New Line &NewLine &#10 New Line 32 Space &nbsp &#32 Space
Read more >
Using character escapes in markup and CSS - W3C
Character escapes are a way of writing a character in markup using only ASCII code points. They are useful if you are unable...
Read more >
Should I escape the Apostrophe ( ' ) character with its HTML ...
It's less obvious, but it's actually important to escape " . If a string ever ends up in a HTML attribute ( title="something"...
Read more >
How to escape & unescape HTML characters in string in ...
Escaping HTML characters in a string means replacing the: ... We can escape the HTML of the string using the replace method of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found