sanitize_html
Function for sanitizing HTML to prevent XSS by restrict elements and attributes to a safe subset of allowed values.
2.2.0
860K downloads/mo
#388 most downloaded on pub.dev
google/dart-neats
What this package is like to depend on
Last release 1 months ago
07 Jul 2026
Release timing varies
gaps range from 5 weeks to 2.8 years
Nearly every release is documented
notes for 9 of 9 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
9 releases · first in 2019
1 release in the last 12 months
see the full history below
Release timeline
9 releases · Apr 2019 to Jul 2026
2020
2021
2022
2023
2024
2025
2026
Releases
latest 9-
2.2.007 Jul 2026Release notes
Open source →- Allow the
<picture>and<source>elements, withsrcseton<source>, matching thehtml-pipelineallowlist this package is modeled on. Enables theme-aware images via<picture>withprefers-color-scheme.
Release notes
Open source →- Allow the
<picture>and<source>elements, withsrcseton<source>, matching thehtml-pipelineallowlist this package is modeled on. Enables theme-aware images via<picture>withprefers-color-scheme.
- Allow the
-
2.1.028 Sep 2023Release notes
Open source →- Remove custom HTML rendering logic in favor of logic from
package:html. - Added
topicstopubspec.yaml. relattributes added throughaddLinkRelare appended to existing ones.
- Remove custom HTML rendering logic in favor of logic from
-
2.0.001 Mar 2021 -
1.4.115 Oct 2020 -
1.4.007 Oct 2020Release notes
Open source →- Added
addLinkReloption tosanitize_html. This will allow users to qualify outbound links which may help prevent comment spam.
- Added
-
1.3.026 Jun 2019Release notes
Open source →- Only print self-closing tags for
void-elements.
This could cause
<strong />in HTML documents, which is can be interpreted as an opening tag by HTML5 parsers, causing the HTML structure to break.
- Only print self-closing tags for
void-elements.
This could cause
-
1.2.022 May 2019Release notes
Open source →- Does not depend on
universal_html, uses custom HTML rendering for the output. - Allowed classes are kept, even if there are non-allowed classes present on the same element.
- Does not depend on
-
1.1.003 Apr 2019Release notes
Open source →- Add options
allowElementIdandallowClassNameto allow specific element ids and class names.
- Add options
-
1.0.002 Apr 2019