insert-tag
v0.1.2
Published
Insert tag to the specific position of a xml/html string
Downloads
122
Readme
insert-tag
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