html-react-parser 5.2.6 → 5.2.8

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
@@ -27,7 +27,7 @@ import parse from 'html-react-parser';
27
27
  parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')
28
28
  ```
29
29
 
30
- [Replit](https://replit.com/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [StackBlitz](https://stackblitz.com/edit/html-react-parser) | [TypeScript](https://stackblitz.com/edit/html-react-parser-typescript) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples)
30
+ [StackBlitz](https://stackblitz.com/edit/html-react-parser) | [TypeScript](https://stackblitz.com/edit/html-react-parser-typescript) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples)
31
31
 
32
32
  <details>
33
33
  <summary>Table of Contents</summary>
@@ -207,6 +207,7 @@ parse('<br>', {
207
207
  ```
208
208
 
209
209
  > [!NOTE]
210
+ >
210
211
  > The index will restart at 0 when traversing the node's children so don't rely on index being a unique key. See [#1259](https://github.com/remarkablemark/html-react-parser/issues/1259#issuecomment-1889574133).
211
212
 
212
213
  #### replace with TypeScript
@@ -401,7 +402,8 @@ parse('<br>', {
401
402
  ### htmlparser2
402
403
 
403
404
  > [!WARNING]
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
+ >
406
+ > `htmlparser2` options _**do not 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
407
 
406
408
  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
409
 
@@ -549,6 +551,7 @@ parse('<CustomElement>', options); // React.createElement('CustomElement')
549
551
  ```
550
552
 
551
553
  > [!WARNING]
554
+ >
552
555
  > By preserving case-sensitivity of the tags, you may get rendering warnings like:
553
556
  >
554
557
  > ```
@@ -2170,14 +2170,15 @@
2170
2170
 
2171
2171
  var utilities$1 = {};
2172
2172
 
2173
- var cjs$1 = {};
2173
+ var cjs$2 = {};
2174
2174
 
2175
- var inlineStyleParser;
2176
- var hasRequiredInlineStyleParser;
2175
+ var cjs$1;
2176
+ var hasRequiredCjs$2;
2177
+
2178
+ function requireCjs$2 () {
2179
+ if (hasRequiredCjs$2) return cjs$1;
2180
+ hasRequiredCjs$2 = 1;
2177
2181
 
2178
- function requireInlineStyleParser () {
2179
- if (hasRequiredInlineStyleParser) return inlineStyleParser;
2180
- hasRequiredInlineStyleParser = 1;
2181
2182
  // http://www.w3.org/TR/CSS21/grammar.html
2182
2183
  // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
2183
2184
  var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
@@ -2211,7 +2212,7 @@
2211
2212
  * @throws {TypeError}
2212
2213
  * @throws {Error}
2213
2214
  */
2214
- inlineStyleParser = function (style, options) {
2215
+ function index (style, options) {
2215
2216
  if (typeof style !== 'string') {
2216
2217
  throw new TypeError('First argument must be a string');
2217
2218
  }
@@ -2424,7 +2425,7 @@
2424
2425
 
2425
2426
  whitespace();
2426
2427
  return declarations();
2427
- };
2428
+ }
2428
2429
 
2429
2430
  /**
2430
2431
  * Trim `str`.
@@ -2435,20 +2436,23 @@
2435
2436
  function trim(str) {
2436
2437
  return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
2437
2438
  }
2438
- return inlineStyleParser;
2439
+
2440
+ cjs$1 = index;
2441
+
2442
+ return cjs$1;
2439
2443
  }
2440
2444
 
2441
2445
  var hasRequiredCjs$1;
2442
2446
 
2443
2447
  function requireCjs$1 () {
2444
- if (hasRequiredCjs$1) return cjs$1;
2448
+ if (hasRequiredCjs$1) return cjs$2;
2445
2449
  hasRequiredCjs$1 = 1;
2446
- var __importDefault = (cjs$1 && cjs$1.__importDefault) || function (mod) {
2450
+ var __importDefault = (cjs$2 && cjs$2.__importDefault) || function (mod) {
2447
2451
  return (mod && mod.__esModule) ? mod : { "default": mod };
2448
2452
  };
2449
- Object.defineProperty(cjs$1, "__esModule", { value: true });
2450
- cjs$1.default = StyleToObject;
2451
- var inline_style_parser_1 = __importDefault(requireInlineStyleParser());
2453
+ Object.defineProperty(cjs$2, "__esModule", { value: true });
2454
+ cjs$2.default = StyleToObject;
2455
+ const inline_style_parser_1 = __importDefault(requireCjs$2());
2452
2456
  /**
2453
2457
  * Parses inline style to object.
2454
2458
  *
@@ -2464,17 +2468,17 @@
2464
2468
  * ```
2465
2469
  */
2466
2470
  function StyleToObject(style, iterator) {
2467
- var styleObject = null;
2471
+ let styleObject = null;
2468
2472
  if (!style || typeof style !== 'string') {
2469
2473
  return styleObject;
2470
2474
  }
2471
- var declarations = (0, inline_style_parser_1.default)(style);
2472
- var hasIterator = typeof iterator === 'function';
2473
- declarations.forEach(function (declaration) {
2475
+ const declarations = (0, inline_style_parser_1.default)(style);
2476
+ const hasIterator = typeof iterator === 'function';
2477
+ declarations.forEach((declaration) => {
2474
2478
  if (declaration.type !== 'declaration') {
2475
2479
  return;
2476
2480
  }
2477
- var property = declaration.property, value = declaration.value;
2481
+ const { property, value } = declaration;
2478
2482
  if (hasIterator) {
2479
2483
  iterator(property, value, declaration);
2480
2484
  }
@@ -2486,7 +2490,7 @@
2486
2490
  return styleObject;
2487
2491
  }
2488
2492
 
2489
- return cjs$1;
2493
+ return cjs$2;
2490
2494
  }
2491
2495
 
2492
2496
  var utilities = {};