Skip to content

Commit c4ecf64

Browse files
1 parent cfb4ec8 commit c4ecf64

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var domParserOptions = { decodeEntities: true, lowerCaseAttributeNames: false };
99
*
1010
* @param {String} html - HTML string.
1111
* @param {Object} [options] - Parser options.
12+
* @param {Object} [options.htmlparser2] - htmlparser2 options.
1213
* @param {Object} [options.library] - Library for React, Preact, etc.
1314
* @param {Function} [options.replace] - Replace method.
1415
* @return {JSX.Element|JSX.Element[]|String} - React element(s), empty array, or string.
@@ -20,7 +21,11 @@ function HTMLReactParser(html, options) {
2021
if (html === '') {
2122
return [];
2223
}
23-
return domToReact(htmlToDOM(html, domParserOptions), options);
24+
options = options || {};
25+
return domToReact(
26+
htmlToDOM(html, options.htmlparser2 || domParserOptions),
27+
options
28+
);
2429
}
2530

2631
HTMLReactParser.domToReact = domToReact;

0 commit comments

Comments
 (0)