How to use the sanitize-html/src/index.js function in sanitize-html

To help you get started, we’ve selected a few sanitize-html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AlisProject / alis-editor-old / src / utils / sanitizer.ts View on Github external
export function sanitizeAllTags(html: string): string {
  return sanitize(html, {
    allowedTags: []
  })
}
github AlisProject / alis-editor-old / src / utils / sanitizer.ts View on Github external
export function sanitizeCommonTags(html: string): string {
  return sanitize(html, {
    allowedTags: ['p', 'b', 'i', 'em', 'strong', 'a', 'br', 'blockquote', 'h2', 'h3']
  })
}

sanitize-html

Clean up user-submitted HTML, preserving allowlisted elements and allowlisted attributes on a per-element basis

MIT
Latest version published 1 month ago

Package Health Score

94 / 100
Full package analysis