Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bleach-whitelist-0.0.2.tar.gz (7.0 kB view details)

Uploaded Source

File details

Details for the file bleach-whitelist-0.0.2.tar.gz.

File metadata

File hashes

Hashes for bleach-whitelist-0.0.2.tar.gz
Algorithm Hash digest
SHA256 82729d9dcb1dcfb01a8a2a6106bf77190652620c042c247449cd0d5b827e1195
MD5 254b78a75a0586ac39a8ce8b7324b802
BLAKE2b-256 2a57d8ff127a6eae50cbd9fee63e92d365c225cc0e2119185b23111edd0b48eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page