bleach-allowlist
Curated lists of tags and attributes for sanitizing html
What it is and what it does
bleach-allowlist is a data package that bundles pre-curated allowlists of safe HTML tags, attributes, and CSS styles for use with the bleach HTML sanitization library. It eliminates the need to manually define which HTML elements and styles are permitted when filtering user-provided markup. The package includes task-specific presets: markdown_tags and markdown_attrs for rendering markdown-style HTML, print_tags and print_attrs for print/PDF output, and all_styles and standard_styles for CSS property whitelisting.
The package is designed to be used as a reference or directly passed to bleach.clean() to enforce consistent, vetted sanitization rules across applications. It has no runtime dependencies and installs with low friction, but it is no longer actively maintained—the last commit was in June 2022 and no releases have occurred since August 2020. Users should verify that the allowlists remain suitable for their current HTML and CSS requirements.
Use it for:
- Sanitizing user-submitted HTML in comment systems or forums using bleach with pre-vetted markdown-safe tag allowlists.
- Filtering HTML for PDF or print rendering by applying print_tags and print_attrs to remove web-only markup.
- Whitelisting CSS properties in user-generated content by passing all_styles or standard_styles to bleach for style attribute sanitization.
- Establishing consistent HTML sanitization policies across multiple applications by reusing the same curated allowlists.
- Rendering markdown-converted HTML safely by applying the markdown_tags and markdown_attrs presets to bleach.clean().
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides curated allowlists of HTML tags, attributes, and CSS styles for use with the bleach HTML sanitization library to safely filter user-provided markup.
Yes, if you are already using bleach and want to avoid manually curating allowlists. The permissive BSD license and zero runtime dependencies make it low-risk to add. However, the package is abandoned and has not been updated since 2020; verify that its allowlists align with your current HTML/CSS standards and consider monitoring bleach for breaking changes that this package will not address.
Install
bleach-allowlist on PyPI
pip
pip install bleach-allowlistuv
uv add bleach-allowlistpoetry
poetry add bleach-allowlistInstalling bleach-allowlist
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last commit was 2022-06-20 and no releases since 2020-08-13. Security and compatibility fixes are unlikely.
License in practice
BSD License (permissive) allows commercial and private use with minimal restrictions, making it suitable for most projects from a licensing standpoint.
Quickstart
pip install bleach-allowlist
import bleach
from bleach_allowlist import print_tags, print_attrs, all_styles
bleach.clean(raw_html, print_tags, print_attrs, all_styles)
Requires bleach to be installed separately; bleach-allowlist is only a data package of allowlists, not a complete sanitization solution.
Verify before relying
- Whether the curated allowlists remain adequate for current HTML/CSS standards given the package's abandonment since 2022.
- Compatibility with recent versions of bleach and Python versions beyond what the fact sheet specifies.
Package facts
| License | BSD License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,192 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 896,985/month — #4,786 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bleach_allowlist-1.0.3-py2.py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
bleachBleach sanitizes untrusted HTML by escaping or…
permissive · top 1,000 on PyPI
html-sanitizerSanitizes HTML fragments by enforcing an…
permissive · top 5,000 on PyPI
django-bleachIntegrates bleach HTML sanitization into Django…
permissive · top 15,000 on PyPI
nh3nh3 sanitizes HTML by removing unsafe tags and…
permissive · top 1,000 on PyPI
lxml-html-cleanCleans and sanitizes HTML by removing unwanted…
permissive · top 5,000 on PyPI
types-bleachProvides type stubs for the bleach HTML…
permissive · top 5,000 on PyPI
django-markdownifyA Django template filter that converts Markdown…
permissive · top 15,000 on PyPI
css-inlineInlines CSS from style and link tags directly…
permissive · top 5,000 on PyPI
html-tag-namesProvides a curated list of valid HTML tag names…
copyleft · top 15,000 on PyPI
sanitize-filenameRemoves or replaces problematic characters from…
permissive · top 15,000 on PyPI