Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 870 Bytes

README.md

File metadata and controls

30 lines (20 loc) · 870 Bytes

strip

Strips HTML tags.

Install

$ npm install strip

Usage

strip('<p> hello <a href="http://foo.com/?q=123">world</a> </p>');
// => Hello World

strip('<p>My name is <b>Jon</b>.</p>');
// => Retrun "My name is Jon."

strip('<p>My name is <b>Jon</b>.</p><p>I love <a href="en.wikipedia/wiki/dogs">dogs</a>.</p>');
// => Retrun "My name is Jon. I love dogs."

strip('<p>My name is <b>Jon</b>.</p><p>I love <a href="en.wikipedia/wiki/dogs">dogs</a>.</p>', 'a');
// => "My name is Jon. I love <a href="en.wikipedia/wiki/dogs">dogs</a>."

strip('<p>My name is <b>Jon</b>.</p><p>I love <a href="en.wikipedia/wiki/dogs">dogs</a>.</p>', 'a|b');
// => "My name is <b>Jon</b>. I love <a href="en.wikipedia/wiki/dogs">dogs</a>."