insert-tag
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i insert-tag

Weekly Downloads

49

Version

0.1.2

License

MIT

Unpacked Size

44.9 kB

Total Files

17

Last publish

Collaborators

  • xcatliu