A fast HTML sanitizer that cleans user-submitted HTML while preserving whitelisted elements and attributes.
sanitize-html is a JavaScript library that cleans and sanitizes HTML content submitted by users. It removes potentially dangerous markup like scripts and styles while preserving only the HTML elements and attributes that developers explicitly allow, preventing cross-site scripting (XSS) attacks and other security vulnerabilities.
Web developers building applications that accept HTML input from users, such as content management systems, forums, comment systems, and rich text editors.
Developers choose sanitize-html for its precise whitelist-based control, high performance through htmlparser2 integration, and robust security approach that defaults to removing all HTML unless explicitly permitted.
Clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis. Built on htmlparser2 for speed and tolerance
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Defaults to removing all HTML, only allowing explicitly permitted elements and attributes, which prevents XSS attacks as described in its philosophy.
Built on the fast htmlparser2 parser, ensuring efficient processing of HTML content, a key feature highlighted for robust performance.
Handles poorly formatted HTML gracefully without breaking, making it reliable for unpredictable user-generated content.
Allows developers to define specific rules for what HTML is permitted, offering precise control as per the customizable filtering feature.
The project has been retired in favor of a monorepo, meaning no new updates, fixes, or support in this standalone version, as stated in the README.
Requires detailed setup for each allowed element and attribute, which can be error-prone and time-consuming, increasing the risk of misconfiguration.
Lacks active ecosystem support and compatibility with contemporary web development tools, reducing its appeal for new or evolving projects.