Code Monkey home page Code Monkey logo

htmlfilter's Introduction

HTMLFilter

Website / Source Code

Description

HTML Filter library can be used to sanitize and sterilize HTML. A good idea if you let users submit HTML in comments, for instance.

This library also include CSSFilter. The CSSFilter class will clean-up a cascading style sheet. It can be used to remove whitespace and most importantly remove URLs.

Features

  • Based on well-worn PHP library.
  • Regular expression based filtering.
  • Very efficient for small snippets, like blog comments.
  • Pure-Ruby and no dependencies.
  • Also has library to clean and compact cascading stylesheets.

Synopsis

Via the class.

html = "<b>hello</b>"

HTMLFilter.new(options).filter(html)

Or using the String extension.

html.html_filter(options)  #=> "<b>hello</b>"

See API documentation for more information.

Installation

Of course, RubyGems is the answer:

$ gem install htmlfilter

Development

HTMLFilter is hosted on GitHub.

HTMLFilter is a Rubyworks project.

Acknowledgements

Thanks to Jang Kim for adding support for single quoted attributes.

HtmlFilter is a port of lib_filter.php, v1.15 by Cal Henderson [email protected]. This code is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. See http://creativecommons.org/licenses/by-sa/2.5/.

Copyrights

  • Copyright (c) 2009 Rubyworks (BSD-2-Clause)
  • Copyright (c) 2007 Cal Henderson (CC-BY-SA)

See LICENSE.txt and NOTICE.md for details.

htmlfilter's People

Contributors

dvwright avatar sagotsky avatar trans avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.