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
-[Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table](#warning-validatedomnesting-whitespace-text-nodes-cannot-appear-as-a-child-of-table)
50
51
-[Don't change case of tags](#dont-change-case-of-tags)
52
+
-[TS Error: Property 'attribs' does not exist on type 'DOMNode'](#ts-error-property-attribs-does-not-exist-on-type-domnode)
51
53
-[Performance](#performance)
52
54
-[Contributors](#contributors)
53
55
-[Code Contributors](#code-contributors)
@@ -133,9 +135,7 @@ parse(
133
135
);
134
136
```
135
137
136
-
### Options
137
-
138
-
#### replace(domNode)
138
+
### replace(domNode)
139
139
140
140
The `replace` option allows you to replace an element with another React element.
No, this library is _**not**_[XSS (cross-site scripting)](https://wikipedia.org/wiki/Cross-site_scripting) safe. See [#94](https://github.com/remarkablemark/html-react-parser/issues/94).
391
391
392
-
####Does invalid HTML get sanitized?
392
+
### Does invalid HTML get sanitized?
393
393
394
394
No, this library does _**not**_ sanitize HTML. See [#124](https://github.com/remarkablemark/html-react-parser/issues/124), [#125](https://github.com/remarkablemark/html-react-parser/issues/125), and [#141](https://github.com/remarkablemark/html-react-parser/issues/141).
395
395
396
-
####Are `<script>` tags parsed?
396
+
### Are `<script>` tags parsed?
397
397
398
398
Although `<script>` tags and their contents are rendered on the server-side, they're not evaluated on the client-side. See [#98](https://github.com/remarkablemark/html-react-parser/issues/98).
399
399
400
-
####Attributes aren't getting called
400
+
### Attributes aren't getting called
401
401
402
402
The reason why your HTML attributes aren't getting called is because [inline event handlers](https://developer.mozilla.org/docs/Web/Guide/Events/Event_handlers) (e.g., `onclick`) are parsed as a _string_ rather than a _function_. See [#73](https://github.com/remarkablemark/html-react-parser/issues/73).
403
403
404
-
####Parser throws an error
404
+
### Parser throws an error
405
405
406
406
If the parser throws an erorr, check if your arguments are valid. See ["Does invalid HTML get sanitized?"](#does-invalid-html-get-sanitized).
407
407
408
-
####Is SSR supported?
408
+
### Is SSR supported?
409
409
410
410
Yes, server-side rendering on Node.js is supported by this library. See [demo](https://repl.it/@remarkablemark/html-react-parser-SSR).
411
411
412
-
####Elements aren't nested correctly
412
+
### Elements aren't nested correctly
413
413
414
414
If your elements are nested incorrectly, check to make sure your [HTML markup is valid](https://validator.w3.org/). The HTML to DOM parsing will be affected if you're using self-closing syntax (`/>`) on non-void elements:
415
415
@@ -419,11 +419,11 @@ parse('<div /><div />'); // returns single element instead of array of elements
419
419
420
420
See [#158](https://github.com/remarkablemark/html-react-parser/issues/158).
421
421
422
-
####Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table
422
+
### Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table
423
423
424
424
Enable the [trim](#trim) option. See [#155](https://github.com/remarkablemark/html-react-parser/issues/155).
425
425
426
-
####Don't change case of tags
426
+
### Don't change case of tags
427
427
428
428
Tags are lowercased by default. To prevent that from happening, pass the [htmlparser2 option](#htmlparser2):
See [#62](https://github.com/remarkablemark/html-react-parser/issues/62) and [example](https://repl.it/@remarkablemark/html-react-parser-62).
446
446
447
-
#### TS Error: Property 'attribs' does not exist on type 'DOMNode'
447
+
### TS Error: Property 'attribs' does not exist on type 'DOMNode'
448
448
449
449
The TypeScript error happens because `DOMNode` needs be an instance of domhandler's `Element`. See [migration](#migration) or [#199](https://github.com/remarkablemark/html-react-parser/issues/199).
0 commit comments