html-react-parser 5.1.10 → 5.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Build Status](https://github.com/remarkablemark/html-react-parser/workflows/build/badge.svg?branch=master)](https://github.com/remarkablemark/html-react-parser/actions?query=workflow%3Abuild)
8
8
  [![codecov](https://codecov.io/gh/remarkablemark/html-react-parser/branch/master/graph/badge.svg?token=wosFd1DBIR)](https://codecov.io/gh/remarkablemark/html-react-parser)
9
9
  [![NPM downloads](https://badgen.net/npm/dm/html-react-parser)](https://www.npmjs.com/package/html-react-parser)
10
- [![Discord](https://img.shields.io/discord/422421589582282752.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/njExwXdrRJ)
10
+ [![Discord](https://badgen.net/discord/online-members/zkS3QDV?cache=300&icon=discord)](https://b.remarkabl.org/discord)
11
11
 
12
12
  HTML to React parser that works on both the server (Node.js) and the client (browser):
13
13
 
@@ -211,7 +211,7 @@ parse('<br>', {
211
211
 
212
212
  #### replace with TypeScript
213
213
 
214
- For TypeScript, you'll need to check that `domNode` is an instance of domhandler's `Element`:
214
+ You need to check that `domNode` is an instance of domhandler's `Element`:
215
215
 
216
216
  ```tsx
217
217
  import { HTMLReactParserOptions, Element } from 'html-react-parser';
@@ -239,7 +239,7 @@ const options: HTMLReactParserOptions = {
239
239
  };
240
240
  ```
241
241
 
242
- If you're having issues take a look at our [Create React App example](./examples/create-react-app-typescript/src/App.tsx).
242
+ If you're having issues, take a look at our [Create React App example](./examples/create-react-app-typescript/src/App.tsx).
243
243
 
244
244
  #### replace element and children
245
245
 
@@ -401,7 +401,7 @@ parse('<br>', {
401
401
  ### htmlparser2
402
402
 
403
403
  > [!WARNING]
404
- > `htmlparser2` options _**don't work** on the client-side_ (browser) and they _**only work** on the server-side_ (Node.js). By overriding the options, it can break universal rendering.
404
+ > `htmlparser2` options _**don't work** on the client-side_ (browser); they _**only work** on the server-side_ (Node.js). By overriding the options, it can break universal rendering.
405
405
 
406
406
  Default [htmlparser2 options](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-xmlmode) can be overridden in >=[0.12.0](https://github.com/remarkablemark/html-react-parser/tree/v0.12.0).
407
407
 
@@ -32,6 +32,7 @@
32
32
  var domparser$1 = {};
33
33
 
34
34
  Object.defineProperty(domparser$1, "__esModule", { value: true });
35
+ domparser$1.default = domparser;
35
36
  // constants
36
37
  var HTML = 'html';
37
38
  var HEAD = 'head';
@@ -166,7 +167,6 @@
166
167
  }
167
168
  }
168
169
  }
169
- domparser$1.default = domparser;
170
170
 
171
171
  var utilities$2 = {};
172
172
 
@@ -925,7 +925,8 @@
925
925
  } (constants));
926
926
 
927
927
  Object.defineProperty(utilities$2, "__esModule", { value: true });
928
- utilities$2.formatDOM = utilities$2.formatAttributes = void 0;
928
+ utilities$2.formatAttributes = formatAttributes;
929
+ utilities$2.formatDOM = formatDOM;
929
930
  var domhandler_1 = lib$2;
930
931
  var constants_1 = constants;
931
932
  /**
@@ -954,7 +955,6 @@
954
955
  }
955
956
  return map;
956
957
  }
957
- utilities$2.formatAttributes = formatAttributes;
958
958
  /**
959
959
  * Corrects the tag name if it is case-sensitive (SVG).
960
960
  * Otherwise, returns the lowercase tag name (HTML).
@@ -1030,12 +1030,12 @@
1030
1030
  }
1031
1031
  return domNodes;
1032
1032
  }
1033
- utilities$2.formatDOM = formatDOM;
1034
1033
 
1035
1034
  var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
1036
1035
  return (mod && mod.__esModule) ? mod : { "default": mod };
1037
1036
  };
1038
1037
  Object.defineProperty(htmlToDom, "__esModule", { value: true });
1038
+ htmlToDom.default = HTMLDOMParser;
1039
1039
  var domparser_1 = __importDefault$3(domparser$1);
1040
1040
  var utilities_1$3 = utilities$2;
1041
1041
  var DIRECTIVE_REGEX = /<(![a-zA-Z\s]+)>/; // e.g., <!doctype html>
@@ -1057,7 +1057,6 @@
1057
1057
  var directive = match ? match[1] : undefined;
1058
1058
  return (0, utilities_1$3.formatDOM)((0, domparser_1.default)(html), null, directive);
1059
1059
  }
1060
- htmlToDom.default = HTMLDOMParser;
1061
1060
 
1062
1061
  var attributesToProps$1 = {};
1063
1062
 
@@ -2460,7 +2459,9 @@
2460
2459
  return (mod && mod.__esModule) ? mod : { "default": mod };
2461
2460
  };
2462
2461
  Object.defineProperty(exports, "__esModule", { value: true });
2463
- exports.returnFirstArg = exports.canTextBeChildOfNode = exports.ELEMENTS_WITH_NO_TEXT_CHILDREN = exports.PRESERVE_CUSTOM_ATTRIBUTES = exports.setStyleProp = exports.isCustomComponent = void 0;
2462
+ exports.returnFirstArg = exports.canTextBeChildOfNode = exports.ELEMENTS_WITH_NO_TEXT_CHILDREN = exports.PRESERVE_CUSTOM_ATTRIBUTES = void 0;
2463
+ exports.isCustomComponent = isCustomComponent;
2464
+ exports.setStyleProp = setStyleProp;
2464
2465
  var react_1 = require$$0;
2465
2466
  var style_to_js_1 = __importDefault(cjs);
2466
2467
  var RESERVED_SVG_MATHML_ELEMENTS = new Set([
@@ -2495,7 +2496,6 @@
2495
2496
  }
2496
2497
  return true;
2497
2498
  }
2498
- exports.isCustomComponent = isCustomComponent;
2499
2499
  var styleOptions = {
2500
2500
  reactCompat: true,
2501
2501
  };
@@ -2520,7 +2520,6 @@
2520
2520
  props.style = {};
2521
2521
  }
2522
2522
  }
2523
- exports.setStyleProp = setStyleProp;
2524
2523
  /**
2525
2524
  * @see https://reactjs.org/blog/2017/09/08/dom-attributes-in-react-16.html
2526
2525
  */
@@ -2561,6 +2560,7 @@
2561
2560
  } (utilities$1));
2562
2561
 
2563
2562
  Object.defineProperty(attributesToProps$1, "__esModule", { value: true });
2563
+ attributesToProps$1.default = attributesToProps;
2564
2564
  var react_property_1 = lib;
2565
2565
  var utilities_1$1 = utilities$1;
2566
2566
  // https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components
@@ -2622,7 +2622,6 @@
2622
2622
  (0, utilities_1$1.setStyleProp)(attributes.style, props);
2623
2623
  return props;
2624
2624
  }
2625
- attributesToProps$1.default = attributesToProps;
2626
2625
  /**
2627
2626
  * Gets prop name from lowercased attribute name.
2628
2627
  *
@@ -2639,6 +2638,7 @@
2639
2638
  return (mod && mod.__esModule) ? mod : { "default": mod };
2640
2639
  };
2641
2640
  Object.defineProperty(domToReact$1, "__esModule", { value: true });
2641
+ domToReact$1.default = domToReact;
2642
2642
  var react_1 = require$$0;
2643
2643
  var attributes_to_props_1 = __importDefault(attributesToProps$1);
2644
2644
  var utilities_1 = utilities$1;
@@ -2742,7 +2742,6 @@
2742
2742
  }
2743
2743
  return reactElements.length === 1 ? reactElements[0] : reactElements;
2744
2744
  }
2745
- domToReact$1.default = domToReact;
2746
2745
  /**
2747
2746
  * Determines whether DOM element attributes should be transformed to props.
2748
2747
  * Web Components should not have their attributes transformed except for `style`.
@@ -2762,6 +2761,7 @@
2762
2761
  };
2763
2762
  Object.defineProperty(exports, "__esModule", { value: true });
2764
2763
  exports.htmlToDOM = exports.domToReact = exports.attributesToProps = exports.Text = exports.ProcessingInstruction = exports.Element = exports.Comment = void 0;
2764
+ exports.default = HTMLReactParser;
2765
2765
  var html_dom_parser_1 = __importDefault(htmlToDom);
2766
2766
  exports.htmlToDOM = html_dom_parser_1.default;
2767
2767
  var attributes_to_props_1 = __importDefault(attributesToProps$1);
@@ -2790,7 +2790,6 @@
2790
2790
  }
2791
2791
  return (0, dom_to_react_1.default)((0, html_dom_parser_1.default)(html, (options === null || options === void 0 ? void 0 : options.htmlparser2) || domParserOptions), options);
2792
2792
  }
2793
- exports.default = HTMLReactParser;
2794
2793
 
2795
2794
  } (lib$3));
2796
2795