mirror of
https://github.com/elk-zone/elk
synced 2024-11-23 22:56:09 +09:00
12 lines
297 B
TypeScript
12 lines
297 B
TypeScript
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'],
|
|
},
|
|
})
|
|
}
|