Skip to content

Commit ebf37b5

Browse files
authored
Merge pull request #874 from vitalyavolyn/open-links-new-tab
Preserve target=_blank attribute when purifying (fix #793)
2 parents 860719f + f7e2380 commit ebf37b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/helpers.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ function escapeHTML(unsafe) {
384384
if(typeof unsafe === 'undefined' || unsafe === null) {
385385
return '';
386386
}
387-
return DOMPurify.sanitize(String(unsafe));
387+
388+
return DOMPurify.sanitize(String(unsafe), { ADD_ATTR: ['target'] });
388389
}
389390

390391
function html(strings, ...values) {

0 commit comments

Comments
 (0)