# htmlstrip-native

> Strip html tags with ease and efficiency

Latest version **0.3.0** (published 2019-04-11) · 0 weekly downloads

## Install

```sh
npm install htmlstrip-native
pnpm add htmlstrip-native
yarn add htmlstrip-native
bun add htmlstrip-native
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2019-04-11 |
| First published | 2013-06-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 406.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 19 |
| Author | Svetlozar Argirov |
| Maintainers | zaro |
| Keywords | html, strip, tag, entities |

## Links

- npm: https://www.npmjs.com/package/htmlstrip-native
- Repository: https://github.com/zaro/node-htmlstrip-native
- Homepage: https://github.com/zaro/node-htmlstrip-native#readme
- Issues: https://github.com/zaro/node-htmlstrip-native/issues
- npm.io page: https://npm.io/package/htmlstrip-native

## Dependencies (1)

- [nan](https://npm.io/package/nan.md) ^2.13.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2019-04-11
- 0.1.4 — 2018-03-14
- 0.1.3 — 2015-10-02
- 0.1.2 — 2015-10-02
- 0.1.1 — 2015-03-11
- 0.1.0 — 2015-02-26
- 0.0.6 — 2014-12-04
- 0.0.5 — 2014-12-03
- 0.0.4 — 2014-10-10
- 0.0.3 — 2014-10-07
- 0.0.2 — 2013-06-20
- 0.0.1 — 2013-06-19

## README

#Simple HTML tags stripping library


## Install

via npm:

    npm install htmlstrip-native

from source [![Build Status](https://travis-ci.org/zaro/node-htmlstrip-native.svg?branch=master)](https://travis-ci.org/zaro/node-htmlstrip-native) :

    git clone git://github.com/zaro/node-htmlstrip-native.git
    cd node-htmlstrip-native
    npm install

## Use

Example:
```js
var html_strip = require('htmlstrip-native');

var html = '<style>b {color: red;}</style>' +
					 ' Yey, <b> No more, tags</b>' +
					 '<script>document.write("Hello from Javascript")</script>';
var options = {
	include_script : false,
	include_style : false,
	compact_whitespace : true,
  include_attributes : { 'alt': true }
};

// Strip tags and decode HTML entities
var text = html_strip.html_strip(html,options);

console.log(text)

// Decode HTML entities only
var no_entities = html_strip.html_entities_decode('Hello &smile;')
```

The html_strip function expects either a string as first argument or a 'utf-16le',
encoded Buffer. The optional second argument can hold the following options:

```js
{
  include_script : true, // include the content of <script> tags
  include_style : true, // include the content of <style> tags
  compact_whitespace : false // compact consecutive '\s' whitespace into single char
  include_attributes : { // include attribute values in the output
    '*':true ,  // special value, means : Include ALL attributes
    'alt': true , // include attributes named 'alt'
  }
}
```

## Speed

Same thing can be achieved really simply without native modules with htmlparser2 for example.
This module is ~30 times faster than using htmlparser2.

---
_Source: https://npm.io/package/htmlstrip-native · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
