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 = ;var html = '<p>Hello World</p>'; console; // 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; // Testing Hello World cleanse;console; // <p>Hello World</p>
API
Create instance
var cleanse = ;
Clease text
;
- 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