light-sanitize-html

1.0.2 • Public • Published

light-sanitize-html

Lightweight plugin for sanitize your html
CI status

Usage

const sanitize = require("light-sanitize-html");
let html = `
    <script>window.$ = false</script>
    <style></style>
    <p>
        some image
        <img src="javascript:alter('hello')" onerror="alert('world')">
    </p>
`;
 
html = sanitize(html);
html == `
    window.$ = false
    
    <p>
        some image
        <img  >
    </p>
`; // true
 

Dependencies (0)

    Dev Dependencies (9)

    Package Sidebar

    Install

    npm i light-sanitize-html

    Weekly Downloads

    162

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    22.5 kB

    Total Files

    15

    Last publish

    Collaborators

    • eprincev.egor