@@ -35,8 +35,9 @@ from a [hast][github-hast] (HTML) syntax tree.
3535## When should I use this?
3636
3737You can use this project when you want to turn hast into a DOM in browsers,
38- either to use it directly on a page, or to enable the use of DOM APIs (such as
39- ` querySelector ` to find things or ` innerHTML ` to serialize stuff).
38+ either to use it directly on a page,
39+ or to enable the use of DOM APIs
40+ (such as ` querySelector ` to find things or ` innerHTML ` to serialize stuff).
4041
4142The hast utility [ ` hast-util-from-dom ` ] [ github-hast-util-from-dom ] does the
4243inverse of this utility.
@@ -48,7 +49,8 @@ this utility to serialize as HTML with DOM APIs.
4849## Install
4950
5051This package is [ ESM only] [ github-gist-esm ] .
51- In Node.js (version 16+), install with [ npm] [ npmjs-install ] :
52+ In Node.js (version 16+),
53+ install with [ npm] [ npmjs-install ] :
5254
5355``` sh
5456npm install hast-util-to-dom
@@ -89,8 +91,10 @@ Say our page `example.html` looks as follows:
8991 </script >
9092```
9193
92- Now running ` open example.html ` shows the ` main ` , ` h1 ` , and ` p ` elements on the
93- page.
94+ Now running ` open example.html ` shows the
95+ ` main ` ,
96+ ` h1 ` ,
97+ and ` p ` elements on the page.
9498
9599## API
96100
@@ -103,9 +107,11 @@ Turn a hast tree into a DOM tree.
103107
104108###### Parameters
105109
106- * ` tree ` ([ ` HastNode ` ] [ github-hast-nodes ] )
110+ * ` tree `
111+ ([ ` HastNode ` ] [ github-hast-nodes ] )
107112 — tree to transform
108- * ` options ` ([ ` Options ` ] [ api-options ] , optional)
113+ * ` options `
114+ ([ ` Options ` ] [ api-options ] , optional)
109115 — configuration
110116
111117###### Returns
@@ -133,13 +139,17 @@ Configuration (TypeScript type).
133139
134140###### Fields
135141
136- * ` afterTransform ` ([ ` AfterTransform ` ] [ api-after-transform ] , optional)
142+ * ` afterTransform `
143+ ([ ` AfterTransform ` ] [ api-after-transform ] , optional)
137144 — callback called when each node is transformed
138- * ` document ` (` Document ` , default: ` globalThis.document ` )
145+ * ` document `
146+ (` Document ` , default: ` globalThis.document ` )
139147 — document interface to use.
140- * ` fragment ` (` boolean ` , default: ` false ` )
148+ * ` fragment `
149+ (` boolean ` , default: ` false ` )
141150 — whether to return a DOM fragment (` true ` ) or a whole document (` false ` )
142- * ` namespace ` (` string ` , default: depends)
151+ * ` namespace `
152+ (` string ` , default: depends)
143153 — namespace to use to create elements
144154
145155## Syntax tree
@@ -157,9 +167,10 @@ It exports the additional types [`AfterTransform`][api-after-transform] and
157167Projects maintained by the unified collective are compatible with maintained
158168versions of Node.js.
159169
160- When we cut a new major release, we drop support for unmaintained versions of
161- Node.
162- This means we try to keep the current release line, ` hast-util-to-dom@^4 ` ,
170+ When we cut a new major release,
171+ we drop support for unmaintained versions of Node.
172+ This means we try to keep the current release line,
173+ ` hast-util-to-dom@4 ` ,
163174compatible with Node.js 16.
164175
165176## Security
0 commit comments