harden sanitization
This commit is contained in:
parent
6b4d7923db
commit
08389dba3c
@ -434,7 +434,7 @@ Lexer.prototype.token = function(src, top) {
|
||||
: 'html',
|
||||
pre: !this.options.sanitizer
|
||||
&& (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
||||
text: cap[0]
|
||||
text: this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0])) : cap[0]
|
||||
});
|
||||
continue;
|
||||
}
|
||||
@ -847,7 +847,7 @@ InlineLexer.prototype.output = function(src) {
|
||||
if (cap = this.rules.text.exec(src)) {
|
||||
src = src.substring(cap[0].length);
|
||||
if (this.inRawBlock) {
|
||||
out += this.renderer.text(cap[0]);
|
||||
out += this.renderer.text(this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0])) : cap[0]);
|
||||
} else {
|
||||
out += this.renderer.text(escape(this.smartypants(cap[0])));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user