@@ -21,6 +21,7 @@ and `matches`.
2121 * [ ` matches(selector, node[, space]) ` ] ( #matchesselector-node-space )
2222 * [ ` select(selector, tree[, space]) ` ] ( #selectselector-tree-space )
2323 * [ ` selectAll(selector, tree[, space]) ` ] ( #selectallselector-tree-space )
24+ * [ ` Space ` ] ( #space )
2425* [ Support] ( #support )
2526* [ Unsupported] ( #unsupported )
2627* [ Types] ( #types )
@@ -55,7 +56,7 @@ find and match any unist node.
5556## Install
5657
5758This package is [ ESM only] [ esm ] .
58- In Node.js (version 14.14+, 16.0+), install with [ npm] [ ] :
59+ In Node.js (version 14.14+ and 16.0+), install with [ npm] [ ] :
5960
6061``` sh
6162npm install hast-util-select
@@ -102,7 +103,8 @@ console.log(selectAll('h1 ~ :nth-child(even)', tree))
102103
103104## API
104105
105- This package exports the identifiers ` matches ` , ` select ` , and ` selectAll ` .
106+ This package exports the identifiers [ ` matches ` ] [ matches ] , [ ` select ` ] [ select ] ,
107+ and [ ` selectAll ` ] [ selectall ] .
106108There is no default export.
107109
108110### ` matches(selector, node[, space]) `
@@ -120,7 +122,7 @@ This only checks that the given element matches the selector.
120122 — CSS selector, such as (` h1 ` , ` a, b ` )
121123* ` node ` ([ ` Node ` ] [ node ] , optional)
122124 — node that might match ` selector ` , should be an element
123- * ` space ` (` 'svg' ` or ` 'html' ` , default: ` 'html' ` )
125+ * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
124126 — name of namespace
125127
126128###### Returns
@@ -153,7 +155,7 @@ Searches the tree in *[preorder][]*.
153155 — CSS selector, such as (` h1 ` , ` a, b ` )
154156* ` tree ` ([ ` Node ` ] [ node ] , optional)
155157 — tree to search
156- * ` space ` (` 'svg' ` or ` 'html' ` , default: ` 'html' ` )
158+ * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
157159 — name of namespace
158160
159161###### Returns
@@ -193,15 +195,15 @@ Yields:
193195### ` selectAll(selector, tree[, space]) `
194196
195197Select all elements that match ` selector ` in the given ` tree ` .
196- Searches the tree in * preorder* .
198+ Searches the tree in * [ preorder] [ ] * .
197199
198200###### Parameters
199201
200202* ` selector ` (` string ` )
201203 — CSS selector, such as (` h1 ` , ` a, b ` )
202204* ` tree ` ([ ` Node ` ] [ node ] , optional)
203205 — tree to search
204- * ` space ` (` 'svg' ` or ` 'html' ` , default: ` 'html' ` )
206+ * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
205207 — name of namespace
206208
207209###### Returns
@@ -244,6 +246,16 @@ Yields:
244246 children: [ { type: ' text' , value: ' Foxtrot' } ] } ]
245247```
246248
249+ ### ` Space `
250+
251+ Namespace (TypeScript type).
252+
253+ ###### Type
254+
255+ ``` ts
256+ type Space = ' html' | ' svg'
257+ ` ` `
258+
247259## Support
248260
249261* [x] ` *` (universal selector)
@@ -354,7 +366,7 @@ Yields:
354366## Types
355367
356368This package is fully typed with [TypeScript][].
357- It exports the additional type ` Space ` .
369+ It exports the additional type [ ` Space ` ][space] .
358370
359371## Compatibility
360372
@@ -452,3 +464,11 @@ abide by its terms.
452464[unist-util-visit]: https://github.com/syntax-tree/unist-util-visit
453465
454466[unist-util-select]: https://github.com/syntax-tree/unist-util-select
467+
468+ [matches]: #matchesselector-node-space
469+
470+ [select]: #selectselector-tree-space
471+
472+ [selectall]: #selectallselector-tree-space
473+
474+ [space]: #space
0 commit comments