0.1.2 • Published 5 years ago

insert-tag v0.1.2

Weekly downloads
15
License
MIT
Repository
github
Last release
5 years ago

insert-tag

Build Status Greenkeeper badge

Insert tag to the specific position of a xml/html string:

<a>xxx<b>yyy</b>zzz<a>

to

<a>xx<mark>x<b>yy</b></mark><b>y</b>zzz<a>

Getting started

Installation

npm install insert-tag --save

Usage

import insertTag from 'insert-tag';

insertTag('<a>xxx<b>yyy</b>zzz<a>', '<mark>', [0, 2, 0, 5]);
// <a>xx<mark>x<b>yy</b></mark><b>y</b>zzz<a>

[0, 2, 0, 5] meas from line 0, column 2 to line 0, column 5

For more examples, please see tests

Tests

npm run test