@@ -40,7 +40,7 @@ node when working with xast (XML).
40
40
## Install
41
41
42
42
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] [ ] :
44
44
45
45
``` sh
46
46
npm install xast-util-to-string
@@ -49,14 +49,14 @@ npm install xast-util-to-string
49
49
In Deno with [ ` esm.sh ` ] [ esmsh ] :
50
50
51
51
``` 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'
53
53
```
54
54
55
55
In browsers with [ ` esm.sh ` ] [ esmsh ] :
56
56
57
57
``` html
58
58
<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'
60
60
</script >
61
61
```
62
62
@@ -89,17 +89,17 @@ A Christmas CarolCharles Dickens
89
89
90
90
## API
91
91
92
- This package exports the identifier ` toString ` .
92
+ This package exports the identifier [ ` toString ` ] [ tostring ] .
93
93
There is no default export.
94
94
95
95
### ` toString(node) `
96
96
97
97
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 .
103
103
104
104
###### Returns
105
105
@@ -114,7 +114,7 @@ It exports no additional types.
114
114
115
115
Projects maintained by the unified collective are compatible with all maintained
116
116
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+.
118
118
Our projects sometimes work with older versions, but this is not guaranteed.
119
119
120
120
## Security
@@ -214,3 +214,5 @@ abide by its terms.
214
214
[ text ] : https://github.com/syntax-tree/xast#text
215
215
216
216
[ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
217
+
218
+ [ tostring ] : #tostringnode
0 commit comments