Comparing version 5.0.3 to 5.1.0
{ | ||
"name": "bel", | ||
"version": "5.0.3", | ||
"version": "5.1.0", | ||
"description": "A simple extension to native elements", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -143,2 +143,23 @@ # [bel](https://en.wikipedia.org/wiki/Bel_(mythology)) | ||
## unescaping | ||
bel escapes `${values}` within template literals. Sometimes that is not desirable; for instance, when parsing a string with markdown, which returns HTML. | ||
To unescape values, use the `raw` method: | ||
```js | ||
var bel = require('bel') | ||
var raw = require('bel/raw') | ||
function example () { | ||
var output = '<strong>hello there</strong>' | ||
return bel` | ||
<div>${raw(output)}</div> | ||
` | ||
} | ||
``` | ||
Make sure that you are sticking to the security suggestions above, and sanitize any input for malicious code before using `raw`. | ||
## similar projects | ||
@@ -145,0 +166,0 @@ |
require('./api.js') | ||
require('./elements.js') | ||
require('./raw.js') |
var test = require('tape') | ||
var bel = require('../') | ||
var raw = require('../') | ||
@@ -34,1 +35,11 @@ test('server side render', function (t) { | ||
}) | ||
test('unescape html', function (t) { | ||
t.plan(1) | ||
var expected = '<span>Hello <strong>there</strong></span>' | ||
var result = raw('<span>Hello <strong>there</strong></span>').toString() | ||
t.equal(expected, result) | ||
t.end() | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23897
16
527
187
0