Drop-in replacement for bleach HTML sanitization library
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
blanch-0.1.0.tar.gz
(39.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
blanch-0.1.0-py3-none-any.whl
(12.7 kB
view details)
File details
Details for the file blanch-0.1.0.tar.gz.
File metadata
- Download URL: blanch-0.1.0.tar.gz
- Upload date:
- Size: 39.6 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c42f39cc7405bfb809f6b80064e61aa23e32e67cbbbc95f35fcbf4bb8970a8b
|
|
| MD5 |
eb42e9caa9ad75b52b0b7af311e253c9
|
|
| BLAKE2b-256 |
752ed031041e6a16d8ec599cf82d0c069a19d9c9238debb6029e7c42ca4ca783
|
File details
Details for the file blanch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: blanch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0dbc083d0b3ce79a54714063ccf46cf19176a26d810f64954d3148de5716fb7
|
|
| MD5 |
7344eb202f84b4671b73ce95d1605308
|
|
| BLAKE2b-256 |
faaca6b51e5296bac5e299a3822c7ac95429e725103d8fecb962b703e2b8efc6
|