https://github.com/rubyworks/htmlfilter
Clean HTML/CSS
https://github.com/rubyworks/htmlfilter
Last synced: 6 months ago
JSON representation
Clean HTML/CSS
- Host: GitHub
- URL: https://github.com/rubyworks/htmlfilter
- Owner: rubyworks
- License: other
- Created: 2009-09-09T02:38:17.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2012-12-14T02:58:46.000Z (about 13 years ago)
- Last Synced: 2025-08-10T23:37:42.109Z (6 months ago)
- Language: Ruby
- Homepage: http://rubyworks.github.com/htmlfilter
- Size: 741 KB
- Stars: 9
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# HTMLFilter
[Website](http://rubyworks.github.com/htmlfilter) /
[Source Code](http://github.com/rubyworks/htmlfilter)
## 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 = "hello"
HTMLFilter.new(options).filter(html)
Or using the String extension.
html.html_filter(options) #=> "hello"
See API documentation for more information.
## Installation
Of course, RubyGems is the answer:
$ gem install htmlfilter
## Development
HTMLFilter is hosted on [GitHub](http://github.com/rubyworks/htmlfilter).
HTMLFilter is a [Rubyworks](http://rubyworks.github.com) 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 .
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.