1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-25 20:17:59 +09:00
elk/composables/sanitize.ts

12 lines
297 B
TypeScript
Raw Normal View History

2022-11-14 01:05:32 +09: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'],
},
})
}