Skip to content

Commit f5ff1d2

Browse files
docs(readme): update section on htmlparser2 options
Explicitly state that this option is available in >=0.12.0 and s only applicable on the server-side and not the client-side. Closes #168
1 parent 023224a commit f5ff1d2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ parse('<br>', {
244244

245245
### htmlparser2
246246

247-
This library passes the following options to [htmlparser2](https://github.com/fb55/htmlparser2/tree/v3.10.1) on the server-side:
247+
The default options passed to [htmlparser2](https://github.com/fb55/htmlparser2/tree/v3.10.1) are:
248248

249249
```js
250250
{
@@ -253,9 +253,9 @@ This library passes the following options to [htmlparser2](https://github.com/fb
253253
}
254254
```
255255

256-
By passing your own options, the default library options will be **replaced** (not merged).
256+
Since [v0.12.0](https://github.com/remarkablemark/html-react-parser/tree/v0.12.0), you can override the default options by passing [htmlparser2 options](https://github.com/fb55/htmlparser2/wiki/Parser-options).
257257

258-
As a result, to enable `decodeEntities` and `xmlMode`, you need to do the following:
258+
Here's an example in which [`decodeEntities`](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-decodeentities) and [`xmlMode`](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-xmlmode) are enabled:
259259

260260
```js
261261
parse('<p /><p />', {
@@ -266,9 +266,7 @@ parse('<p /><p />', {
266266
});
267267
```
268268

269-
See [htmlparser2 options](https://github.com/fb55/htmlparser2/wiki/Parser-options).
270-
271-
> **Warning**: By overriding htmlparser2 options, there's a chance of breaking universal rendering. Do this at your own risk.
269+
> **Warning**: `htmlparser2` is only applicable on the _server-side_ (Node.js) and not applicable on the _client-side_ (browser). By overriding `htmlparser2` options, there's a chance that universal rendering breaks. Do this at your own _risk_.
272270
273271
### trim
274272

0 commit comments

Comments
 (0)