Files
TechRadarAJR/src/sanitize.ts
Danny Koppenhagen e0113c446d feat: sanitize HTML in footer
moved sanitize function into a separate file including some simple tests

closes #91
2022-01-11 15:38:16 +01:00

16 lines
358 B
TypeScript

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
)
});