html-react-parser
Advanced tools
Comparing version 0.12.0 to 0.13.0
387
CHANGELOG.md
@@ -5,4 +5,4 @@ # Change Log | ||
<a name="0.12.0"></a> | ||
# [0.12.0](https://github.com/remarkablemark/html-react-parser/compare/v0.11.1...v0.12.0) (2020-06-04) | ||
<a name="0.13.0"></a> | ||
# [0.13.0](https://github.com/remarkablemark/html-react-parser/compare/v0.12.0...v0.13.0) (2020-06-07) | ||
@@ -12,343 +12,251 @@ | ||
* **index:** add htmlparser2 type to HTMLReactParserOptions ([81f74fb](https://github.com/remarkablemark/html-react-parser/commit/81f74fb)) | ||
* **index:** add options.htmlparser2 ([c4ecf64](https://github.com/remarkablemark/html-react-parser/commit/c4ecf64)) | ||
* **dom-to-react:** add option `trim` that skips whitespace nodes ([413eaa0](https://github.com/remarkablemark/html-react-parser/commit/413eaa0)) | ||
* **index:** type `trim` in HTMLReactParserOptions ([be71b13](https://github.com/remarkablemark/html-react-parser/commit/be71b13)) | ||
<a name="0.11.1"></a> | ||
## [0.11.1](https://github.com/remarkablemark/html-react-parser/compare/v0.11.0...v0.11.1) (2020-06-03) | ||
## [0.12.0](https://github.com/remarkablemark/html-react-parser/compare/v0.11.1...v0.12.0) (2020-06-04) | ||
### Features | ||
### Performance Improvements | ||
- **index:** add htmlparser2 type to HTMLReactParserOptions ([81f74fb](https://github.com/remarkablemark/html-react-parser/commit/81f74fb)) | ||
- **index:** add options.htmlparser2 ([c4ecf64](https://github.com/remarkablemark/html-react-parser/commit/c4ecf64)) | ||
* **index:** return empty array if first argument is empty string ([7f61f97](https://github.com/remarkablemark/html-react-parser/commit/7f61f97)) | ||
## [0.11.1](https://github.com/remarkablemark/html-react-parser/compare/v0.11.0...v0.11.1) (2020-06-03) | ||
### Performance Improvements | ||
- **index:** return empty array if first argument is empty string ([7f61f97](https://github.com/remarkablemark/html-react-parser/commit/7f61f97)) | ||
<a name="0.11.0"></a> | ||
# [0.11.0](https://github.com/remarkablemark/html-react-parser/compare/v0.10.5...v0.11.0) (2020-06-02) | ||
## [0.11.0](https://github.com/remarkablemark/html-react-parser/compare/v0.10.5...v0.11.0) (2020-06-02) | ||
### Features | ||
* **package:** upgrade html-dom-parser@0.3.0 ([d30bfdc](https://github.com/remarkablemark/html-react-parser/commit/d30bfdc)) | ||
- **package:** upgrade html-dom-parser@0.3.0 ([d30bfdc](https://github.com/remarkablemark/html-react-parser/commit/d30bfdc)) | ||
## [0.10.5](https://github.com/remarkablemark/html-react-parser/compare/v0.10.4...v0.10.5) (2020-05-26) | ||
### Tests | ||
* **html-to-react:** tidy and organize tests in html-to-react.js ([8dfbfe0](https://github.com/remarkablemark/html-react-parser/commit/8dfbfe03a65f900b2661dc80227883a77bef766c)) | ||
- **html-to-react:** tidy and organize tests in html-to-react.js ([8dfbfe0](https://github.com/remarkablemark/html-react-parser/commit/8dfbfe03a65f900b2661dc80227883a77bef766c)) | ||
### Build System | ||
* **package:** add missing peerDependency `typescript` ([91fb693](https://github.com/remarkablemark/html-react-parser/commit/91fb693c9ca9e4c473b1f532d0e03e6c42b90916)) | ||
* **package:** upgrade devDependencies ([b2dc83b](https://github.com/remarkablemark/html-react-parser/commit/b2dc83b9834b70424c1525d5b30b7c6c32016838)) | ||
* **rollup:** upgrade rollup, consolidate config, remove cross-env ([55b2b4e](https://github.com/remarkablemark/html-react-parser/commit/55b2b4e7a647e9829e89a45524ece86d0ab620bd)) | ||
- **package:** add missing peerDependency `typescript` ([91fb693](https://github.com/remarkablemark/html-react-parser/commit/91fb693c9ca9e4c473b1f532d0e03e6c42b90916)) | ||
- **package:** upgrade devDependencies ([b2dc83b](https://github.com/remarkablemark/html-react-parser/commit/b2dc83b9834b70424c1525d5b30b7c6c32016838)) | ||
- **rollup:** upgrade rollup, consolidate config, remove cross-env ([55b2b4e](https://github.com/remarkablemark/html-react-parser/commit/55b2b4e7a647e9829e89a45524ece86d0ab620bd)) | ||
### [0.10.4](https://github.com/remarkablemark/html-react-parser/compare/v0.10.3...v0.10.4) (2020-05-25) | ||
## [0.10.4](https://github.com/remarkablemark/html-react-parser/compare/v0.10.3...v0.10.4) (2020-05-25) | ||
### Tests | ||
* **attributes-to-props:** test that CSS comment is not parsed ([0c27987](https://github.com/remarkablemark/html-react-parser/commit/0c27987ff10fa13f3f2f35ba1aba0b88b0e0d92e)) | ||
* **dom-to-react:** tidy tests and add case for single node replace ([452f6be](https://github.com/remarkablemark/html-react-parser/commit/452f6be01500adffd740b0b1edb7a06790ba46f7)) | ||
* tidy tests, replace `assert.equal` with `assert.strictEqual` ([ef04eff](https://github.com/remarkablemark/html-react-parser/commit/ef04effebdd2f753c99f706599d656b314442d08)) | ||
- **attributes-to-props:** test that CSS comment is not parsed ([0c27987](https://github.com/remarkablemark/html-react-parser/commit/0c27987ff10fa13f3f2f35ba1aba0b88b0e0d92e)) | ||
- **dom-to-react:** tidy tests and add case for single node replace ([452f6be](https://github.com/remarkablemark/html-react-parser/commit/452f6be01500adffd740b0b1edb7a06790ba46f7)) | ||
- tidy tests, replace `assert.equal` with `assert.strictEqual` ([ef04eff](https://github.com/remarkablemark/html-react-parser/commit/ef04effebdd2f753c99f706599d656b314442d08)) | ||
### [0.10.3](https://github.com/remarkablemark/html-react-parser/compare/v0.10.2...v0.10.3) (2020-03-28) | ||
## [0.10.3](https://github.com/remarkablemark/html-react-parser/compare/v0.10.2...v0.10.3) (2020-03-28) | ||
### Bug Fixes | ||
* update .d.ts docstrings ([bae05c0](https://github.com/remarkablemark/html-react-parser/commit/bae05c0a00ac4917b8d0d3137098010a13f8377d)) | ||
* use JSX.Element for type definitions ([d8e2ada](https://github.com/remarkablemark/html-react-parser/commit/d8e2adad4410544bbff4b5c9b827225aa96ed5d5)) | ||
- update .d.ts docstrings ([bae05c0](https://github.com/remarkablemark/html-react-parser/commit/bae05c0a00ac4917b8d0d3137098010a13f8377d)) | ||
- use JSX.Element for type definitions ([d8e2ada](https://github.com/remarkablemark/html-react-parser/commit/d8e2adad4410544bbff4b5c9b827225aa96ed5d5)) | ||
### [0.10.2](https://github.com/remarkablemark/html-react-parser/compare/v0.10.1...v0.10.2) (2020-03-13) | ||
## [0.10.2](https://github.com/remarkablemark/html-react-parser/compare/v0.10.1...v0.10.2) (2020-03-13) | ||
### Bug Fixes | ||
* **index:** add default export for parser ([6259959](https://github.com/remarkablemark/html-react-parser/commit/62599594de72c12c0c9fe9a8642ee52ed0488734)) | ||
- **index:** add default export for parser ([6259959](https://github.com/remarkablemark/html-react-parser/commit/62599594de72c12c0c9fe9a8642ee52ed0488734)) | ||
### Tests | ||
* **html-to-react:** add test to ensure default export for parser ([efba1d4](https://github.com/remarkablemark/html-react-parser/commit/efba1d402000b25b8800e33c2b934351b64bac0c)) | ||
* **html-to-react:** have a stronger assert ([064f0df](https://github.com/remarkablemark/html-react-parser/commit/064f0dfc742f67d57941a02bfdb70a76b56be472)) | ||
- **html-to-react:** add test to ensure default export for parser ([efba1d4](https://github.com/remarkablemark/html-react-parser/commit/efba1d402000b25b8800e33c2b934351b64bac0c)) | ||
- **html-to-react:** have a stronger assert ([064f0df](https://github.com/remarkablemark/html-react-parser/commit/064f0dfc742f67d57941a02bfdb70a76b56be472)) | ||
### [0.10.1](https://github.com/remarkablemark/html-react-parser/compare/v0.10.0...v0.10.1) (2020-02-08) | ||
## [0.10.1](https://github.com/remarkablemark/html-react-parser/compare/v0.10.0...v0.10.1) (2020-02-08) | ||
### Bug Fixes | ||
* **index:** make `replace` property optional in `index.d.ts` ([801512b](https://github.com/remarkablemark/html-react-parser/commit/801512ba353e46ba931ee018ea8a9ec6c2d5da60)), closes [#134](https://github.com/remarkablemark/html-react-parser/issues/134) | ||
- **index:** make `replace` property optional in `index.d.ts` ([801512b](https://github.com/remarkablemark/html-react-parser/commit/801512ba353e46ba931ee018ea8a9ec6c2d5da60)), closes [#134](https://github.com/remarkablemark/html-react-parser/issues/134) | ||
## [0.10.0](https://github.com/remarkablemark/html-react-parser/compare/v0.9.2...v0.10.0) (2019-11-09) | ||
### Build System | ||
* **package:** upgrade dependency style-to-object@0.3.0 ([87a0486](https://github.com/remarkablemark/html-react-parser/commit/87a0486)) | ||
* **package:** upgrade devDependencies ([aaddf1b](https://github.com/remarkablemark/html-react-parser/commit/aaddf1b)) | ||
- **package:** upgrade dependency style-to-object@0.3.0 ([87a0486](https://github.com/remarkablemark/html-react-parser/commit/87a0486)) | ||
- **package:** upgrade devDependencies ([aaddf1b](https://github.com/remarkablemark/html-react-parser/commit/aaddf1b)) | ||
### Features | ||
* **dom-to-react:** support Preact ([c3e77bb](https://github.com/remarkablemark/html-react-parser/commit/c3e77bb)) | ||
- **dom-to-react:** support Preact ([c3e77bb](https://github.com/remarkablemark/html-react-parser/commit/c3e77bb)) | ||
### Tests | ||
* **types:** move TypeScript tests from `lint` to `test` directory ([7c9ab9d](https://github.com/remarkablemark/html-react-parser/commit/7c9ab9d)) | ||
- **types:** move TypeScript tests from `lint` to `test` directory ([7c9ab9d](https://github.com/remarkablemark/html-react-parser/commit/7c9ab9d)) | ||
## [0.9.2](https://github.com/remarkablemark/html-react-parser/compare/v0.9.1...v0.9.2) (2019-11-04) | ||
### [0.9.2](https://github.com/remarkablemark/html-react-parser/compare/v0.9.1...v0.9.2) (2019-11-04) | ||
### Bug Fixes | ||
* refactor TypeScript declaration file for `index.d.ts` ([f1fc00b](https://github.com/remarkablemark/html-react-parser/commit/f1fc00b)) | ||
- refactor TypeScript declaration file for `index.d.ts` ([f1fc00b](https://github.com/remarkablemark/html-react-parser/commit/f1fc00b)) | ||
### Build System | ||
* **package:** remove `opencollective-postinstall` ([6e0b870](https://github.com/remarkablemark/html-react-parser/commit/6e0b870)) | ||
* **package:** upgrade dependency html-dom-parser@0.2.3 ([891eda4](https://github.com/remarkablemark/html-react-parser/commit/891eda4)), closes [#126](https://github.com/remarkablemark/html-react-parser/issues/126) [remarkablemark/html-dom-parser#18](https://github.com/remarkablemark/html-react-parser/issues/18) | ||
- **package:** remove `opencollective-postinstall` ([6e0b870](https://github.com/remarkablemark/html-react-parser/commit/6e0b870)) | ||
- **package:** upgrade dependency html-dom-parser@0.2.3 ([891eda4](https://github.com/remarkablemark/html-react-parser/commit/891eda4)), closes [#126](https://github.com/remarkablemark/html-react-parser/issues/126) | ||
## [0.9.1](https://github.com/remarkablemark/html-react-parser/compare/v0.9.0...v0.9.1) (2019-07-09) | ||
### [0.9.1](https://github.com/remarkablemark/html-react-parser/compare/v0.9.0...v0.9.1) (2019-07-09) | ||
### Build System | ||
* replace `webpack` with `rollup` in order to optimize bundle ([a04ef27](https://github.com/remarkablemark/html-react-parser/commit/a04ef27)) | ||
* **index:** fix rollup error of mixing named and default exports ([230de70](https://github.com/remarkablemark/html-react-parser/commit/230de70)) | ||
- replace `webpack` with `rollup` in order to optimize bundle ([a04ef27](https://github.com/remarkablemark/html-react-parser/commit/a04ef27)) | ||
- **index:** fix rollup error of mixing named and default exports ([230de70](https://github.com/remarkablemark/html-react-parser/commit/230de70)) | ||
## [0.9.0](https://github.com/remarkablemark/html-react-parser/compare/v0.8.1...v0.9.0) (2019-07-09) | ||
### Bug Fixes | ||
* **attributes-to-props:** handle attr named after Object properties ([3f857bb](https://github.com/remarkablemark/html-react-parser/commit/3f857bb)) | ||
- **attributes-to-props:** handle attr named after Object properties ([3f857bb](https://github.com/remarkablemark/html-react-parser/commit/3f857bb)) | ||
### Build System | ||
* **package:** update `react-property` to 1.0.1 ([26ebef9](https://github.com/remarkablemark/html-react-parser/commit/26ebef9)) | ||
- **package:** update `react-property` to 1.0.1 ([26ebef9](https://github.com/remarkablemark/html-react-parser/commit/26ebef9)) | ||
### Features | ||
* **attributes-to-props:** check for overloaded boolean values ([1151cfb](https://github.com/remarkablemark/html-react-parser/commit/1151cfb)) | ||
* **attributes-to-props:** replace `react-dom` with `react-property` ([d6274b9](https://github.com/remarkablemark/html-react-parser/commit/d6274b9)), closes [#107](https://github.com/remarkablemark/html-react-parser/issues/107) | ||
- **attributes-to-props:** check for overloaded boolean values ([1151cfb](https://github.com/remarkablemark/html-react-parser/commit/1151cfb)) | ||
- **attributes-to-props:** replace `react-dom` with `react-property` ([d6274b9](https://github.com/remarkablemark/html-react-parser/commit/d6274b9)), closes [#107](https://github.com/remarkablemark/html-react-parser/issues/107) | ||
### Tests | ||
* **attributes-to-props:** improve test names ([17fbdfd](https://github.com/remarkablemark/html-react-parser/commit/17fbdfd)) | ||
- **attributes-to-props:** improve test names ([17fbdfd](https://github.com/remarkablemark/html-react-parser/commit/17fbdfd)) | ||
## [0.8.1](https://github.com/remarkablemark/html-react-parser/compare/v0.8.0...v0.8.1) (2019-07-03) | ||
### [0.8.1](https://github.com/remarkablemark/html-react-parser/compare/v0.8.0...v0.8.1) (2019-07-03) | ||
### Tests | ||
* **html-to-react:** update variable name to fix test ([73237dd](https://github.com/remarkablemark/html-react-parser/commit/73237dd)) | ||
- **html-to-react:** update variable name to fix test ([73237dd](https://github.com/remarkablemark/html-react-parser/commit/73237dd)) | ||
## [0.8.0](https://github.com/remarkablemark/html-react-parser/compare/v0.7.1...v0.8.0) (2019-06-24) | ||
### Bug Fixes | ||
* **attributes-to-props:** fix lint error `no-prototype-builtins` ([fa66dfc](https://github.com/remarkablemark/html-react-parser/commit/fa66dfc)) | ||
- **attributes-to-props:** fix lint error `no-prototype-builtins` ([fa66dfc](https://github.com/remarkablemark/html-react-parser/commit/fa66dfc)) | ||
### Build System | ||
* **package:** refactor webpack config and generate sourcemap ([5dd4f07](https://github.com/remarkablemark/html-react-parser/commit/5dd4f07)) | ||
* **package:** rename npm script `cover` to `test:cover` ([7d806c8](https://github.com/remarkablemark/html-react-parser/commit/7d806c8)) | ||
* **package:** update `html-dom-parser@0.2.2` and devDependencies ([b39ac53](https://github.com/remarkablemark/html-react-parser/commit/b39ac53)) | ||
* **package:** update dependencies and devDependencies ([8765ea9](https://github.com/remarkablemark/html-react-parser/commit/8765ea9)) | ||
* **package:** update dependency `style-to-object` to 0.2.3 ([c2cc2ec](https://github.com/remarkablemark/html-react-parser/commit/c2cc2ec)), closes [remarkablemark/style-to-object#5](https://github.com/remarkablemark/html-react-parser/issues/5) | ||
- **package:** refactor webpack config and generate sourcemap ([5dd4f07](https://github.com/remarkablemark/html-react-parser/commit/5dd4f07)) | ||
- **package:** rename npm script `cover` to `test:cover` ([7d806c8](https://github.com/remarkablemark/html-react-parser/commit/7d806c8)) | ||
- **package:** update `html-dom-parser@0.2.2` and devDependencies ([b39ac53](https://github.com/remarkablemark/html-react-parser/commit/b39ac53)) | ||
- **package:** update dependencies and devDependencies ([8765ea9](https://github.com/remarkablemark/html-react-parser/commit/8765ea9)) | ||
- **package:** update dependency `style-to-object` to 0.2.3 ([c2cc2ec](https://github.com/remarkablemark/html-react-parser/commit/c2cc2ec)) | ||
### Features | ||
* **dom-to-react:** skip and do not parse <script> content ([1fb5ee2](https://github.com/remarkablemark/html-react-parser/commit/1fb5ee2)) | ||
- **dom-to-react:** skip and do not parse <script> content ([1fb5ee2](https://github.com/remarkablemark/html-react-parser/commit/1fb5ee2)) | ||
### Tests | ||
* **html-to-react:** add test that verifies `domToReact` is exported ([320c364](https://github.com/remarkablemark/html-react-parser/commit/320c364)) | ||
* verify invalid style for `attributesToProps` throws an error ([b97f2e1](https://github.com/remarkablemark/html-react-parser/commit/b97f2e1)) | ||
- **html-to-react:** add test that verifies `domToReact` is exported ([320c364](https://github.com/remarkablemark/html-react-parser/commit/320c364)) | ||
- verify invalid style for `attributesToProps` throws an error ([b97f2e1](https://github.com/remarkablemark/html-react-parser/commit/b97f2e1)) | ||
<a name="0.7.1"></a> | ||
## [0.7.1](https://github.com/remarkablemark/html-react-parser/compare/v0.7.0...v0.7.1) (2019-05-27) | ||
<a name="0.7.0"></a> | ||
## [0.7.0](https://github.com/remarkablemark/html-react-parser/compare/v0.6.4...v0.7.0) (2019-04-05) | ||
### Bug Fixes | ||
* **coveralls:** moved dtslint tests to lint folder ([306fceb](https://github.com/remarkablemark/html-react-parser/commit/306fceb)) | ||
* **types:** html-dom-parser > html-react-parser ([438b9af](https://github.com/remarkablemark/html-react-parser/commit/438b9af)) | ||
- **coveralls:** moved dtslint tests to lint folder ([306fceb](https://github.com/remarkablemark/html-react-parser/commit/306fceb)) | ||
- **types:** html-dom-parser > html-react-parser ([438b9af](https://github.com/remarkablemark/html-react-parser/commit/438b9af)) | ||
### Features | ||
* **types:** add lib/dom-to-react declaration ([27ed8b6](https://github.com/remarkablemark/html-react-parser/commit/27ed8b6)) | ||
- **types:** add lib/dom-to-react declaration ([27ed8b6](https://github.com/remarkablemark/html-react-parser/commit/27ed8b6)) | ||
<a name="0.6.4"></a> | ||
## [0.6.4](https://github.com/remarkablemark/html-react-parser/compare/v0.6.3...v0.6.4) (2019-03-29) | ||
### Bug Fixes | ||
* **dom-to-react:** allow custom keys for replacement ([abf20a2](https://github.com/remarkablemark/html-react-parser/commit/abf20a2)) | ||
* **dom-to-react:** fix typos in the test ([4eec53e](https://github.com/remarkablemark/html-react-parser/commit/4eec53e)) | ||
- **dom-to-react:** allow custom keys for replacement ([abf20a2](https://github.com/remarkablemark/html-react-parser/commit/abf20a2)) | ||
- **dom-to-react:** fix typos in the test ([4eec53e](https://github.com/remarkablemark/html-react-parser/commit/4eec53e)) | ||
<a name="0.6.3"></a> | ||
## [0.6.3](https://github.com/remarkablemark/html-react-parser/compare/v0.6.2...v0.6.3) (2019-03-19) | ||
### Bug Fixes | ||
* **typescript:** test.tsx after dtslint run ([38e6bba](https://github.com/remarkablemark/html-react-parser/commit/38e6bba)) | ||
- **typescript:** test.tsx after dtslint run ([38e6bba](https://github.com/remarkablemark/html-react-parser/commit/38e6bba)) | ||
<a name="0.6.2"></a> | ||
## [0.6.2](https://github.com/remarkablemark/html-react-parser/compare/v0.6.1...v0.6.2) (2019-03-07) | ||
<a name="0.6.1"></a> | ||
## [0.6.1](https://github.com/remarkablemark/html-react-parser/compare/v0.6.0...v0.6.1) (2019-01-03) | ||
### Bug Fixes | ||
* **utilities:** allow numbers in custom style names ([5a6600f](https://github.com/remarkablemark/html-react-parser/commit/5a6600f)) | ||
- **utilities:** allow numbers in custom style names ([5a6600f](https://github.com/remarkablemark/html-react-parser/commit/5a6600f)) | ||
<a name="0.6.0"></a> | ||
## [0.6.0](https://github.com/remarkablemark/html-react-parser/compare/v0.5.0...v0.6.0) (2018-12-17) | ||
### Features | ||
* **utilities:** add support for custom styles beginning with "--*" ([2c0a9dc](https://github.com/remarkablemark/html-react-parser/commit/2c0a9dc)) | ||
- **utilities:** add support for custom styles beginning with "--\*" ([2c0a9dc](https://github.com/remarkablemark/html-react-parser/commit/2c0a9dc)) | ||
<a name="0.5.0"></a> | ||
## [0.5.0](https://github.com/remarkablemark/html-react-parser/compare/v0.4.7...v0.5.0) (2018-12-16) | ||
### Bug Fixes | ||
* **attributes-to-props:** undo default function parameter ([1017b25](https://github.com/remarkablemark/html-react-parser/commit/1017b25)) | ||
- **attributes-to-props:** undo default function parameter ([1017b25](https://github.com/remarkablemark/html-react-parser/commit/1017b25)) | ||
### Features | ||
* support custom elements in React 16 ([7b2c5a8](https://github.com/remarkablemark/html-react-parser/commit/7b2c5a8)) | ||
- support custom elements in React 16 ([7b2c5a8](https://github.com/remarkablemark/html-react-parser/commit/7b2c5a8)) | ||
<a name="0.4.7"></a> | ||
## [0.4.7](https://github.com/remarkablemark/html-react-parser/compare/v0.4.6...v0.4.7) (2018-09-14) | ||
<a name="0.4.6"></a> | ||
## [0.4.6](https://github.com/remarkablemark/html-react-parser/compare/v0.4.5...v0.4.6) (2018-05-13) | ||
### Bug Fixes | ||
* accidentally left a console ([953e564](https://github.com/remarkablemark/html-react-parser/commit/953e564)) | ||
* added test case for viewBox ([261ffb7](https://github.com/remarkablemark/html-react-parser/commit/261ffb7)) | ||
* moving svg mock to correct place ([6ffb148](https://github.com/remarkablemark/html-react-parser/commit/6ffb148)) | ||
* svg attributes now correctly handled ([94643e1](https://github.com/remarkablemark/html-react-parser/commit/94643e1)) | ||
- accidentally left a console ([953e564](https://github.com/remarkablemark/html-react-parser/commit/953e564)) | ||
- added test case for viewBox ([261ffb7](https://github.com/remarkablemark/html-react-parser/commit/261ffb7)) | ||
- moving svg mock to correct place ([6ffb148](https://github.com/remarkablemark/html-react-parser/commit/6ffb148)) | ||
- svg attributes now correctly handled ([94643e1](https://github.com/remarkablemark/html-react-parser/commit/94643e1)) | ||
<a name="0.4.5"></a> | ||
## [0.4.5](https://github.com/remarkablemark/html-react-parser/compare/v0.4.4...v0.4.5) (2018-05-09) | ||
### Bug Fixes | ||
* **package:** upgrade style-to-object@0.2.1 ([d065c60](https://github.com/remarkablemark/html-react-parser/commit/d065c60)) | ||
- **package:** upgrade style-to-object@0.2.1 ([d065c60](https://github.com/remarkablemark/html-react-parser/commit/d065c60)) | ||
<a name="0.4.4"></a> | ||
## [0.4.4](https://github.com/remarkablemark/html-react-parser/compare/v0.4.3...v0.4.4) (2018-05-07) | ||
### Bug Fixes | ||
* **package:** upgrade react-dom-core@0.0.3 ([b4a1c6e](https://github.com/remarkablemark/html-react-parser/commit/b4a1c6e)) | ||
- **package:** upgrade react-dom-core@0.0.3 ([b4a1c6e](https://github.com/remarkablemark/html-react-parser/commit/b4a1c6e)) | ||
<a name="0.4.3"></a> | ||
## [0.4.3](https://github.com/remarkablemark/html-react-parser/compare/v0.4.2...v0.4.3) (2018-03-27) | ||
### Bug Fixes | ||
* **parser:** fix boolean attributes parsing ([e478a44](https://github.com/remarkablemark/html-react-parser/commit/e478a44)) | ||
* **parser:** fix case when style is empty string ([fa2a8b4](https://github.com/remarkablemark/html-react-parser/commit/fa2a8b4)) | ||
- **parser:** fix boolean attributes parsing ([e478a44](https://github.com/remarkablemark/html-react-parser/commit/e478a44)) | ||
- **parser:** fix case when style is empty string ([fa2a8b4](https://github.com/remarkablemark/html-react-parser/commit/fa2a8b4)) | ||
<a name="0.4.2"></a> | ||
## [0.4.2](https://github.com/remarkablemark/html-react-parser/compare/v0.4.1...v0.4.2) (2018-02-20) | ||
### Bug Fixes | ||
* **package:** upgrade html-dom-parser@0.1.3 and devDependencies ([1c236ed](https://github.com/remarkablemark/html-react-parser/commit/1c236ed)) | ||
* **release:** do not lint standard-version commit message ([2d35a1f](https://github.com/remarkablemark/html-react-parser/commit/2d35a1f)) | ||
- **package:** upgrade html-dom-parser@0.1.3 and devDependencies ([1c236ed](https://github.com/remarkablemark/html-react-parser/commit/1c236ed)) | ||
- **release:** do not lint standard-version commit message ([2d35a1f](https://github.com/remarkablemark/html-react-parser/commit/2d35a1f)) | ||
<a name="0.4.1"></a> | ||
## [0.4.1](https://github.com/remarkablemark/html-react-parser/compare/v0.4.0...v0.4.1) (2017-11-28) | ||
### Bug Fixes | ||
* **attributes-to-props.js:** Remove unappropriate console logging and remove double quote from tests ([10ff149](https://github.com/remarkablemark/html-react-parser/commit/10ff149)) | ||
* **attributes-to-props.js:** Use AST to transform style attributes into an style object ([68cd565](https://github.com/remarkablemark/html-react-parser/commit/68cd565)) | ||
* **utilities.js:** Format string to lowercase before converting to camel case and assert the string is a string ([4522666](https://github.com/remarkablemark/html-react-parser/commit/4522666)) | ||
- **attributes-to-props.js:** Remove unappropriate console logging and remove double quote from tests ([10ff149](https://github.com/remarkablemark/html-react-parser/commit/10ff149)) | ||
- **attributes-to-props.js:** Use AST to transform style attributes into an style object ([68cd565](https://github.com/remarkablemark/html-react-parser/commit/68cd565)) | ||
- **utilities.js:** Format string to lowercase before converting to camel case and assert the string is a string ([4522666](https://github.com/remarkablemark/html-react-parser/commit/4522666)) | ||
## [0.4.0](https://github.com/remarkablemark/html-react-parser/compare/v0.3.6...v0.4.0) (2017-10-01) | ||
### Added | ||
## [0.4.0](https://github.com/remarkablemark/html-react-parser/compare/v0.3.6...v0.4.0) - 2017-10-01 | ||
### Added | ||
- [react-dom-core](https://github.com/remarkablemark/react-dom-core) to dependencies (closes #43) | ||
- [react-dom-core](https://github.com/remarkablemark/react-dom-core) to dependencies (closes [#43](https://github.com/remarkablemark/html-react-parser/issues/43)) | ||
- `react-dom` 16 no longer exposes `lib`, which includes the DOM property configs | ||
@@ -358,4 +266,6 @@ - Upgrade devDependencies of `react` and `react-dom` to 16 | ||
## [0.3.6](https://github.com/remarkablemark/html-react-parser/compare/v0.3.5...v0.3.6) - 2017-09-30 | ||
## [0.3.6](https://github.com/remarkablemark/html-react-parser/compare/v0.3.5...v0.3.6) (2017-09-30) | ||
### Changed | ||
- Dependencies | ||
@@ -367,4 +277,6 @@ - html-dom-parser@0.1.2 | ||
## [0.3.5](https://github.com/remarkablemark/html-react-parser/compare/v0.3.4...v0.3.5) - 2017-06-26 | ||
## [0.3.5](https://github.com/remarkablemark/html-react-parser/compare/v0.3.4...v0.3.5) (2017-06-26) | ||
### Changed | ||
- Dependencies | ||
@@ -377,4 +289,6 @@ - html-dom-parser@0.1.1 | ||
## [0.3.4](https://github.com/remarkablemark/html-react-parser/compare/v0.3.3...v0.3.4) - 2017-06-17 | ||
## [0.3.4](https://github.com/remarkablemark/html-react-parser/compare/v0.3.3...v0.3.4) (2017-06-17) | ||
### Changed | ||
- Dependencies: | ||
@@ -388,41 +302,56 @@ - html-dom-parser@0.1.0 | ||
### Removed | ||
- Dependencies: | ||
- jsdomify | ||
## [0.3.3](https://github.com/remarkablemark/html-react-parser/compare/v0.3.2...v0.3.3) - 2017-01-27 | ||
## [0.3.3](https://github.com/remarkablemark/html-react-parser/compare/v0.3.2...v0.3.3) (2017-01-27) | ||
### Added | ||
- Created CHANGELOG with details on each version release (#37) | ||
- Created CHANGELOG with details on each version release ([#37](https://github.com/remarkablemark/html-react-parser/issues/37)) | ||
### Changed | ||
- Update examples to load parser from relative `dist/` directory (#36) | ||
### Removed | ||
- Removed unnecessary field "browser" in `package.json` (#36) | ||
- Update examples to load parser from relative `dist/` directory ([#36](https://github.com/remarkablemark/html-react-parser/issues/36)) | ||
- Removed unnecessary field "browser" in `package.json` ([#36](https://github.com/remarkablemark/html-react-parser/issues/36)) | ||
## [0.3.2](https://github.com/remarkablemark/html-react-parser/compare/v0.3.1...v0.3.2) - 2017-01-26 | ||
## [0.3.2](https://github.com/remarkablemark/html-react-parser/compare/v0.3.1...v0.3.2) (2017-01-26) | ||
### Fixed | ||
- Decode HTML entities by default on node (#34) | ||
## [0.3.1](https://github.com/remarkablemark/html-react-parser/compare/v0.3.0...v0.3.1) - 2017-01-10 | ||
- Decode HTML entities by default on node ([#34](https://github.com/remarkablemark/html-react-parser/issues/34)) | ||
## [0.3.1](https://github.com/remarkablemark/html-react-parser/compare/v0.3.0...v0.3.1) (2017-01-10) | ||
### Changed | ||
- Updated README by fixing CDN installation instructions and adding JSFiddle | ||
## [0.3.0](https://github.com/remarkablemark/html-react-parser/compare/v0.2.0...v0.3.0) - 2016-11-18 | ||
## [0.3.0](https://github.com/remarkablemark/html-react-parser/compare/v0.2.0...v0.3.0) (2016-11-18) | ||
### Changed | ||
- Upgrade `react` and `react-dom` to >15.4 | ||
## [0.2.0](https://github.com/remarkablemark/html-react-parser/compare/v0.1.1...v0.2.0) - 2016-11-18 | ||
## [0.2.0](https://github.com/remarkablemark/html-react-parser/compare/v0.1.1...v0.2.0) (2016-11-18) | ||
### Added | ||
- Create npm script `clean` that removes `dist/` directory | ||
### Fixed | ||
- Silence webpack warning by keeping react <15.4 in this version | ||
## [0.1.1](https://github.com/remarkablemark/html-react-parser/compare/v0.1.0...v0.1.1) - 2016-11-17 | ||
## [0.1.1](https://github.com/remarkablemark/html-react-parser/compare/v0.1.0...v0.1.1) (2016-11-17) | ||
### Fixed | ||
- `HTMLDOMPropertyConfig.js` and `SVGDOMPropertyConfig.js` have been moved from `react/lib/` to `react-dom/lib/` in v15.4 | ||
## [0.1.0](https://github.com/remarkablemark/html-react-parser/compare/v0.0.7...v0.1.0) - 2016-10-14 | ||
## [0.1.0](https://github.com/remarkablemark/html-react-parser/compare/v0.0.7...v0.1.0) (2016-10-14) | ||
### Changed | ||
- Replace HTML to DOM converter with [html-dom-parser](https://github.com/remarkablemark/html-dom-parser) (#28) | ||
- Replace HTML to DOM converter with [html-dom-parser](https://github.com/remarkablemark/html-dom-parser) ([#28](https://github.com/remarkablemark/html-react-parser/issues/28)) | ||
- Save `html-dom-parser` | ||
@@ -432,59 +361,81 @@ - Remove `domhandler` and `htmlparser2` | ||
## [0.0.7](https://github.com/remarkablemark/html-react-parser/compare/v0.0.6...v0.0.7) - 2016-09-27 | ||
## [0.0.7](https://github.com/remarkablemark/html-react-parser/compare/v0.0.6...v0.0.7) (2016-09-27) | ||
### Added | ||
- Examples of using the parser with script tag and RequireJS (#26) | ||
- Examples of using the parser with script tag and RequireJS ([#26](https://github.com/remarkablemark/html-react-parser/issues/26)) | ||
### Changed | ||
- Update build (#25) | ||
- Update README description, instructions, and examples (#27) | ||
## [0.0.6](https://github.com/remarkablemark/html-react-parser/compare/v0.0.5...v0.0.6) - 2016-09-27 | ||
- Update build ([#25](https://github.com/remarkablemark/html-react-parser/issues/25)) | ||
- Update README description, instructions, and examples ([#27](https://github.com/remarkablemark/html-react-parser/issues/27)) | ||
## [0.0.6](https://github.com/remarkablemark/html-react-parser/compare/v0.0.5...v0.0.6) (2016-09-27) | ||
### Added | ||
- README example with advanced usage of `replace` option from @poacher2k (#17) | ||
- Contributors section to README (#21) | ||
- README example with advanced usage of `replace` option from @poacher2k ([#17](https://github.com/remarkablemark/html-react-parser/issues/17)) | ||
- Contributors section to README ([#21](https://github.com/remarkablemark/html-react-parser/issues/21)) | ||
### Changed | ||
- Use webpack to build UMD bundle (#22) | ||
- Use webpack to build UMD bundle ([#22](https://github.com/remarkablemark/html-react-parser/issues/22)) | ||
### Fixed | ||
- Regex bug on client parser (#24) | ||
## [0.0.5](https://github.com/remarkablemark/html-react-parser/compare/v0.0.4...v0.0.5) - 2016-08-30 | ||
- Regex bug on client parser ([#24](https://github.com/remarkablemark/html-react-parser/issues/24)) | ||
## [0.0.5](https://github.com/remarkablemark/html-react-parser/compare/v0.0.4...v0.0.5) (2016-08-30) | ||
### Changed | ||
- Remove `key` parameter from `replace` and use `React.cloneElement` (#18) | ||
- Remove `key` parameter from `replace` and use `React.cloneElement` ([#18](https://github.com/remarkablemark/html-react-parser/issues/18)) | ||
### Fixed | ||
- Parsing of `<script>` and `<style>` tags (#20) | ||
## [0.0.4](https://github.com/remarkablemark/html-react-parser/compare/v0.0.3...v0.0.4) - 2016-08-29 | ||
- Parsing of `<script>` and `<style>` tags ([#20](https://github.com/remarkablemark/html-react-parser/issues/20)) | ||
## [0.0.4](https://github.com/remarkablemark/html-react-parser/compare/v0.0.3...v0.0.4) (2016-08-29) | ||
### Added | ||
- Send coverage report generated by [istanbul](http://gotwarlost.github.io/istanbul/) to [coveralls](https://coveralls.io) (#12) | ||
- Display badges in README (#13, #15) | ||
- Update parser's `replace` option with additional 2nd parameter `key` (#16) | ||
- Send coverage report generated by [istanbul](http://gotwarlost.github.io/istanbul/) to [coveralls](https://coveralls.io) ([#12](https://github.com/remarkablemark/html-react-parser/issues/12)) | ||
- Display badges in README ([#13](https://github.com/remarkablemark/html-react-parser/issues/13), [#15](https://github.com/remarkablemark/html-react-parser/issues/15)) | ||
- Update parser's `replace` option with additional 2nd parameter `key` ([#16](https://github.com/remarkablemark/html-react-parser/issues/16)) | ||
### Fixed | ||
- Void elements (e.g., `<img />`) should not have children (#16) | ||
- Set default `key` parameter for sibling elements due to [keys warning](https://fb.me/react-warning-keys) (#16) | ||
## [0.0.3](https://github.com/remarkablemark/html-react-parser/compare/v0.0.2...v0.0.3) - 2016-08-24 | ||
- Void elements (e.g., `<img />`) should not have children ([#16](https://github.com/remarkablemark/html-react-parser/issues/16)) | ||
- Set default `key` parameter for sibling elements due to [keys warning](https://fb.me/react-warning-keys) ([#16](https://github.com/remarkablemark/html-react-parser/issues/16)) | ||
## [0.0.3](https://github.com/remarkablemark/html-react-parser/compare/v0.0.2...v0.0.3) (2016-08-24) | ||
### Added | ||
- Make package [UMD](https://github.com/ForbesLindesay/umd/blob/master/template.js) compatible (#9) | ||
- Throw an error if first argument is not a string (#10) | ||
- Make package [UMD](https://github.com/ForbesLindesay/umd/blob/master/template.js) compatible ([#9](https://github.com/remarkablemark/html-react-parser/issues/9)) | ||
- Throw an error if first argument is not a string ([#10](https://github.com/remarkablemark/html-react-parser/issues/10)) | ||
### Changed | ||
- Differentiate between node and browser environments for parser (#5) | ||
- Differentiate between node and browser environments for parser ([#5](https://github.com/remarkablemark/html-react-parser/issues/5)) | ||
### Fixed | ||
- HTML to DOM conversion on the client (#10) | ||
## [0.0.2](https://github.com/remarkablemark/html-react-parser/compare/v0.0.1...v0.0.2) - 2016-08-23 | ||
- HTML to DOM conversion on the client ([#10](https://github.com/remarkablemark/html-react-parser/issues/10)) | ||
## [0.0.2](https://github.com/remarkablemark/html-react-parser/compare/v0.0.1...v0.0.2) (2016-08-23) | ||
### Added | ||
- [ESLint](http://eslint.org) as the linter (#2) | ||
- [Travis CI](https://travis-ci.org) (#4) | ||
- [ESLint](http://eslint.org) as the linter ([#2](https://github.com/remarkablemark/html-react-parser/issues/2)) | ||
- [Travis CI](https://travis-ci.org) ([#4](https://github.com/remarkablemark/html-react-parser/issues/4)) | ||
### Fixed | ||
- `package.json` **peerDependencies** for `react` and `react-dom` | ||
## [0.0.1](https://github.com/remarkablemark/html-react-parser/tree/v0.0.1) - 2016-08-23 | ||
## [0.0.1](https://github.com/remarkablemark/html-react-parser/tree/v0.0.1) (2016-08-23) | ||
### Added | ||
- HTML to React parser which consists of: | ||
@@ -491,0 +442,0 @@ - HTML string to DOM object converter |
@@ -1127,2 +1127,4 @@ (function (global, factory) { | ||
var children; | ||
var data; | ||
var trim = options.trim; | ||
@@ -1137,3 +1139,3 @@ for (var i = 0, len = nodes.length; i < len; i++) { | ||
if (isValidElement(replaceElement)) { | ||
// specify a "key" prop if element has siblings | ||
// set "key" prop for sibling elements | ||
// https://fb.me/react-warning-keys | ||
@@ -1151,3 +1153,11 @@ if (len > 1) { | ||
if (node.type === 'text') { | ||
result.push(node.data); | ||
// if trim option is enabled, skip whitespace text nodes | ||
if (trim) { | ||
data = node.data.trim(); | ||
if (data) { | ||
result.push(node.data); | ||
} | ||
} else { | ||
result.push(node.data); | ||
} | ||
continue; | ||
@@ -1158,3 +1168,2 @@ } | ||
if (!shouldPassAttributesUnaltered(node)) { | ||
// update values | ||
props = attributesToProps_1(node.attribs); | ||
@@ -1165,29 +1174,31 @@ } | ||
// node type for <script> is "script" | ||
// node type for <style> is "style" | ||
if (node.type === 'script' || node.type === 'style') { | ||
// prevent text in <script> or <style> from being escaped | ||
// https://facebook.github.io/react/tips/dangerously-set-inner-html.html | ||
if (node.children[0]) { | ||
props.dangerouslySetInnerHTML = { | ||
__html: node.children[0].data | ||
}; | ||
} | ||
} else if (node.type === 'tag') { | ||
// setting textarea value in children is an antipattern in React | ||
// https://reactjs.org/docs/forms.html#the-textarea-tag | ||
if (node.name === 'textarea' && node.children[0]) { | ||
props.defaultValue = node.children[0].data; | ||
switch (node.type) { | ||
case 'script': | ||
case 'style': | ||
// prevent text in <script> or <style> from being escaped | ||
// https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml | ||
if (node.children[0]) { | ||
props.dangerouslySetInnerHTML = { | ||
__html: node.children[0].data | ||
}; | ||
} | ||
break; | ||
// continue recursion of creating React elements (if applicable) | ||
} else if (node.children && node.children.length) { | ||
children = domToReact(node.children, options); | ||
} | ||
case 'tag': | ||
// setting textarea value in children is an antipattern in React | ||
// https://reactjs.org/docs/forms.html#the-textarea-tag | ||
if (node.name === 'textarea' && node.children[0]) { | ||
props.defaultValue = node.children[0].data; | ||
} else if (node.children && node.children.length) { | ||
// continue recursion of creating React elements (if applicable) | ||
children = domToReact(node.children, options); | ||
} | ||
break; | ||
// skip all other cases (e.g., comment) | ||
} else { | ||
continue; | ||
default: | ||
continue; | ||
} | ||
// specify a "key" prop if element has siblings | ||
// set "key" prop for sibling elements | ||
// https://fb.me/react-warning-keys | ||
@@ -1205,2 +1216,4 @@ if (len > 1) { | ||
/** | ||
* Determines whether attributes should be altered or not. | ||
* | ||
* @param {React.ReactElement} node | ||
@@ -1207,0 +1220,0 @@ * @return {Boolean} |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).HTMLReactParser=t(e.React)}(this,function(g){"use strict";g=g&&Object.prototype.hasOwnProperty.call(g,"default")?g.default:g;var e={Properties:{autoFocus:4,accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:4,allowTransparency:0,alt:0,as:0,async:4,autoComplete:0,autoPlay:4,capture:4,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:5,cite:0,classID:0,className:0,cols:24,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:4,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:4,defer:4,dir:0,disabled:4,download:32,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:4,formTarget:0,frameBorder:0,headers:0,height:0,hidden:4,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:4,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:5,muted:5,name:0,nonce:0,noValidate:4,open:4,optimum:0,pattern:0,placeholder:0,playsInline:4,poster:0,preload:0,profile:0,radioGroup:0,readOnly:4,referrerPolicy:0,rel:0,required:4,reversed:4,role:0,rows:24,rowSpan:8,sandbox:0,scope:0,scoped:4,scrolling:0,seamless:4,selected:5,shape:0,size:24,sizes:0,span:24,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:8,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:4,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"}},t={Properties:{accentHeight:0,accumulate:0,additive:0,alignmentBaseline:0,allowReorder:0,alphabetic:0,amplitude:0,arabicForm:0,ascent:0,attributeName:0,attributeType:0,autoReverse:0,azimuth:0,baseFrequency:0,baseProfile:0,baselineShift:0,bbox:0,begin:0,bias:0,by:0,calcMode:0,capHeight:0,clip:0,clipPath:0,clipRule:0,clipPathUnits:0,colorInterpolation:0,colorInterpolationFilters:0,colorProfile:0,colorRendering:0,contentScriptType:0,contentStyleType:0,cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:0,direction:0,display:0,divisor:0,dominantBaseline:0,dur:0,dx:0,dy:0,edgeMode:0,elevation:0,enableBackground:0,end:0,exponent:0,externalResourcesRequired:0,fill:0,fillOpacity:0,fillRule:0,filter:0,filterRes:0,filterUnits:0,floodColor:0,floodOpacity:0,focusable:0,fontFamily:0,fontSize:0,fontSizeAdjust:0,fontStretch:0,fontStyle:0,fontVariant:0,fontWeight:0,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:0,glyphOrientationHorizontal:0,glyphOrientationVertical:0,glyphRef:0,gradientTransform:0,gradientUnits:0,hanging:0,horizAdvX:0,horizOriginX:0,ideographic:0,imageRendering:0,in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:0,kernelUnitLength:0,kerning:0,keyPoints:0,keySplines:0,keyTimes:0,lengthAdjust:0,letterSpacing:0,lightingColor:0,limitingConeAngle:0,local:0,markerEnd:0,markerMid:0,markerStart:0,markerHeight:0,markerUnits:0,markerWidth:0,mask:0,maskContentUnits:0,maskUnits:0,mathematical:0,mode:0,numOctaves:0,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:0,overlineThickness:0,paintOrder:0,panose1:0,pathLength:0,patternContentUnits:0,patternTransform:0,patternUnits:0,pointerEvents:0,points:0,pointsAtX:0,pointsAtY:0,pointsAtZ:0,preserveAlpha:0,preserveAspectRatio:0,primitiveUnits:0,r:0,radius:0,refX:0,refY:0,renderingIntent:0,repeatCount:0,repeatDur:0,requiredExtensions:0,requiredFeatures:0,restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:0,slope:0,spacing:0,specularConstant:0,specularExponent:0,speed:0,spreadMethod:0,startOffset:0,stdDeviation:0,stemh:0,stemv:0,stitchTiles:0,stopColor:0,stopOpacity:0,strikethroughPosition:0,strikethroughThickness:0,string:0,stroke:0,strokeDasharray:0,strokeDashoffset:0,strokeLinecap:0,strokeLinejoin:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0,surfaceScale:0,systemLanguage:0,tableValues:0,targetX:0,targetY:0,textAnchor:0,textDecoration:0,textRendering:0,textLength:0,to:0,transform:0,u1:0,u2:0,underlinePosition:0,underlineThickness:0,unicode:0,unicodeBidi:0,unicodeRange:0,unitsPerEm:0,vAlphabetic:0,vHanging:0,vIdeographic:0,vMathematical:0,values:0,vectorEffect:0,version:0,vertAdvY:0,vertOriginX:0,vertOriginY:0,viewBox:0,viewTarget:0,visibility:0,widths:0,wordSpacing:0,writingMode:0,x:0,xHeight:0,x1:0,x2:0,xChannelSelector:0,xlinkActuate:0,xlinkArcrole:0,xlinkHref:0,xlinkRole:0,xlinkShow:0,xlinkTitle:0,xlinkType:0,xmlBase:0,xmlns:0,xmlnsXlink:0,xmlLang:0,xmlSpace:0,y:0,y1:0,y2:0,yChannelSelector:0,z:0,zoomAndPan:0},DOMAttributeNames:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space"}},s=1,c=4,u=8,p=24,f=32;function d(e,t){return(e&t)===t}function r(e,t,r){var n,i,o,a=e.Properties,l=e.DOMAttributeNames;for(i in a)n=l[i]||(r?i:i.toLowerCase()),o=a[i],t[n]={attributeName:n,propertyName:i,mustUseProperty:d(o,s),hasBooleanValue:d(o,c),hasNumericValue:d(o,u),hasPositiveNumericValue:d(o,p),hasOverloadedBooleanValue:d(o,f)}}var n={};r(e,n);var i={};r(t,i,!0);var o={};r(e,o),r(t,o,!0);function m(n,r){if("string"!=typeof n)throw new TypeError("First argument must be a string");if(!n)return[];r=r||{};var i=1,o=1;function a(e){var t=e.match(y);t&&(i+=t.length);var r=e.lastIndexOf("\n");o=~r?e.length-r:o+e.length}function l(){var t={line:i,column:o};return function(e){return e.position=new s(t),p(),e}}function s(e){this.start=e,this.end={line:i,column:o},this.source=r.source}function c(e){var t=new Error(r.source+":"+i+":"+o+": "+e);if(t.reason=e,t.filename=r.source,t.line=i,t.column=o,t.source=n,!r.silent)throw t}function u(e){var t=e.exec(n);if(t){var r=t[0];return a(r),n=n.slice(r.length),t}}function p(){u(v)}function f(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var e=l();if("/"==n.charAt(0)&&"*"==n.charAt(1)){for(var t=2;T!=n.charAt(t)&&("*"!=n.charAt(t)||"/"!=n.charAt(t+1));)++t;if(t+=2,T===n.charAt(t-1))return c("End of comment missing");var r=n.slice(2,t-2);return o+=2,a(r),n=n.slice(t),o+=2,e({type:"comment",comment:r})}}function m(){var e=l(),t=u(k);if(t){if(d(),!u(x))return c("property missing ':'");var r=u(b),n=e({type:"declaration",property:E(t[0].replace(h,T)),value:r?E(r[0].replace(h,T)):T});return u(w),n}}return s.prototype.content=n,p(),function(){var e,t=[];for(f(t);e=m();)!1!==e&&(t.push(e),f(t));return t}()}var a={html:n,svg:i,properties:o,isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"))},h=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,y=/\n/g,v=/^\s*/,k=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,x=/^:\s*/,b=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,w=/^[;\s]*/,l=/^\s+|\s+$/g,T="";function E(e){return e?e.replace(l,T):T}var C=function(e,t){var r,n=null;if(!e||"string"!=typeof e)return n;for(var i,o,a=m(e),l="function"==typeof t,s=0,c=a.length;s<c;s++)i=(r=a[s]).property,o=r.value,l?t(i,o,r):o&&((n=n||{})[i]=o);return n},S=/-([a-z])/g,O=/^--[a-zA-Z0-9-]+$|^[^-]+$/;var F={PRESERVE_CUSTOM_ATTRIBUTES:16<=g.version.split(".")[0],camelCase:function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");return O.test(e)?e:e.toLowerCase().replace(S,function(e,t){return t.toUpperCase()})},invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var r,n,i="function"==typeof t,o={},a={};for(r in e)n=e[r],i&&(o=t(r,n))&&2===o.length?a[o[0]]=o[1]:"string"==typeof n&&(a[n]=r);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}},A=F.camelCase,M=a.html,R=a.svg,P=a.isCustomAttribute,D=Object.prototype.hasOwnProperty;var L=function(e){var t,r,n,i;e=e||{};var o={};for(t in e)n=e[t],P(t)?o[t]=n:(r=t.toLowerCase(),D.call(M,r)?o[(i=M[r]).propertyName]=!!(i.hasBooleanValue||i.hasOverloadedBooleanValue&&!n)||n:D.call(R,t)?o[(i=R[t]).propertyName]=n:F.PRESERVE_CUSTOM_ATTRIBUTES&&(o[t]=n));return null!=e.style&&(o.style=function(e){var r={};e&&C(e,function(e,t){e&&t&&(r[A(e)]=t)});return r}(e.style)),o};for(var N,B=function e(t,r){for(var n,i,o,a,l,s=(r=r||{}).library||g,c=s.cloneElement,u=s.createElement,p=s.isValidElement,f=[],d="function"==typeof r.replace,m=0,h=t.length;m<h;m++)if(n=t[m],d&&p(i=r.replace(n)))1<h&&(i=c(i,{key:i.key||m})),f.push(i);else if("text"!==n.type){if(o=n.attribs,l=n,F.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===l.type&&F.isCustomComponent(l.name,l.attribs)||(o=L(n.attribs)),a=null,"script"===n.type||"style"===n.type)n.children[0]&&(o.dangerouslySetInnerHTML={__html:n.children[0].data});else{if("tag"!==n.type)continue;"textarea"===n.name&&n.children[0]?o.defaultValue=n.children[0].data:n.children&&n.children.length&&(a=e(n.children,r))}1<h&&(o.key=m),f.push(u(n.name,o,a))}else f.push(n.data);return 1===f.length?f[0]:f},z=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],I={},H=0,V=z.length;H<V;H++)I[(N=z[H]).toLowerCase()]=N;function U(e){for(var t,r={},n=0,i=e.length;n<i;n++)r[(t=e[n]).name]=t.value;return r}function j(e){e=e.toLowerCase();var t=I[e];return t||e}var X={formatAttributes:U,formatDOM:function e(t,r,n){r=r||null;for(var i,o,a,l=[],s=0,c=t.length;s<c;s++){switch(i=t[s],a={next:null,prev:l[s-1]||null,parent:r},(o=l[s-1])&&(o.next=a),"#"!==i.nodeName[0]&&(a.name=j(i.nodeName),a.attribs={},i.attributes&&i.attributes.length&&(a.attribs=U(i.attributes))),i.nodeType){case 1:"script"===a.name||"style"===a.name?a.type=a.name:a.type="tag",a.children=e(i.childNodes,a);break;case 3:a.type="text",a.data=i.nodeValue;break;case 8:a.type="comment",a.data=i.nodeValue}l.push(a)}return n&&(l.unshift({name:n.substring(0,n.indexOf(" ")).toLowerCase(),data:n,type:"directive",next:l[0]?l[0]:null,prev:null,parent:r}),l[1]&&(l[1].prev=l[0])),l},isIE:function(e){return e?document.documentMode===e:/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}},_="body",q=/<([a-zA-Z]+[0-9]?)/,Y=/<head.*>/i,$=/<body.*>/i,G=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,W=X.isIE(9),Z=W||X.isIE(),K=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},J=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")};if("function"==typeof window.DOMParser){var Q=new window.DOMParser,ee=W?"text/xml":"text/html";K=J=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),W&&(e=e.replace(G,"<$1$2$3/>")),Q.parseFromString(e,ee)}}if(document.implementation){var te=document.implementation.createHTMLDocument(Z?"html-dom-parser":void 0);K=function(t,e){if(e)return te.documentElement.getElementsByTagName(e)[0].innerHTML=t,te;try{return te.documentElement.innerHTML=t,te}catch(e){if(J)return J(t)}}}var re,ne=document.createElement("template");ne.content&&(re=function(e){return ne.innerHTML=e,ne.content.childNodes});var ie=function(e){var t,r,n,i,o=e.match(q);switch(o&&o[1]&&(t=o[1].toLowerCase()),t){case"html":return r=J(e),Y.test(e)||(n=r.getElementsByTagName("head")[0])&&n.parentNode.removeChild(n),$.test(e)||(n=r.getElementsByTagName(_)[0])&&n.parentNode.removeChild(n),r.getElementsByTagName("html");case"head":case _:return i=K(e).getElementsByTagName(t),$.test(e)&&Y.test(e)?i[0].parentNode.childNodes:i;default:return re?re(e):K(e,_).getElementsByTagName(_)[0].childNodes}},oe=X.formatDOM,ae=X.isIE(9),le=/<(![a-zA-Z\s]+)>/;var se=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t,r=e.match(le);return r&&r[1]&&(t=r[1],ae&&(e=e.replace(r[0],""))),oe(ie(e),null,t)},ce={decodeEntities:!0,lowerCaseAttributeNames:!1};function ue(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:B(se(e,(t=t||{}).htmlparser2||ce),t)}ue.domToReact=B,ue.htmlToDOM=se;var pe=ue,fe=ue;return pe.default=fe,pe}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).HTMLReactParser=t(e.React)}(this,function(y){"use strict";y=y&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y;var e={Properties:{autoFocus:4,accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:4,allowTransparency:0,alt:0,as:0,async:4,autoComplete:0,autoPlay:4,capture:4,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:5,cite:0,classID:0,className:0,cols:24,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:4,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:4,defer:4,dir:0,disabled:4,download:32,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:4,formTarget:0,frameBorder:0,headers:0,height:0,hidden:4,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:4,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:5,muted:5,name:0,nonce:0,noValidate:4,open:4,optimum:0,pattern:0,placeholder:0,playsInline:4,poster:0,preload:0,profile:0,radioGroup:0,readOnly:4,referrerPolicy:0,rel:0,required:4,reversed:4,role:0,rows:24,rowSpan:8,sandbox:0,scope:0,scoped:4,scrolling:0,seamless:4,selected:5,shape:0,size:24,sizes:0,span:24,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:8,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:4,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"}},t={Properties:{accentHeight:0,accumulate:0,additive:0,alignmentBaseline:0,allowReorder:0,alphabetic:0,amplitude:0,arabicForm:0,ascent:0,attributeName:0,attributeType:0,autoReverse:0,azimuth:0,baseFrequency:0,baseProfile:0,baselineShift:0,bbox:0,begin:0,bias:0,by:0,calcMode:0,capHeight:0,clip:0,clipPath:0,clipRule:0,clipPathUnits:0,colorInterpolation:0,colorInterpolationFilters:0,colorProfile:0,colorRendering:0,contentScriptType:0,contentStyleType:0,cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:0,direction:0,display:0,divisor:0,dominantBaseline:0,dur:0,dx:0,dy:0,edgeMode:0,elevation:0,enableBackground:0,end:0,exponent:0,externalResourcesRequired:0,fill:0,fillOpacity:0,fillRule:0,filter:0,filterRes:0,filterUnits:0,floodColor:0,floodOpacity:0,focusable:0,fontFamily:0,fontSize:0,fontSizeAdjust:0,fontStretch:0,fontStyle:0,fontVariant:0,fontWeight:0,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:0,glyphOrientationHorizontal:0,glyphOrientationVertical:0,glyphRef:0,gradientTransform:0,gradientUnits:0,hanging:0,horizAdvX:0,horizOriginX:0,ideographic:0,imageRendering:0,in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:0,kernelUnitLength:0,kerning:0,keyPoints:0,keySplines:0,keyTimes:0,lengthAdjust:0,letterSpacing:0,lightingColor:0,limitingConeAngle:0,local:0,markerEnd:0,markerMid:0,markerStart:0,markerHeight:0,markerUnits:0,markerWidth:0,mask:0,maskContentUnits:0,maskUnits:0,mathematical:0,mode:0,numOctaves:0,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:0,overlineThickness:0,paintOrder:0,panose1:0,pathLength:0,patternContentUnits:0,patternTransform:0,patternUnits:0,pointerEvents:0,points:0,pointsAtX:0,pointsAtY:0,pointsAtZ:0,preserveAlpha:0,preserveAspectRatio:0,primitiveUnits:0,r:0,radius:0,refX:0,refY:0,renderingIntent:0,repeatCount:0,repeatDur:0,requiredExtensions:0,requiredFeatures:0,restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:0,slope:0,spacing:0,specularConstant:0,specularExponent:0,speed:0,spreadMethod:0,startOffset:0,stdDeviation:0,stemh:0,stemv:0,stitchTiles:0,stopColor:0,stopOpacity:0,strikethroughPosition:0,strikethroughThickness:0,string:0,stroke:0,strokeDasharray:0,strokeDashoffset:0,strokeLinecap:0,strokeLinejoin:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0,surfaceScale:0,systemLanguage:0,tableValues:0,targetX:0,targetY:0,textAnchor:0,textDecoration:0,textRendering:0,textLength:0,to:0,transform:0,u1:0,u2:0,underlinePosition:0,underlineThickness:0,unicode:0,unicodeBidi:0,unicodeRange:0,unitsPerEm:0,vAlphabetic:0,vHanging:0,vIdeographic:0,vMathematical:0,values:0,vectorEffect:0,version:0,vertAdvY:0,vertOriginX:0,vertOriginY:0,viewBox:0,viewTarget:0,visibility:0,widths:0,wordSpacing:0,writingMode:0,x:0,xHeight:0,x1:0,x2:0,xChannelSelector:0,xlinkActuate:0,xlinkArcrole:0,xlinkHref:0,xlinkRole:0,xlinkShow:0,xlinkTitle:0,xlinkType:0,xmlBase:0,xmlns:0,xmlnsXlink:0,xmlLang:0,xmlSpace:0,y:0,y1:0,y2:0,yChannelSelector:0,z:0,zoomAndPan:0},DOMAttributeNames:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space"}},l=1,c=4,u=8,p=24,f=32;function d(e,t){return(e&t)===t}function r(e,t,r){var n,i,o,a=e.Properties,s=e.DOMAttributeNames;for(i in a)n=s[i]||(r?i:i.toLowerCase()),o=a[i],t[n]={attributeName:n,propertyName:i,mustUseProperty:d(o,l),hasBooleanValue:d(o,c),hasNumericValue:d(o,u),hasPositiveNumericValue:d(o,p),hasOverloadedBooleanValue:d(o,f)}}var n={};r(e,n);var i={};r(t,i,!0);var o={};r(e,o),r(t,o,!0);function m(n,r){if("string"!=typeof n)throw new TypeError("First argument must be a string");if(!n)return[];r=r||{};var i=1,o=1;function a(e){var t=e.match(g);t&&(i+=t.length);var r=e.lastIndexOf("\n");o=~r?e.length-r:o+e.length}function s(){var t={line:i,column:o};return function(e){return e.position=new l(t),p(),e}}function l(e){this.start=e,this.end={line:i,column:o},this.source=r.source}function c(e){var t=new Error(r.source+":"+i+":"+o+": "+e);if(t.reason=e,t.filename=r.source,t.line=i,t.column=o,t.source=n,!r.silent)throw t}function u(e){var t=e.exec(n);if(t){var r=t[0];return a(r),n=n.slice(r.length),t}}function p(){u(v)}function f(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var e=s();if("/"==n.charAt(0)&&"*"==n.charAt(1)){for(var t=2;T!=n.charAt(t)&&("*"!=n.charAt(t)||"/"!=n.charAt(t+1));)++t;if(t+=2,T===n.charAt(t-1))return c("End of comment missing");var r=n.slice(2,t-2);return o+=2,a(r),n=n.slice(t),o+=2,e({type:"comment",comment:r})}}function m(){var e=s(),t=u(k);if(t){if(d(),!u(x))return c("property missing ':'");var r=u(b),n=e({type:"declaration",property:E(t[0].replace(h,T)),value:r?E(r[0].replace(h,T)):T});return u(w),n}}return l.prototype.content=n,p(),function(){var e,t=[];for(f(t);e=m();)!1!==e&&(t.push(e),f(t));return t}()}var a={html:n,svg:i,properties:o,isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"))},h=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,g=/\n/g,v=/^\s*/,k=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,x=/^:\s*/,b=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,w=/^[;\s]*/,s=/^\s+|\s+$/g,T="";function E(e){return e?e.replace(s,T):T}var C=function(e,t){var r,n=null;if(!e||"string"!=typeof e)return n;for(var i,o,a=m(e),s="function"==typeof t,l=0,c=a.length;l<c;l++)i=(r=a[l]).property,o=r.value,s?t(i,o,r):o&&((n=n||{})[i]=o);return n},S=/-([a-z])/g,O=/^--[a-zA-Z0-9-]+$|^[^-]+$/;var F={PRESERVE_CUSTOM_ATTRIBUTES:16<=y.version.split(".")[0],camelCase:function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");return O.test(e)?e:e.toLowerCase().replace(S,function(e,t){return t.toUpperCase()})},invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var r,n,i="function"==typeof t,o={},a={};for(r in e)n=e[r],i&&(o=t(r,n))&&2===o.length?a[o[0]]=o[1]:"string"==typeof n&&(a[n]=r);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}},A=F.camelCase,M=a.html,R=a.svg,P=a.isCustomAttribute,D=Object.prototype.hasOwnProperty;var L=function(e){var t,r,n,i;e=e||{};var o={};for(t in e)n=e[t],P(t)?o[t]=n:(r=t.toLowerCase(),D.call(M,r)?o[(i=M[r]).propertyName]=!!(i.hasBooleanValue||i.hasOverloadedBooleanValue&&!n)||n:D.call(R,t)?o[(i=R[t]).propertyName]=n:F.PRESERVE_CUSTOM_ATTRIBUTES&&(o[t]=n));return null!=e.style&&(o.style=function(e){var r={};e&&C(e,function(e,t){e&&t&&(r[A(e)]=t)});return r}(e.style)),o};for(var N,B=function e(t,r){for(var n,i,o,a,s,l=(r=r||{}).library||y,c=l.cloneElement,u=l.createElement,p=l.isValidElement,f=[],d="function"==typeof r.replace,m=r.trim,h=0,g=t.length;h<g;h++)if(n=t[h],d&&p(i=r.replace(n)))1<g&&(i=c(i,{key:i.key||h})),f.push(i);else if("text"!==n.type){switch(o=n.attribs,s=n,F.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===s.type&&F.isCustomComponent(s.name,s.attribs)||(o=L(n.attribs)),a=null,n.type){case"script":case"style":n.children[0]&&(o.dangerouslySetInnerHTML={__html:n.children[0].data});break;case"tag":"textarea"===n.name&&n.children[0]?o.defaultValue=n.children[0].data:n.children&&n.children.length&&(a=e(n.children,r));break;default:continue}1<g&&(o.key=h),f.push(u(n.name,o,a))}else m&&!n.data.trim()||f.push(n.data);return 1===f.length?f[0]:f},z=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],I={},H=0,V=z.length;H<V;H++)I[(N=z[H]).toLowerCase()]=N;function U(e){for(var t,r={},n=0,i=e.length;n<i;n++)r[(t=e[n]).name]=t.value;return r}function j(e){e=e.toLowerCase();var t=I[e];return t||e}var X={formatAttributes:U,formatDOM:function e(t,r,n){r=r||null;for(var i,o,a,s=[],l=0,c=t.length;l<c;l++){switch(i=t[l],a={next:null,prev:s[l-1]||null,parent:r},(o=s[l-1])&&(o.next=a),"#"!==i.nodeName[0]&&(a.name=j(i.nodeName),a.attribs={},i.attributes&&i.attributes.length&&(a.attribs=U(i.attributes))),i.nodeType){case 1:"script"===a.name||"style"===a.name?a.type=a.name:a.type="tag",a.children=e(i.childNodes,a);break;case 3:a.type="text",a.data=i.nodeValue;break;case 8:a.type="comment",a.data=i.nodeValue}s.push(a)}return n&&(s.unshift({name:n.substring(0,n.indexOf(" ")).toLowerCase(),data:n,type:"directive",next:s[0]?s[0]:null,prev:null,parent:r}),s[1]&&(s[1].prev=s[0])),s},isIE:function(e){return e?document.documentMode===e:/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}},_="body",q=/<([a-zA-Z]+[0-9]?)/,Y=/<head.*>/i,$=/<body.*>/i,G=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,W=X.isIE(9),Z=W||X.isIE(),K=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},J=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")};if("function"==typeof window.DOMParser){var Q=new window.DOMParser,ee=W?"text/xml":"text/html";K=J=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),W&&(e=e.replace(G,"<$1$2$3/>")),Q.parseFromString(e,ee)}}if(document.implementation){var te=document.implementation.createHTMLDocument(Z?"html-dom-parser":void 0);K=function(t,e){if(e)return te.documentElement.getElementsByTagName(e)[0].innerHTML=t,te;try{return te.documentElement.innerHTML=t,te}catch(e){if(J)return J(t)}}}var re,ne=document.createElement("template");ne.content&&(re=function(e){return ne.innerHTML=e,ne.content.childNodes});var ie=function(e){var t,r,n,i,o=e.match(q);switch(o&&o[1]&&(t=o[1].toLowerCase()),t){case"html":return r=J(e),Y.test(e)||(n=r.getElementsByTagName("head")[0])&&n.parentNode.removeChild(n),$.test(e)||(n=r.getElementsByTagName(_)[0])&&n.parentNode.removeChild(n),r.getElementsByTagName("html");case"head":case _:return i=K(e).getElementsByTagName(t),$.test(e)&&Y.test(e)?i[0].parentNode.childNodes:i;default:return re?re(e):K(e,_).getElementsByTagName(_)[0].childNodes}},oe=X.formatDOM,ae=X.isIE(9),se=/<(![a-zA-Z\s]+)>/;var le=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t,r=e.match(se);return r&&r[1]&&(t=r[1],ae&&(e=e.replace(r[0],""))),oe(ie(e),null,t)},ce={decodeEntities:!0,lowerCaseAttributeNames:!1};function ue(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:B(le(e,(t=t||{}).htmlparser2||ce),t)}ue.domToReact=B,ue.htmlToDOM=le;var pe=ue,fe=ue;return pe.default=fe,pe}); | ||
//# sourceMappingURL=html-react-parser.min.js.map |
@@ -24,2 +24,4 @@ // TypeScript Version: 3.3 | ||
) => JSX.Element | object | void | undefined | null | false; | ||
trim?: boolean; | ||
} | ||
@@ -26,0 +28,0 @@ |
@@ -27,2 +27,4 @@ var attributesToProps = require('./attributes-to-props'); | ||
var children; | ||
var data; | ||
var trim = options.trim; | ||
@@ -37,3 +39,3 @@ for (var i = 0, len = nodes.length; i < len; i++) { | ||
if (isValidElement(replaceElement)) { | ||
// specify a "key" prop if element has siblings | ||
// set "key" prop for sibling elements | ||
// https://fb.me/react-warning-keys | ||
@@ -51,3 +53,11 @@ if (len > 1) { | ||
if (node.type === 'text') { | ||
result.push(node.data); | ||
// if trim option is enabled, skip whitespace text nodes | ||
if (trim) { | ||
data = node.data.trim(); | ||
if (data) { | ||
result.push(node.data); | ||
} | ||
} else { | ||
result.push(node.data); | ||
} | ||
continue; | ||
@@ -58,3 +68,2 @@ } | ||
if (!shouldPassAttributesUnaltered(node)) { | ||
// update values | ||
props = attributesToProps(node.attribs); | ||
@@ -65,29 +74,31 @@ } | ||
// node type for <script> is "script" | ||
// node type for <style> is "style" | ||
if (node.type === 'script' || node.type === 'style') { | ||
// prevent text in <script> or <style> from being escaped | ||
// https://facebook.github.io/react/tips/dangerously-set-inner-html.html | ||
if (node.children[0]) { | ||
props.dangerouslySetInnerHTML = { | ||
__html: node.children[0].data | ||
}; | ||
} | ||
} else if (node.type === 'tag') { | ||
// setting textarea value in children is an antipattern in React | ||
// https://reactjs.org/docs/forms.html#the-textarea-tag | ||
if (node.name === 'textarea' && node.children[0]) { | ||
props.defaultValue = node.children[0].data; | ||
switch (node.type) { | ||
case 'script': | ||
case 'style': | ||
// prevent text in <script> or <style> from being escaped | ||
// https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml | ||
if (node.children[0]) { | ||
props.dangerouslySetInnerHTML = { | ||
__html: node.children[0].data | ||
}; | ||
} | ||
break; | ||
// continue recursion of creating React elements (if applicable) | ||
} else if (node.children && node.children.length) { | ||
children = domToReact(node.children, options); | ||
} | ||
case 'tag': | ||
// setting textarea value in children is an antipattern in React | ||
// https://reactjs.org/docs/forms.html#the-textarea-tag | ||
if (node.name === 'textarea' && node.children[0]) { | ||
props.defaultValue = node.children[0].data; | ||
} else if (node.children && node.children.length) { | ||
// continue recursion of creating React elements (if applicable) | ||
children = domToReact(node.children, options); | ||
} | ||
break; | ||
// skip all other cases (e.g., comment) | ||
} else { | ||
continue; | ||
default: | ||
continue; | ||
} | ||
// specify a "key" prop if element has siblings | ||
// set "key" prop for sibling elements | ||
// https://fb.me/react-warning-keys | ||
@@ -105,2 +116,4 @@ if (len > 1) { | ||
/** | ||
* Determines whether attributes should be altered or not. | ||
* | ||
* @param {React.ReactElement} node | ||
@@ -107,0 +120,0 @@ * @return {Boolean} |
{ | ||
"name": "html-react-parser", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "HTML to React parser.", | ||
@@ -62,3 +62,3 @@ "author": "Mark <mark@remarkablemark.org>", | ||
"rollup-plugin-uglify": "^6.0.4", | ||
"standard-version": "^5", | ||
"standard-version": "5", | ||
"typescript": "^3.9.3" | ||
@@ -65,0 +65,0 @@ }, |
@@ -255,2 +255,28 @@ # html-react-parser | ||
### trim | ||
Normally, whitespace is preserved: | ||
```js | ||
parse('<br>\n'); // [React.createElement('br'), '\n'] | ||
``` | ||
By enabling the `trim` option, whitespace text nodes will be skipped: | ||
```js | ||
parse('<br>\n', { trim: true }); // React.createElement('br') | ||
``` | ||
This addresses the warning: | ||
``` | ||
Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <table>. Make sure you don't have any extra whitespace between tags on each line of your source code. | ||
``` | ||
However, this option may strip out intentional whitespace: | ||
```js | ||
parse('<p> </p>', { trim: true }); // React.createElement('p') | ||
``` | ||
## FAQ | ||
@@ -292,2 +318,27 @@ | ||
#### I get "Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table." | ||
Enable the [trim](https://github.com/remarkablemark/html-react-parser#trim) option. See [#155](https://github.com/remarkablemark/html-react-parser/issues/155). | ||
#### Don't change case of tags. | ||
Tags are lowercased by default. To prevent that from happening, pass the [htmlparser2 option](https://github.com/remarkablemark/html-react-parser#htmlparser2): | ||
```js | ||
const options = { | ||
htmlparser2: { | ||
lowerCaseTags: false | ||
} | ||
}; | ||
parse('<CustomElement>', options); // React.createElement('CustomElement') | ||
``` | ||
> **Warning**: By preserving case-sensitivity of the tags, you may get rendering warnings like: | ||
> | ||
> ``` | ||
> Warning: <CustomElement> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements. | ||
> ``` | ||
See [#62](https://github.com/remarkablemark/html-react-parser/issues/62) and [example](https://repl.it/@remarkablemark/html-react-parser-62). | ||
## Benchmarks | ||
@@ -294,0 +345,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252872
1944
400