innertext

WebJar for innertext

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

innertext
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

innertext
WebJar for innertext
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/revin/innertext

Download innertext

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/innertext/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>innertext</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/innertext/
implementation 'org.webjars.npm:innertext:1.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/innertext/
implementation ("org.webjars.npm:innertext:1.0.3")
'org.webjars.npm:innertext:jar:1.0.3'
<dependency org="org.webjars.npm" name="innertext" rev="1.0.3">
  <artifact name="innertext" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='innertext', version='1.0.3')
)
libraryDependencies += "org.webjars.npm" % "innertext" % "1.0.3"
[org.webjars.npm/innertext "1.0.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : html-entities jar [1.2.0,2)

Project Modules

There are no modules declared in this project.

innertext

Extract the innerText from a snippet of HTML

Greenkeeper badge Build Status Code Climate

Installation

npm install innertext

Usage

Pass it a string containing some HTML.

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 < & > characters, etc…) 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

npm install
npm test

License

ISC

Versions

Version
1.0.3