12
12
13
13
## Contents
14
14
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
- * [ ` findAndReplace(tree, list[, options]) ` ] ( #findandreplacetree-list-options )
21
- * [ ` Find ` ] ( #find )
22
- * [ ` FindAndReplaceList ` ] ( #findandreplacelist )
23
- * [ ` FindAndReplaceTuple ` ] ( #findandreplacetuple )
24
- * [ ` Options ` ] ( #options )
25
- * [ ` RegExpMatchObject ` ] ( #regexpmatchobject )
26
- * [ ` Replace ` ] ( #replace )
27
- * [ ` ReplaceFunction ` ] ( #replacefunction )
28
- * [ Types] ( #types )
29
- * [ Compatibility] ( #compatibility )
30
- * [ Security] ( #security )
31
- * [ Related] ( #related )
32
- * [ Contribute] ( #contribute )
33
- * [ License] ( #license )
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
+ * [ ` findAndReplace(tree, list[, options]) ` ] ( #findandreplacetree-list-options )
21
+ * [ ` Find ` ] ( #find )
22
+ * [ ` FindAndReplaceList ` ] ( #findandreplacelist )
23
+ * [ ` FindAndReplaceTuple ` ] ( #findandreplacetuple )
24
+ * [ ` Options ` ] ( #options )
25
+ * [ ` RegExpMatchObject ` ] ( #regexpmatchobject )
26
+ * [ ` Replace ` ] ( #replace )
27
+ * [ ` ReplaceFunction ` ] ( #replacefunction )
28
+ * [ Types] ( #types )
29
+ * [ Compatibility] ( #compatibility )
30
+ * [ Security] ( #security )
31
+ * [ Related] ( #related )
32
+ * [ Contribute] ( #contribute )
33
+ * [ License] ( #license )
34
34
35
35
## What is this?
36
36
@@ -132,13 +132,13 @@ Partial matches are not supported.
132
132
133
133
###### Parameters
134
134
135
- * ` tree ` ([ ` Node ` ] [ node ] )
136
- — tree to change
137
- * ` list ` ([ ` FindAndReplaceList ` ] [ api-find-and-replace-list ] or
138
- [ ` FindAndReplaceTuple ` ] [ api-find-and-replace-tuple ] )
139
- — one or more find-and-replace pairs
140
- * ` options ` ([ ` Options ` ] [ api-options ] )
141
- — configuration
135
+ * ` tree ` ([ ` Node ` ] [ node ] )
136
+ — tree to change
137
+ * ` list ` ([ ` FindAndReplaceList ` ] [ api-find-and-replace-list ] or
138
+ [ ` FindAndReplaceTuple ` ] [ api-find-and-replace-tuple ] )
139
+ — one or more find-and-replace pairs
140
+ * ` options ` ([ ` Options ` ] [ api-options ] )
141
+ — configuration
142
142
143
143
###### Returns
144
144
@@ -186,21 +186,21 @@ Configuration (TypeScript type).
186
186
187
187
###### Fields
188
188
189
- * ` ignore ` ([ ` Test ` ][test], optional)
190
- — test for which elements to ignore
189
+ * ` ignore ` ([ ` Test ` ][test], optional)
190
+ — test for which elements to ignore
191
191
192
192
### ` RegExpMatchObject `
193
193
194
194
Info on the match (TypeScript type).
195
195
196
196
###### Fields
197
197
198
- * ` index ` ( ` number ` )
199
- — the index of the search at which the result was found
200
- * ` input ` ( ` string ` )
201
- — a copy of the search string in the text node
202
- * ` stack ` ([ ` Array <Node >` ][node])
203
- — all ancestors of the text node, where the last node is the text itself
198
+ * ` index ` ( ` number ` )
199
+ — the index of the search at which the result was found
200
+ * ` input ` ( ` string ` )
201
+ — a copy of the search string in the text node
202
+ * ` stack ` ([ ` Array <Node >` ][node])
203
+ — all ancestors of the text node, where the last node is the text itself
204
204
205
205
### ` Replace `
206
206
@@ -222,21 +222,21 @@ Callback called when a search matches (TypeScript type).
222
222
223
223
The parameters are the result of corresponding search expression:
224
224
225
- * ` value ` ( ` string ` )
226
- — whole match
227
- * ` ...capture ` ( ` Array <string >` )
228
- — matches from regex capture groups
229
- * ` match ` ([ ` RegExpMatchObject ` ][api-regexp-match-object])
230
- — info on the match
225
+ * ` value ` ( ` string ` )
226
+ — whole match
227
+ * ` ...capture ` ( ` Array <string >` )
228
+ — matches from regex capture groups
229
+ * ` match ` ([ ` RegExpMatchObject ` ][api-regexp-match-object])
230
+ — info on the match
231
231
232
232
###### Returns
233
233
234
234
Thing to replace with:
235
235
236
- * when ` null ` , ` undefined ` , ` ' ' ` , remove the match
237
- * …or when ` false ` , do not replace at all
238
- * …or when ` string ` , replace with a text node of that value
239
- * …or when ` Node ` or ` Array <Node >` , replace with those nodes
236
+ * when ` null ` , ` undefined ` , ` ' ' ` , remove the match
237
+ * …or when ` false ` , do not replace at all
238
+ * …or when ` string ` , replace with a text node of that value
239
+ * …or when ` Node ` or ` Array <Node >` , replace with those nodes
240
240
241
241
## Types
242
242
@@ -266,12 +266,12 @@ so there are no openings for [cross-site scripting (XSS)][xss] attacks.
266
266
267
267
## Related
268
268
269
- * [ ` hast -util -find -and -replace ` ](https://github.com/syntax-tree/hast-util-find-and-replace)
270
- — find and replace in hast
271
- * [ ` hast -util -select ` ](https://github.com/syntax-tree/hast-util-select)
272
- — ` querySelector ` , ` querySelectorAll ` , and ` matches `
273
- * [ ` unist -util -select ` ](https://github.com/syntax-tree/unist-util-select)
274
- — select unist nodes with CSS-like selectors
269
+ * [ ` hast -util -find -and -replace ` ](https://github.com/syntax-tree/hast-util-find-and-replace)
270
+ — find and replace in hast
271
+ * [ ` hast -util -select ` ](https://github.com/syntax-tree/hast-util-select)
272
+ — ` querySelector ` , ` querySelectorAll ` , and ` matches `
273
+ * [ ` unist -util -select ` ](https://github.com/syntax-tree/unist-util-select)
274
+ — select unist nodes with CSS-like selectors
275
275
276
276
## Contribute
277
277
0 commit comments