1
0
Fork 0
peertube/shared/core-utils/renderer/html.ts

22 lines
516 B
TypeScript
Raw Normal View History

2020-11-17 08:34:09 -05:00
export const SANITIZE_OPTIONS = {
allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
allowedSchemes: [ 'http', 'https' ],
allowedAttributes: {
a: [ 'href', 'class', 'target', 'rel' ]
},
transformTags: {
2020-11-17 08:49:36 -05:00
a: (tagName: string, attribs: any) => {
2020-11-17 08:34:09 -05:00
let rel = 'noopener noreferrer'
if (attribs.rel === 'me') rel += ' me'
return {
tagName,
attribs: Object.assign(attribs, {
target: '_blank',
rel
})
}
}
}
}