simple-marked-sanitizer
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -55,2 +55,4 @@ (function(root) { | ||
'details', | ||
'center', | ||
'span', | ||
]; | ||
@@ -266,3 +268,3 @@ | ||
} | ||
if (parsed.value && parsed.value.startsWith("javascript:")) { | ||
if (parsed.value && parsed.value.trim().startsWith("javascript:")) { | ||
return false; | ||
@@ -269,0 +271,0 @@ } |
{ | ||
"name": "simple-marked-sanitizer", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Simple sanitizer for marked", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# simple-marked-sanitizer | ||
A simple sanitizer implementation for [marked](https://github.com/markedjs/marked). | ||
A simple sanitizer implementation for [marked](https://github.com/markedjs/marked). | ||
You can use this as a node module or you can use it from browser directly. | ||
@@ -15,3 +15,3 @@ | ||
## About attributes | ||
It is also whitelist based. | ||
It is also whitelist based. | ||
If attribute is not in whitelist, it will be removed. | ||
@@ -56,3 +56,3 @@ | ||
The default whiltelist for elements/attributes are defined in [index.js]. | ||
The default whiltelist for elements/attributes are defined in [index.js]. | ||
You can get them as a property of SimpleMarkedSanitizer. | ||
@@ -65,3 +65,3 @@ | ||
Element whiltelist is based on [marked-sanitizer-github](https://github.com/rhysd/marked-sanitizer-github). | ||
Element whiltelist is based on [marked-sanitizer-github](https://github.com/rhysd/marked-sanitizer-github). | ||
Very thanks. | ||
@@ -68,0 +68,0 @@ |
@@ -112,3 +112,3 @@ const assert = require("chai").assert; | ||
it("with empty tag", () => { | ||
const input = '<br/>'; | ||
const input = '<br />'; | ||
const output = '<p><br/></p>'; | ||
@@ -118,2 +118,3 @@ const result = apply(input); | ||
}); | ||
it("with empty tag with attributes", () => { | ||
@@ -125,2 +126,16 @@ const input = '<img src="hoge" alt="fuga"/>'; | ||
}); | ||
it("with empty attribute value", () => { | ||
const input = '<img src="" alt="fuga"/>'; | ||
const output = '<p><img src="" alt="fuga"/></p>'; | ||
const result = apply(input); | ||
assert.equal(result, output); | ||
}); | ||
it("with attribute value which startsWith `javascript:`", () => { | ||
const input = '<img src=" javascript:hoge" alt="fuga"/>'; | ||
const output = '<p><img alt="fuga"/></p>'; | ||
const result = apply(input); | ||
assert.equal(result, output); | ||
}); | ||
}); |
14659
407