@mcrowe/html-purifier
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

html-purifier

Extract useful bits from huge html documents as fast as possible.

Usage

npm install @mcrowe/html-purifier --save

import HtmlPurifier from '@mcrowe/html-purifier'

const html = '<body><div></div><div id="rank">def<span>abc</span><script></script>123</div><div><section>toy<img class="my-image" src="hello" /> 123 </section></div></body>'

const result = HtmlPurifier.purify(html, [
  '#rank',
  '.my-image'
])

assert(
  result === '<div id="rank">def<span>abc</span>123</div><img class="my-image" src="hello" />'
)

Development

Install npm modules:

npm install

Run tests:

npm test

Release

Release a new version:

bin/release.sh

This will publish a new version to npm, as well as push a new tag up to github.

Readme

Keywords

none

Package Sidebar

Install

npm i @mcrowe/html-purifier

Weekly Downloads

462

Version

0.0.4

License

ISC

Last publish

Collaborators

  • mcrowe