All Projects → GitbookIO → Tokenize Htmltext

GitbookIO / Tokenize Htmltext

Licence: apache-2.0
Tokenize HTML in an array of text tokens

Programming Languages

javascript
184084 projects - #8 most used programming language

tokenize-htmltext

Build Status NPM version

Tokenize an html string into a list of text tokens, it keeps reference to indexes in the original string.

Installation

$ npm install tokenize-htmltext

Usage

var tokenizeHTML = require('tokenize-htmltext');


var tokens = tokenizeHTML('<b>hello</b> world');

/*
[ { value: 'hello', index: 3, offset: 5 },
  { value: ' world', index: 12, offset: 6 } ]
*/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].