blanch
Drop-in replacement for bleach, the deprecated HTML sanitization library.
Features
- Same API as bleach (
clean,linkify,Cleaner,Linker,CSSSanitizer) - Zero dependencies — uses
html.parserfrom stdlib - Python 3.10+
- Full type annotations
Installation
pip install blanch
Usage
import blanch
# Sanitize HTML
blanch.clean("<script>alert('xss')</script><b>hello</b>")
# '<script>alert(\'xss\')</script><b>hello</b>'
# Linkify URLs
blanch.linkify("Visit https://example.com")
# 'Visit <a href="https://example.com" rel="nofollow">https://example.com</a>'
Migrating from bleach
# Option 1: Replace import
# Before: import bleach
import blanch as bleach
# Option 2: Use compatibility layer
import blanch.compat.bleach as bleach
License
MIT
Metadata
Release files for blanch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blanch-0.1.0.tar.gz | 39.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blanch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.3 kB
Release files / blanch-0.1.0.tar.gz
| Download URL | blanch-0.1.0.tar.gz |
|---|---|
| Size | 39.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c42f39cc7405bfb809f6b80064e61aa23e32e67cbbbc95f35fcbf4bb8970a8b
|
|
BLAKE2b-256 checksum How to use checksums |
752ed031041e6a16d8ec599cf82d0c069a19d9c9238debb6029e7c42ca4ca783
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / blanch-0.1.0-py3-none-any.whl
| Download URL | blanch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0dbc083d0b3ce79a54714063ccf46cf19176a26d810f64954d3148de5716fb7
|
|
BLAKE2b-256 checksum How to use checksums |
faaca6b51e5296bac5e299a3822c7ac95429e725103d8fecb962b703e2b8efc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|