Skip to content

Commit 16cd953

Browse files
committed
Add improved docs
1 parent 134d0cc commit 16cd953

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

readme.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ node when working with xast (XML).
4040
## Install
4141

4242
This package is [ESM only][esm].
43-
In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [npm][]:
43+
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
4444

4545
```sh
4646
npm install xast-util-to-string
@@ -49,14 +49,14 @@ npm install xast-util-to-string
4949
In Deno with [`esm.sh`][esmsh]:
5050

5151
```js
52-
import {toString} from "https://esm.sh/xast-util-to-string@2"
52+
import {toString} from 'https://esm.sh/xast-util-to-string@2'
5353
```
5454

5555
In browsers with [`esm.sh`][esmsh]:
5656

5757
```html
5858
<script type="module">
59-
import {toString} from "https://esm.sh/xast-util-to-string@2?bundle"
59+
import {toString} from 'https://esm.sh/xast-util-to-string@2?bundle'
6060
</script>
6161
```
6262

@@ -89,17 +89,17 @@ A Christmas CarolCharles Dickens
8989

9090
## API
9191

92-
This package exports the identifier `toString`.
92+
This package exports the identifier [`toString`][tostring].
9393
There is no default export.
9494

9595
### `toString(node)`
9696

9797
Get the plain text value of a node.
98-
If the node has a `value` field ([*cdata*][cdata], [*comment*][comment],
99-
[*doctype*][doctype], [*instruction*][instruction], or [*text*][text]), returns
100-
it.
101-
If the node has a `children` field ([*root*][root] or [*element*][element]),
102-
recurses into it to concatenate all [*text*][text]s.
98+
99+
If the node has a `value` field (*[cdata][]*, *[comment][]*, *[doctype][]*,
100+
*[instruction][]*, or *[text][]*), returns it.
101+
If the node has a `children` field (*[root][]* or *[element][]*), recurses into
102+
it to concatenate all texts.
103103

104104
###### Returns
105105

@@ -114,7 +114,7 @@ It exports no additional types.
114114

115115
Projects maintained by the unified collective are compatible with all maintained
116116
versions of Node.js.
117-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
117+
As of now, that is Node.js 14.14+ and 16.0+.
118118
Our projects sometimes work with older versions, but this is not guaranteed.
119119

120120
## Security
@@ -214,3 +214,5 @@ abide by its terms.
214214
[text]: https://github.com/syntax-tree/xast#text
215215

216216
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
217+
218+
[tostring]: #tostringnode

0 commit comments

Comments
 (0)