html-segmentator
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

HTML Segmentator

A small library for splitting an HTML string into its top-level sections. Based on html5parser.

Install

npm install --save html-segmentator

Usage

import segmentator from 'html-segmentator';

// Splitting an HTML string into its top-level sections

const html = '<div><b>foo</b></div><i>bar</i>';
const segments = segmentator ( html );

console.log ( segments );
// [
//   { start: 0, end: 21 },
//   { start: 21, end: 31 }
// ]

License

  • Library MIT © Fabio Spampinato.
  • Tokenizer MIT © html5parser.

Package Sidebar

Install

npm i html-segmentator

Weekly Downloads

18

Version

3.0.3

License

none

Unpacked Size

41.8 kB

Total Files

19

Last publish

Collaborators

  • fabiospampinato