Giter VIP home page Giter VIP logo

bleach-whitelist's Introduction

Bleach Whitelist

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-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:

  • 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_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.

bleach-whitelist's People

Contributors

divad avatar jchristgit avatar liuenyan avatar yourcelf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.