11# hast-util-to-xast
22
3- [ ![ Build] [ build-badge ]] [ build ]
4- [ ![ Coverage] [ coverage-badge ]] [ coverage ]
5- [ ![ Downloads] [ downloads-badge ]] [ downloads ]
6- [ ![ Size] [ size-badge ]] [ size ]
7- [ ![ Sponsors] [ sponsors-badge ]] [ collective ]
8- [ ![ Backers] [ backers-badge ]] [ collective ]
9- [ ![ Chat] [ chat-badge ]] [ chat ]
3+ [ ![ Build] [ badge-build-image ]] [ badge-build-url ]
4+ [ ![ Coverage] [ badge-coverage-image ]] [ badge-coverage-url ]
5+ [ ![ Downloads] [ badge-downloads-image ]] [ badge-downloads-url ]
6+ [ ![ Size] [ badge-size-image ]] [ badge-size-url ]
107
11- [ hast] [ ] (HTML) utility to transform to [ xast] [ ] (XML).
8+ [ hast] [ github-hast ] (HTML) utility to transform to [ xast] [ github-xast ] (XML).
129
1310## Contents
1411
15- * [ What is this?] ( #what-is-this )
16- * [ When should I use this?] ( #when-should-i-use-this )
17- * [ Install] ( #install )
18- * [ Use] ( #use )
19- * [ API] ( #api )
20- * [ ` toXast(tree[, options]) ` ] ( #toxasttree-options )
21- * [ ` Options ` ] ( #options )
22- * [ ` Space ` ] ( #space-1 )
23- * [ Types] ( #types )
24- * [ Compatibility] ( #compatibility )
25- * [ Security] ( #security )
26- * [ Related] ( #related )
27- * [ Contribute] ( #contribute )
28- * [ License] ( #license )
12+ * [ What is this?] ( #what-is-this )
13+ * [ When should I use this?] ( #when-should-i-use-this )
14+ * [ Install] ( #install )
15+ * [ Use] ( #use )
16+ * [ API] ( #api )
17+ * [ ` toXast(tree[, options]) ` ] ( #toxasttree-options )
18+ * [ ` Options ` ] ( #options )
19+ * [ ` Space ` ] ( #space-1 )
20+ * [ Types] ( #types )
21+ * [ Compatibility] ( #compatibility )
22+ * [ Security] ( #security )
23+ * [ Related] ( #related )
24+ * [ Contribute] ( #contribute )
25+ * [ License] ( #license )
2926
3027## What is this?
3128
32- This package is a utility that takes a [ hast] [ ] (HTML) syntax tree as input and
33- turns it into a [ xast] [ ] (XML) syntax tree.
29+ This package is a utility that takes a
30+ [ hast] [ github-hast ] (HTML)
31+ syntax tree as input and turns it into a
32+ [ xast] [ github-xast ] (XML)
33+ syntax tree.
3434This package also supports embedded MDX nodes.
3535
3636## When should I use this?
@@ -41,13 +41,15 @@ One example of this is for EPUB (digital books).
4141
4242There is no inverse of this utility, because not all XML is HTML.
4343
44- A similar package, [ ` hast-util-to-estree ` ] [ hast-util-to-estree ] , can turn
45- hast into estree (JavaScript) as JSX, which has some similarities to XML.
44+ A similar package, [ ` hast-util-to-estree ` ] [ github-hast-util-to-estree ] ,
45+ can turn hast into estree (JavaScript) as JSX,
46+ which has some similarities to XML.
4647
4748## Install
4849
49- This package is [ ESM only] [ esm ] .
50- In Node.js (version 16+), install with [ npm] [ ] :
50+ This package is [ ESM only] [ github-gist-esm ] .
51+ In Node.js (version 16+), install with
52+ [ npm] [ npmjs-install ] :
5153
5254``` sh
5355npm install hast-util-to-xast
@@ -56,14 +58,14 @@ npm install hast-util-to-xast
5658In Deno with [ ` esm.sh ` ] [ esmsh ] :
5759
5860``` js
59- import {toXast } from " https://esm.sh/hast-util-to-xast@3"
61+ import {toXast } from ' https://esm.sh/hast-util-to-xast@3'
6062```
6163
6264In browsers with [ ` esm.sh ` ] [ esmsh ] :
6365
6466``` html
6567<script type =" module" >
66- import {toXast } from " https://esm.sh/hast-util-to-xast@3?bundle"
68+ import {toXast } from ' https://esm.sh/hast-util-to-xast@3?bundle'
6769 </script >
6870```
6971
@@ -110,18 +112,18 @@ There is no default export.
110112
111113### ` toXast(tree[, options]) `
112114
113- Turn a [ hast] [ ] tree into a [ xast] [ ] tree.
115+ Turn a [ hast] [ github-hast ] tree into a [ xast] [ github-xast ] tree.
114116
115117###### Parameters
116118
117- * ` tree ` ([ ` HastNode ` ] [ hast-node ] )
118- — hast tree to transform
119- * ` options ` ([ ` Options ` ] [ api-options ] , optional)
120- — configuration
119+ * ` tree ` ([ ` HastNode ` ] [ github- hast-nodes ] )
120+ — hast tree to transform
121+ * ` options ` ([ ` Options ` ] [ api-options ] , optional)
122+ — configuration
121123
122124###### Returns
123125
124- xast tree ([ ` XastNode ` ] [ xast-node ] ).
126+ xast tree ([ ` XastNode ` ] [ github- xast-nodes ] ).
125127
126128### ` Options `
127129
@@ -168,94 +170,86 @@ compatible with Node.js 16.
168170## Security
169171
170172Both HTML and XML can be dangerous languages: don’t trust user-provided data.
171- Use [ ` hast -util -santize ` ][hast-util-sanitize] to make the hast tree safe before
172- using this utility.
173+ Use [ ` hast -util -santize ` ][github- hast-util-sanitize]
174+ to make the hast tree safe before using this utility.
173175
174176## Related
175177
176- * [ ` hastscript ` ](https://github.com/syntax-tree/hastscript)
177- — create ** [hast][]** (HTML or SVG) trees
178- * [ ` xastscript ` ](https://github.com/syntax-tree/xastscript)
179- — create ** [xast][]** (XML) trees
180- * [ ` xast -util -to -xml ` ](https://github.com/syntax-tree/xast-util-to-xml)
181- — serialize as XML
178+ * [ ` hastscript ` ](https://github.com/syntax-tree/hastscript)
179+ — create [hast][github-hast] (HTML or SVG) trees
180+ * [ ` xastscript ` ](https://github.com/syntax-tree/xastscript)
181+ — create [xast][github-xast] (XML) trees
182+ * [ ` xast -util -to -xml ` ](https://github.com/syntax-tree/xast-util-to-xml)
183+ — serialize as XML
182184
183185## Contribute
184186
185- See [ ` contributing .md ` ][contributing] in [ ` syntax -tree /.github ` ][health] for
186- ways to get started.
187- See [ ` support .md ` ][support] for ways to get help.
187+ See [ ` contributing .md ` ][health-contributing]
188+ in
189+ [ ` syntax -tree /.github ` ][health]
190+ for ways to get started.
191+ See [ ` support .md ` ][health-support] for ways to get help.
188192
189- This project has a [code of conduct][coc].
193+ This project has a [code of conduct][health- coc].
190194By interacting with this repository, organization, or community you agree to
191195abide by its terms.
192196
193197## License
194198
195- [MIT][license] © [Titus Wormer][author ]
199+ [MIT][file- license] © [Titus Wormer][wooorm ]
196200
197201<!-- Definitions -->
198202
199- [build-badge]: https://github.com/syntax-tree/hast-util-to-xast/workflows/main/badge.svg
200-
201- [build]: https://github.com/syntax-tree/hast-util-to-xast/actions
202-
203- [coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-to-xast.svg
204-
205- [coverage]: https://codecov.io/github/syntax-tree/hast-util-to-xast
206-
207- [downloads-badge]: https://img.shields.io/npm/dm/hast-util-to-xast.svg
203+ [api-options]: #options
208204
209- [downloads ]: https://www.npmjs.com/package/hast-util-to-xast
205+ [api-space ]: #space-1
210206
211- [size-badge ]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-to-xast
207+ [api-to-xast ]: #toxasttree-options
212208
213- [size ]: https://bundlejs .com/?q= hast-util-to-xast
209+ [badge-build-image ]: https://github .com/syntax-tree/ hast-util-to-xast/workflows/main/badge.svg
214210
215- [sponsors- badge]: https://opencollective .com/unified/sponsors/badge.svg
211+ [badge-build-url ]: https://github .com/syntax-tree/hast-util-to-xast/actions
216212
217- [backers- badge]: https://opencollective.com/unified/backers/badge .svg
213+ [badge-coverage-image ]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-to-xast .svg
218214
219- [collective ]: https://opencollective.com/unified
215+ [badge-coverage-url ]: https://codecov.io/github/syntax-tree/hast-util-to-xast
220216
221- [chat- badge]: https://img.shields.io/badge/chat-discussions-success .svg
217+ [badge-downloads-image ]: https://img.shields.io/npm/dm/hast-util-to-xast .svg
222218
223- [chat ]: https://github. com/syntax-tree/unist/discussions
219+ [badge-downloads-url ]: https://www.npmjs. com/package/hast-util-to-xast
224220
225- [npm ]: https://docs.npmjs.com/cli/install
221+ [badge-size-image ]: https://img.shields.io/bundlejs/size/hast-util-to-xast
226222
227- [esm ]: https://gist.github. com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
223+ [badge-size-url ]: https://bundlejs. com/?q=hast-util-to-xast
228224
229225[esmsh]: https://esm.sh
230226
231- [typescript ]: https://www.typescriptlang.org
227+ [file-license ]: license
232228
233- [license ]: license
229+ [github-gist-esm ]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
234230
235- [author ]: https://wooorm .com
231+ [github-hast ]: https://github .com/syntax-tree/hast
236232
237- [health]: https://github.com/syntax-tree/.github
238-
239- [contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
233+ [github-hast-nodes]: https://github.com/syntax-tree/hast#nodes
240234
241- [support ]: https://github.com/syntax-tree/.github/blob/main/support.md
235+ [github-hast-util-sanitize ]: https://github.com/syntax-tree/hast-util-sanitize
242236
243- [coc ]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
237+ [github-hast-util-to-estree ]: https://github.com/syntax-tree/hast-util-to-estree
244238
245- [hast ]: https://github.com/syntax-tree/hast
239+ [github-xast ]: https://github.com/syntax-tree/xast
246240
247- [hast-node ]: https://github.com/syntax-tree/hast #nodes
241+ [github-xast-nodes ]: https://github.com/syntax-tree/xast #nodes
248242
249- [hast-util-sanitize ]: https://github.com/syntax-tree/hast-util-sanitize
243+ [health ]: https://github.com/syntax-tree/.github
250244
251- [hast-util-to-estree ]: https://github.com/syntax-tree/hast-util-to-estree
245+ [health-coc ]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
252246
253- [xast ]: https://github.com/syntax-tree/xast
247+ [health-contributing ]: https://github.com/syntax-tree/.github/blob/main/contributing.md
254248
255- [xast-node ]: https://github.com/syntax-tree/xast#nodes
249+ [health-support ]: https://github.com/syntax-tree/.github/blob/main/support.md
256250
257- [api-to-xast ]: #toxasttree-options
251+ [npmjs-install ]: https://docs.npmjs.com/cli/install
258252
259- [api-options ]: #options
253+ [typescript ]: https://www.typescriptlang.org
260254
261- [api-space ]: #space-1
255+ [wooorm ]: https://wooorm.com
0 commit comments