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 rendering markdown, and 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-allowed-list
Use
import bleach from bleach_allowed_list import print_tags, print_attrs, all_styles bleach.clean(raw_html, print_tags, print_attrs, all_styles)
Properties:
markdown_tags: Safe HTML tags needed to render markdown-style markup.
markdown_attrs: Safe attributes tags needed to render markdown-style markup.
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_allowed_list.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 allowed-list 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
Built Distribution
Hashes for bleach-allowed-list-0.0.0a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ec3cbf1a6245e0674cf9cf2990a11cd0752a13a5410f1e794fc2d09aa6daa9c |
|
MD5 | eee96480eae51bd363852b42e3566288 |
|
BLAKE2b-256 | c07ff597b282870248b7f6bb92bca630fbd5acab57bbf780e2254e460a1c3684 |
Hashes for bleach_allowed_list-0.0.0a2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a6b79629e02f731aa40ab8f003a56ae5cab6f1e534b1a1ad6fe5f0758123484 |
|
MD5 | aaf66457a814356fc48f739e93a3110d |
|
BLAKE2b-256 | 60ad6284226de0de7d42f6d3c88ef189e1944857ae5957a37571e5595843bca7 |