Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 579 Bytes

README.md

File metadata and controls

20 lines (15 loc) · 579 Bytes

light-sanitize-html

Lightweight plugin for sanitize your html
CI status

Usage

const sanitize = require("light-sanitize-html");

// erase open and close tags
sanitize("<script>some</script>") == "some";
sanitize("<script><script>some</script>") == "some";
sanitize("<style>some</style>") == "some";

// erase attribute with danger value
sanitize("<img src=\"JaVaScRiPt:alert('home')\">") == "<img >";

// erase danger attributes
sanitize("<img onerror=alert('some')>") == "<img >";