1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Refactor markdown/sanitize html code

This commit is contained in:
Chocobozzz 2020-11-17 14:34:09 +01:00
parent 9afb5c10e5
commit 9ff36c2d70
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 67 additions and 70 deletions

View file

@ -0,0 +1,21 @@
export const SANITIZE_OPTIONS = {
allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
allowedSchemes: [ 'http', 'https' ],
allowedAttributes: {
a: [ 'href', 'class', 'target', 'rel' ]
},
transformTags: {
a: (tagName, attribs) => {
let rel = 'noopener noreferrer'
if (attribs.rel === 'me') rel += ' me'
return {
tagName,
attribs: Object.assign(attribs, {
target: '_blank',
rel
})
}
}
}
}