npm.io
1.1.1 • Published 7 years ago

parse-html-text-content

Licence
ISC
Version
1.1.1
Deps
3
Size
64 kB
Vulns
1
Weekly
0

ParseHtmlTextContent

parse the textContent of all elements of the html text without having to create a DOM from the html

Uses regex to filter out text between & including chars: <, > If the html text is has those characters encoded, this should work smoothly; otherwise, it would parse the wrong values. After parsing, it also decodes the html entities.

Install

npm i -S parse-html-text-content

Usage

const parseTextContent = require('parse-html-text-content');

const htmlText = '<p>hello world</p>';
console.log(parseTextContent(htmlText)); // hello world

Keywords