Curated lists of tags and attributes for sanitizing html
Project description
A curated list of tags, attributes, and styles suitable for filtering user-provided HTML using bleach.
Currently, it consists of basic set of tags suitable for markup intended for printing, as well as a list of all CSS styles. Please send pull requests with improvements or lists of tags and attributes for other purposes (wikis, comments, etc?).
Installation
pip install bleach-whitelist
Use
import bleach from bleach_whitelist import print_tags, print_attrs, all_styles bleach.clean(raw_html, print_tags, print_attrs, all_styles)
Properties:
print_tags: Safe HTML tags suitable for printing / PDFs.
print_attrs: Safe attributes suitable for printing / PDFs.
all_styles: A list of all CSS properties supported by major browsers.
standard_styles: A list of standard (non-vendor-specific) CSS properaties.
See bleach_whitelist.py for more.
Have improvements or lists of tags suitable for other purposes? Please send a pull request! Let’s build a few good task-specific whitelists rather than reinventing these lists every time.
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
File details
Details for the file bleach-whitelist-0.0.2.tar.gz.
File metadata
- Download URL: bleach-whitelist-0.0.2.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82729d9dcb1dcfb01a8a2a6106bf77190652620c042c247449cd0d5b827e1195
|
|
| MD5 |
254b78a75a0586ac39a8ce8b7324b802
|
|
| BLAKE2b-256 |
2a57d8ff127a6eae50cbd9fee63e92d365c225cc0e2119185b23111edd0b48eb
|