htmlCutter v0.3.0
HTMLCutter
A node package that do two things better :
cutHTML : removes all the special characters in the html string so that they can be displayed on the page without execution , as a plain string. Prevents JS injection and can be used where we need to display the html code into our web page.
eg: Hii! will be converted into <h1>Hii!</h1> .
toHTML : reverse of what cutHTML do.It converts the string obtained from the cutHTML back into the html string.
eg: <h1>Hii!</h1> will be converted to Hii!
Installation
npm install htmlCutter --save
Usage
var htmlCutter = require('htmlCutter'), cutHTML = htmlCutter.cutHTML, toHTML = htmlCutter.toHTML;
var html = "hi!", safeString = cutHTML(html), htmlString = toHTML(safeString);
console.log('html', html, 'Safe String', safeString, 'htmlString', htmlString);
Tests
npm test
Release History 0.3.0 Initial Release