1.0.0 • Published 12 months ago

hast-util-insert v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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.

Install with npm:

npm install hast-util-insert

In Deno with esm.sh:

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

In browsers with esm.sh:

Use

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));
1.0.0

12 months ago