FindSoftware

Sanitize

Ruby library that cleans HTML and CSS strings by keeping only the elements, attributes and properties on an allowlist.

Sanitize is a Ruby library that works as an allowlist-based sanitizer for HTML and CSS: it removes whatever elements, attributes and properties are not on the allowlist. The README says it is built on the Nokogiri HTML5 parser and on Crass, a CSS parser.

Worth knowing

The README warns that Sanitize cannot fully sanitize the contents of math and svg elements, and that it removes them by default.

Identity

Status
Active
Maintainer
Ryan Grove3
Maintained by
Individual
First release
20085

Rendering and deploy

Install with
gem2

Releases

Current major version
76
Last release
2026-11-026

Adoption

GitHub stars
2,0541
Contributors
417
Dependent repositories
10,7158
Dependent packages
2608

Why these figures do not compare

Sources

  1. 2026-11-16: links, Written in, GitHub stars
    api.github.com/repos/rgrove/sanitize
  2. 2026-11-16: links, Categories, Install with
    raw.githubusercontent.com/rgrove/sanitize/main/README.md
  3. 2026-11-16: Maintainer, License model
    raw.githubusercontent.com/rgrove/sanitize/main/LICENSE
  4. 2026-11-16: Runtime, Minimum runtime, License
    github.com/rgrove/sanitize/blob/v7.0.2/sanitize.gemspec
  5. 2026-11-16: First release
    api.github.com/repos/rgrove/sanitize/commits/release-1.0.0
  6. 2026-11-16: Current major version, Last release
    api.github.com/repos/rgrove/sanitize/releases/latest
  7. 2026-11-16: Contributors
    api.github.com/repos/rgrove/sanitize/contributors?per_page=1
  8. 2026-11-16: Dependent packages, Dependent repositories
    packages.ecosyste.ms/api/v1/registries/rubygems.org/packages/sanitize

Last reviewed · Listed since Edit on GitHubThis page as markdownas JSON