# insert-tag

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

Latest version **0.1.2** (published 2019-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install insert-tag
pnpm add insert-tag
yarn add insert-tag
bun add insert-tag
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2019-07-17 |
| First published | 2019-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 43.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | xcatliu |
| Maintainers | xcatliu |

## Links

- npm: https://www.npmjs.com/package/insert-tag
- Repository: https://github.com/xcatliu/insert-tag
- Homepage: https://github.com/xcatliu/insert-tag#readme
- Issues: https://github.com/xcatliu/insert-tag/issues
- npm.io page: https://npm.io/package/insert-tag

## Recent versions

- 0.1.2 (latest) — 2019-07-17
- 0.1.1 — 2019-07-17
- 0.1.0 — 2019-06-25

## README

# insert-tag

[![Build Status](https://travis-ci.org/xcatliu/insert-tag.svg?branch=master)](https://travis-ci.org/xcatliu/insert-tag) [![Greenkeeper badge](https://badges.greenkeeper.io/xcatliu/insert-tag.svg)](https://greenkeeper.io/)

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

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

to

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

## Getting started

### Installation

```bash
npm install insert-tag --save
```

### Usage

```js
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](./test/index.ts)

## Tests

```bash
npm run test
```

---
_Source: https://npm.io/package/insert-tag · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
