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.

easier way of using HTML entities

See original GitHub issue

Using innerHTML to insert the odd HTML entity such as   as described in the wiki is OK. But when HTML entities are used all over the place, this quickly becomes unwieldy. I wish there was some way to keep using the entities inline.

Is there another reason to escape all text other than prevention of XSS from user entered text? If there isn’t, I think the default of escaping everything is wrong and should be changed (if possible).

When writing plain old HTML, people are used their <tags> being interpreted accordingly, just like their &entities;, and the rest used as is (i.e. unescaped). I wish bel could mirror that experience.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

jondashkylecommented, Jul 12, 2017

Just wanted to chime in on this now that the module has evolved some. I hear the safety concerns, but with the added SSR capabilities of Pelo, this would be really handy. For example, I’m formatting text, which I’ve properly sanitized, as markdown formatter. Currently to do this requires:

var input = 'Some **sanitized** text!'
var text = markdown(input)
var element = bel`<div></div>`
element.setInnerHTML = text

Up till the addition of Pelo this was cool, but when using .toString() for some SSR jazz, the DOM isn’t around, and the element ends up being blank. I’ve hit this a few times recently, both when working on some SSR stuff, and when creating a little static site generator with Choo. Obv loosing a big benefit of SSR when used on a page with a lot of copy.

You can see this in action when visiting my site:

Source here:

Could be a great add?! 🎉 (cc: @yoshuawuyts)

goto-bus-stopcommented, Mar 13, 2018

added in #86

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Entities
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP,...
Read more >
HTML - Entities
HTML - Entities, Some characters are reserved in HTML and they have special meaning when used in HTML document. For example, you cannot...
Read more >
Different HTML Entities with Examples
Guide to HTML Entities. Here we discuss the Introduction and different HTML entities in tabular format along with examples.
Read more >
Common HTML entities used for typography
There are a number of HTML entities that come in handy when there's a need for first-rate typesetting. Many of those listed in...
Read more >
Use HTML Entities to Add Special Characters to Web Pages
Use entities to display special characters. Also good for when you want to display samples of code/markup on your web page.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found