You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-1Lines changed: 29 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ parse(
106
106
107
107
The `replace` callback allows you to swap an element with another React element.
108
108
109
-
The first argument is an object with the same output as [htmlparser2](https://github.com/fb55/htmlparser2)'s [domhandler](https://github.com/fb55/domhandler#example):
109
+
The first argument is an object with the same output as [htmlparser2](https://github.com/fb55/htmlparser2/tree/v3.10.1)'s [domhandler](https://github.com/fb55/domhandler#example):
110
110
111
111
```js
112
112
parse('<br>', {
@@ -224,6 +224,34 @@ parse('<br>', {
224
224
});
225
225
```
226
226
227
+
### htmlparser2
228
+
229
+
This library passes the following options to [htmlparser2](https://github.com/fb55/htmlparser2/tree/v3.10.1) on the server-side:
230
+
231
+
```js
232
+
{
233
+
decodeEntities:true,
234
+
lowerCaseAttributeNames:false
235
+
}
236
+
```
237
+
238
+
By passing your own options, the default library options will be **replaced** (not merged).
239
+
240
+
As a result, to enable `decodeEntities` and `xmlMode`, you need to do the following:
241
+
242
+
```js
243
+
parse('<p /><p />', {
244
+
htmlparser2: {
245
+
decodeEntities:true,
246
+
xmlMode:true
247
+
}
248
+
});
249
+
```
250
+
251
+
See [htmlparser2 options](https://github.com/fb55/htmlparser2/wiki/Parser-options).
252
+
253
+
> **Warning**: By overriding htmlparser2 options, there's a chance of breaking universal rendering. Do this at your own risk.
0 commit comments