# hast-util-insert

> A [hast][] utility to insert [nodes][] into a tree, at a location in the tree that is specified by a selector string.

Latest version **1.0.0** (published 2023-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install hast-util-insert
pnpm add hast-util-insert
yarn add hast-util-insert
bun add hast-util-insert
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-05-20 |
| First published | 2023-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | marekweb |

## Links

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

## Dependencies (1)

- [hast-util-select](https://npm.io/package/hast-util-select.md) ^5.0.5

## Recent versions

- 1.0.0 (latest) — 2023-05-20

## README

# hast-util-insert

A [hast][] utility to insert [nodes][] into a tree, at a location in the tree that is specified by a selector string.

## Install

This package is [ESM only][esm].

Install with [npm][]:

```sh
npm install hast-util-insert
```

In Deno with [esm.sh][esmsh]:

```js
import hastUtilInsert from "https://esm.sh/hast-util-insert@1";
```

In browsers with [esm.sh][esmsh]:

<script type="module">
  import hastUtilInsert from 'https://esm.sh/hast-util-insert@1?bundle'
</script>

## Use

```js
import { h } from "hastscript";
import {insert} from "hast-util-insert";

const tree = h("div", [h(".planet", "Jupiter")]);

hastUtilInsert(tree, ".planet", h("b", "inserted bold tag"), "append");

console.log(inspect(tree));
```

[npm]: https://docs.npmjs.com/cli/install

[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

[esmsh]: https://esm.sh

[typescript]: https://www.typescriptlang.org

[hast]: https://github.com/syntax-tree/hast

[nodes]: https://github.com/syntax-tree/hast#nodes

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