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

Installation

pip install bleach-allowlist

Use

import bleach
from bleach_allowlist 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_allowlist.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 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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file bleach-allowlist-1.0.3.tar.gz.

File metadata

  • Download URL: bleach-allowlist-1.0.3.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9

File hashes

Hashes for bleach-allowlist-1.0.3.tar.gz
Algorithm Hash digest
SHA256 56e22086079a0e6a3100ae99e4dbaf20eb2585486598eb0e994008a11428da9b
MD5 bd912d8ad4e900dc608e9b7de3226835
BLAKE2b-256 046d039eca1770f7667d0967d299a1e6d47ad88acde03fcd2076a11e57ff51b4

See more details on using hashes here.

File details

Details for the file bleach_allowlist-1.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: bleach_allowlist-1.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9

File hashes

Hashes for bleach_allowlist-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6427a3ac0baddf549703f1003ea53f411f3d7888524c94c00eb6ef1deb378899
MD5 47ca98877dd9e7d33d6e0fcd78725fd6
BLAKE2b-256 e86b927c955e350468e4c1a2a7fc73ef2d6197f66ab88f21fc259f3b543db3ed

See more details on using hashes here.

Supported by

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