0.0.5 • Published 9 years ago

cleanse-html v0.0.5

Weekly downloads
3
License
-
Repository
github
Last release
9 years ago

cleanse-html

Simple tool to remove html from a string and returns a string of plain text

Installation

npm install cleanse-html

Simple Examples

var cleanse = require('cleanse-html');
var html = '<p>Hello World</p>';

console.log(cleanse(html)); // Hello World

//To select things you want to keep, pass an options object as the second parameter
//or call configure() with the options object (see below for options)
html = "<head><title>Testing</title></head><p>Hello World</p>";
console.log(cleanse(html,{head:false})); // Testing Hello World

cleanse.configure({head:true,html:false});
console.log(cleanse(html)); // <p>Hello World</p>

API

Create instance

var cleanse = require('cleanse-html');

Clease text

cleanse(string,options);
  • string is the text that you want to cleanse.
  • options is an optional settings object describing what to cleanse:
    • entity (bool) remove/ignore HTML entities (names and numbers). Defaults to true.
    • head (bool) remove/ignore section. Defaults to true.
    • script (bool) remove/ignore section. Defaults to true.
    • iframe (bool) remove/ignore . Defaults to true.
    • style (bool) remove/ignore section. Defaults to true.
    • html (bool) remove/ignore standard HTML tags. Defaulte to true.
0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago