elk/composables/santize.ts

12 lines
297 B
TypeScript
Raw Normal View History

2022-11-13 19:05:32 +03:00
import SanitizeHTML from 'sanitize-html'
export function sanitize(text: string) {
return SanitizeHTML(text, {
allowedAttributes: {
a: ['href', 'name', 'target', 'class'],
span: ['class'],
img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'loading'],
},
})
}