@@ -92,20 +92,14 @@ console.log(div)
9292
9393## API
9494
95- This package exports the following identifiers:
95+ This package exports the identifier
9696` fromString ` .
9797There is no default export.
9898
9999### ` fromString(node[, value]) `
100100
101101Set the plain-text value of a node.
102102
103- * if ` node ` is a text node (has a ` value ` property; as in, ` comment ` ,
104- ` text ` ), set that to the given ` value ` or an empty string
105- * Otherwise, if ` node ` is a parent node (has ` children ` ; as in, ` element ` ,
106- ` root ` ), replace them with a text node whose data is set to the given
107- ` value ` , or if ` value ` is not given, remove all its children
108-
109103###### Parameters
110104
111105* ` node ` (` Node ` ) — node to change
@@ -115,25 +109,35 @@ Set the plain-text value of a node.
115109
116110Nothing (` undefined ` ).
117111
112+ ###### Algorithm
113+
114+ * if ` node ` is a ` comment ` or ` text ` node, sets its ` value `
115+ * if ` node ` is an ` element ` or ` root ` , replaces its children with a text
116+ node for ` value `
117+
118118## Syntax
119119
120- HTML is handled according to WHATWG HTML (the living standard), which is also
121- followed by browsers such as Chrome and Firefox .
120+ HTML is parsed according to WHATWG HTML (the living standard), which is also
121+ followed by all browsers .
122122
123123## Syntax tree
124124
125- The syntax tree format used is [ ` hast ` ] [ hast ] .
125+ The syntax tree used is [ hast] [ ] .
126126
127127## Types
128128
129129This package is fully typed with [ TypeScript] [ ] .
130130
131131## Compatibility
132132
133- Projects maintained by the unified collective are compatible with all maintained
133+ Projects maintained by the unified collective are compatible with maintained
134134versions of Node.js.
135- As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
136- Our projects sometimes work with older versions, but this is not guaranteed.
135+
136+ When we cut a new major release, we drop support for unmaintained versions of
137+ Node.
138+ This means we try to keep the current release line,
139+ ` hast-util-from-string@^2 ` ,
140+ compatible with Node.js 12.
137141
138142## Security
139143
@@ -197,9 +201,9 @@ abide by its terms.
197201
198202[ rehype-sanitize ] : https://github.com/rehypejs/rehype-sanitize
199203
200- [ size ] : https://bundlephobia .com/result?p =hast-util-from-string
204+ [ size ] : https://bundlejs .com/?q =hast-util-from-string
201205
202- [ size-badge ] : https://img.shields.io/bundlephobia/minzip /hast-util-from-string.svg
206+ [ size-badge ] : https://img.shields.io/bundlejs/size /hast-util-from-string
203207
204208[ support ] : https://github.com/rehypejs/.github/blob/main/support.md
205209
0 commit comments