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 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?).


pip install bleach-allowlist


import bleach
from bleach_allowlist import print_tags, print_attrs, all_styles

bleach.clean(raw_html, print_tags, print_attrs, all_styles)


  • 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 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 allow-lists 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-allowlist-1.0.3.tar.gz (7.7 kB view hashes)

Uploaded source

Built Distribution

bleach_allowlist-1.0.3-py2.py3-none-any.whl (9.6 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page