Skip to main content

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.

Release files for bleach-allowlist 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bleach-allowlist 1.0.3
File Size Uploaded
bleach-allowlist-1.0.3.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bleach-allowlist 1.0.3
File Interpreter ABI Platform
bleach_allowlist-1.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 17.3 kB

Release files / bleach-allowlist-1.0.3.tar.gz

Download URL bleach-allowlist-1.0.3.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
56e22086079a0e6a3100ae99e4dbaf20eb2585486598eb0e994008a11428da9b
BLAKE2b-256 checksum
How to use checksums
046d039eca1770f7667d0967d299a1e6d47ad88acde03fcd2076a11e57ff51b4
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / bleach_allowlist-1.0.3-py2.py3-none-any.whl

Download URL bleach_allowlist-1.0.3-py2.py3-none-any.whl
Size 9.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6427a3ac0baddf549703f1003ea53f411f3d7888524c94c00eb6ef1deb378899
BLAKE2b-256 checksum
How to use checksums
e86b927c955e350468e4c1a2a7fc73ef2d6197f66ab88f21fc259f3b543db3ed
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page