@@ -35,21 +35,24 @@ This package also supports embedded MDX nodes.
35
35
36
36
## When should I use this?
37
37
38
- This project is useful when you want to deal with ASTs, and for some reason,
38
+ This project is useful when you want to deal with ASTs,
39
+ and for some reason,
39
40
* have* to deal with XML.
40
41
One example of this is for EPUB (digital books).
41
42
42
- There is no inverse of this utility, because not all XML is HTML.
43
+ There is no inverse of this utility,
44
+ because not all XML is HTML.
43
45
44
- A similar package, [ ` hast-util-to-estree ` ] [ github-hast-util-to-estree ] ,
46
+ A similar package,
47
+ [ ` hast-util-to-estree ` ] [ github-hast-util-to-estree ] ,
45
48
can turn hast into estree (JavaScript) as JSX,
46
49
which has some similarities to XML.
47
50
48
51
## Install
49
52
50
53
This package is [ ESM only] [ github-gist-esm ] .
51
- In Node.js (version 16+), install with
52
- [ npm] [ npmjs-install ] :
54
+ In Node.js (version 16+),
55
+ install with [ npm] [ npmjs-install ] :
53
56
54
57
``` sh
55
58
npm install hast-util-to-xast
@@ -116,9 +119,11 @@ Turn a [hast][github-hast] tree into a [xast][github-xast] tree.
116
119
117
120
###### Parameters
118
121
119
- * ` tree ` ([ ` HastNode ` ] [ github-hast-nodes ] )
122
+ * ` tree `
123
+ ([ ` HastNode ` ] [ github-hast-nodes ] )
120
124
— hast tree to transform
121
- * ` options ` ([ ` Options ` ] [ api-options ] , optional)
125
+ * ` options `
126
+ ([ ` Options ` ] [ api-options ] , optional)
122
127
— configuration
123
128
124
129
###### Returns
@@ -133,13 +138,15 @@ Configuration (TypeScript type).
133
138
134
139
###### ` space `
135
140
136
- Which space the document is in ([ ` Space ` ] [ api-space ] , default: ` 'html' ` ).
141
+ Which space the document is in
142
+ ([ ` Space ` ] [ api-space ] , default: ` 'html' ` ).
137
143
138
- When an ` <svg> ` element is found in the HTML space, this package already
139
- automatically switches to and from the SVG space when entering and exiting it.
144
+ When an ` <svg> ` element is found in the HTML space,
145
+ this package already automatically switches to and from the SVG space when
146
+ entering and exiting it.
140
147
141
- You can also switch explicitly with ` xmlns ` properties in hast, but note that
142
- only HTML and SVG are supported.
148
+ You can also switch explicitly with ` xmlns ` properties in hast,
149
+ but note that only HTML and SVG are supported.
143
150
144
151
### ` Space `
145
152
@@ -162,14 +169,16 @@ It exports the additional types [`Options`][api-options] and
162
169
Projects maintained by the unified collective are compatible with maintained
163
170
versions of Node.js.
164
171
165
- When we cut a new major release, we drop support for unmaintained versions of
166
- Node.
167
- This means we try to keep the current release line, ` hast -util -to -xast @^3 ` ,
172
+ When we cut a new major release,
173
+ we drop support for unmaintained versions of Node.
174
+ This means we try to keep the current release line,
175
+ ` hast -util -to -xast @3 ` ,
168
176
compatible with Node.js 16.
169
177
170
178
## Security
171
179
172
- Both HTML and XML can be dangerous languages: don’t trust user-provided data.
180
+ Both HTML and XML can be dangerous languages:
181
+ don’t trust user-provided data.
173
182
Use [ ` hast -util -santize ` ][github-hast-util-sanitize]
174
183
to make the hast tree safe before using this utility.
175
184
@@ -191,8 +200,9 @@ for ways to get started.
191
200
See [ ` support .md ` ][health-support] for ways to get help.
192
201
193
202
This project has a [code of conduct][health-coc].
194
- By interacting with this repository, organization, or community you agree to
195
- abide by its terms.
203
+ By interacting with this repository,
204
+ organization,
205
+ or community you agree to abide by its terms.
196
206
197
207
## License
198
208
0 commit comments