feat: sanitize HTML in footer
moved sanitize function into a separate file including some simple tests closes #91
This commit is contained in:
committed by
Bastian
parent
5a5928f2dd
commit
e0113c446d
15
src/sanitize.ts
Normal file
15
src/sanitize.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
|
||||
const defaultSanitizeOptions = {
|
||||
allowedTags: ['b', 'i', 'em', 'strong', 'a', 'ul', 'ol', 'li'],
|
||||
allowedAttributes: {
|
||||
'a': ['href', 'target']
|
||||
}
|
||||
}
|
||||
|
||||
export const sanitize = (dirty: string, options: sanitizeHtml.IOptions = defaultSanitizeOptions) => ({
|
||||
__html: sanitizeHtml(
|
||||
dirty,
|
||||
options
|
||||
)
|
||||
});
|
||||
Reference in New Issue
Block a user