Skip to content
This repository was archived by the owner on Dec 21, 2018. It is now read-only.

stage3systems/node-html5-purifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-html5-purifier

Code Climate

Purify dirty HTML and CSS into standards compliant and namespaced code.

Cleans up any input into standards compliant DOM safe code, both CSS and HTML5.

Can pass in prefix and postfix values for namespacing all elements, id's and classes within the html.

purifier.purify(html, options, cb);

Examples

Sanitize unsafe HTML

	var purifier = require('html5-purifier');
	var html = '<b onmouseover=alert('boo!')>click me!</b>';
	var options = {};
	purifier.purify(html, options, cb);

Returns:

<b>click me!</b>

Prefix and Postfix css classes

	var purifier = require('html5-purifier');
	var html = 'hello<span>world</a>';
	var options = { prefix: 'abc-', postfix: 'abc' };
	purifier.purify(html, options, cb);

Returns:

hello<span class="abc">world</span>

About

Purify unsafe HTML and CSS into standards compliant and namespaced code.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors