# innertext

> Extract the innerText from a snippet of HTML

Latest version **1.0.3** (published 2018-03-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install innertext
pnpm add innertext
yarn add innertext
bun add innertext
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-03-06 |
| First published | 2016-09-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Revin Guillen |
| Maintainers | revin |
| Keywords | html, markup, extract, innertext, inner, text |

## Links

- npm: https://www.npmjs.com/package/innertext
- Repository: https://github.com/revin/innertext
- Homepage: https://github.com/revin/innertext#readme
- Issues: https://github.com/revin/innertext/issues
- npm.io page: https://npm.io/package/innertext

## Dependencies (1)

- [html-entities](https://npm.io/package/html-entities.md) ^1.2.0

## 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

- 1.0.3 (latest) — 2018-03-06
- 1.0.2 — 2017-05-02
- 1.0.1 — 2016-09-23
- 1.0.0 — 2016-09-23

## README

# innertext

Extract the `innerText` from a snippet of HTML

[![Greenkeeper badge](https://badges.greenkeeper.io/revin/innertext.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/revin/innertext.svg?branch=master)](https://travis-ci.org/revin/innertext)
[![Code Climate](https://codeclimate.com/github/revin/innertext/badges/gpa.svg)](https://codeclimate.com/github/revin/innertext)

## Installation

```sh
npm install innertext
```

## Usage

Pass it a string containing some HTML.

```js
var innertext = require('innertext');

var text = innertext('<h1>Heading text <em>with</em> <b>some</b> <u>markup</u></h1>');

console.log(text); // 'Heading text with some markup'
```

## Correctness

The current implementation favors speed and simplicity over other considerations
like perfect web browser compatibility. For instance:

* malformed HTML (e.g., un-encoded `<` &amp; `>` characters, etc&hellip;)
  will generally break the text extraction process
* whitespace around HTML tag/element boundaries gets collapsed into a single
  space, whereas browsers will typically preserve newlines

So if you trust the incoming HTML, things will typically be OK, but don't use
this as the basis for creating a browser or anything.

## Tests

```sh
npm install
npm test
```

## License

ISC

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