html-react-parser 3.0.15 → 4.0.0
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 +20 -20
- package/dist/html-react-parser.js +14 -10
- package/dist/html-react-parser.js.map +1 -1
- package/dist/html-react-parser.min.js +1 -1
- package/dist/html-react-parser.min.js.map +1 -1
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -42,9 +42,10 @@ parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')
|
|
|
42
42
|
- [htmlparser2](#htmlparser2)
|
|
43
43
|
- [trim](#trim)
|
|
44
44
|
- [Migration](#migration)
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
45
|
+
- [v4](#v4)
|
|
46
|
+
- [v3](#v3)
|
|
47
|
+
- [v2](#v2)
|
|
48
|
+
- [v1](#v1)
|
|
48
49
|
- [FAQ](#faq)
|
|
49
50
|
- [Is this XSS safe?](#is-this-xss-safe)
|
|
50
51
|
- [Does invalid HTML get sanitized?](#does-invalid-html-get-sanitized)
|
|
@@ -64,7 +65,6 @@ parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')
|
|
|
64
65
|
- [Financial Contributors](#financial-contributors)
|
|
65
66
|
- [Individuals](#individuals)
|
|
66
67
|
- [Organizations](#organizations)
|
|
67
|
-
- [Enterprise](#enterprise)
|
|
68
68
|
- [Support](#support)
|
|
69
69
|
- [License](#license)
|
|
70
70
|
|
|
@@ -97,13 +97,15 @@ yarn add html-react-parser
|
|
|
97
97
|
|
|
98
98
|
## Usage
|
|
99
99
|
|
|
100
|
-
Import
|
|
100
|
+
Import ES module:
|
|
101
101
|
|
|
102
102
|
```js
|
|
103
|
-
// ES Modules
|
|
104
103
|
import parse from 'html-react-parser';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Or require CommonJS module:
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
```js
|
|
107
109
|
const parse = require('html-react-parser');
|
|
108
110
|
```
|
|
109
111
|
|
|
@@ -375,17 +377,21 @@ parse('<p> </p>', { trim: true }); // React.createElement('p')
|
|
|
375
377
|
|
|
376
378
|
## Migration
|
|
377
379
|
|
|
378
|
-
###
|
|
380
|
+
### v4
|
|
381
|
+
|
|
382
|
+
[htmlparser2](https://github.com/fb55/htmlparser2) has been upgraded to [v9](https://github.com/fb55/htmlparser2/releases/tag/v9.0.0).
|
|
383
|
+
|
|
384
|
+
### v3
|
|
379
385
|
|
|
380
386
|
[domhandler](https://github.com/fb55/domhandler) has been upgraded to v5 so some [parser options](https://github.com/fb55/htmlparser2/wiki/Parser-options) like `normalizeWhitespace` have been removed.
|
|
381
387
|
|
|
382
|
-
Also, it's recommended to upgrade to the latest version of [
|
|
388
|
+
Also, it's recommended to upgrade to the latest version of [TypeScript](https://www.npmjs.com/package/typescript).
|
|
383
389
|
|
|
384
|
-
### v2
|
|
390
|
+
### v2
|
|
385
391
|
|
|
386
392
|
Since [v2.0.0](https://github.com/remarkablemark/html-react-parser/releases/tag/v2.0.0), Internet Explorer (IE) is no longer supported.
|
|
387
393
|
|
|
388
|
-
### v1
|
|
394
|
+
### v1
|
|
389
395
|
|
|
390
396
|
TypeScript projects will need to update the types in [v1.0.0](https://github.com/remarkablemark/html-react-parser/releases/tag/v1.0.0).
|
|
391
397
|
|
|
@@ -425,7 +431,7 @@ The reason why your HTML attributes aren't getting called is because [inline eve
|
|
|
425
431
|
|
|
426
432
|
### Parser throws an error
|
|
427
433
|
|
|
428
|
-
If the parser throws an
|
|
434
|
+
If the parser throws an error, check if your arguments are valid. See ["Does invalid HTML get sanitized?"](#does-invalid-html-get-sanitized).
|
|
429
435
|
|
|
430
436
|
### Is SSR supported?
|
|
431
437
|
|
|
@@ -464,7 +470,7 @@ See [#62](https://github.com/remarkablemark/html-react-parser/issues/62) and [ex
|
|
|
464
470
|
|
|
465
471
|
### TS Error: Property 'attribs' does not exist on type 'DOMNode'
|
|
466
472
|
|
|
467
|
-
The TypeScript error occurs because `DOMNode` needs be an instance of domhandler's `Element`. See [migration](#migration) or [#199](https://github.com/remarkablemark/html-react-parser/issues/199).
|
|
473
|
+
The TypeScript error occurs because `DOMNode` needs to be an instance of domhandler's `Element`. See [migration](#migration) or [#199](https://github.com/remarkablemark/html-react-parser/issues/199).
|
|
468
474
|
|
|
469
475
|
### Can I enable `trim` for certain elements?
|
|
470
476
|
|
|
@@ -558,12 +564,6 @@ Support this project with your organization. Your logo will show up here with a
|
|
|
558
564
|
[](https://opencollective.com/html-react-parser/organization/8/website)
|
|
559
565
|
[](https://opencollective.com/html-react-parser/organization/9/website)
|
|
560
566
|
|
|
561
|
-
## Enterprise
|
|
562
|
-
|
|
563
|
-
Available as part of the Tidelift Subscription.
|
|
564
|
-
|
|
565
|
-
The maintainers of html-react-parser and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-html-react-parser?utm_source=npm-html-react-parser&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
|
566
|
-
|
|
567
567
|
## Support
|
|
568
568
|
|
|
569
569
|
- [GitHub Sponsors](https://b.remarkabl.org/github-sponsors)
|
|
@@ -572,7 +572,7 @@ The maintainers of html-react-parser and thousands of other packages are working
|
|
|
572
572
|
- [Patreon](https://b.remarkabl.org/patreon)
|
|
573
573
|
- [Ko-fi](https://b.remarkabl.org/ko-fi)
|
|
574
574
|
- [Liberapay](https://b.remarkabl.org/liberapay)
|
|
575
|
-
- [
|
|
575
|
+
- [Teespring](https://b.remarkabl.org/teespring)
|
|
576
576
|
|
|
577
577
|
## License
|
|
578
578
|
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
12
12
|
|
|
13
|
+
function getDefaultExportFromCjs (x) {
|
|
14
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
var lib$2 = {};
|
|
14
18
|
|
|
15
19
|
var lib$1 = {};
|
|
@@ -68,7 +72,7 @@
|
|
|
68
72
|
/** Type for <![CDATA[ ... ]]> */
|
|
69
73
|
exports.CDATA = ElementType.CDATA;
|
|
70
74
|
/** Type for <!doctype ...> */
|
|
71
|
-
exports.Doctype = ElementType.Doctype;
|
|
75
|
+
exports.Doctype = ElementType.Doctype;
|
|
72
76
|
} (lib$1));
|
|
73
77
|
|
|
74
78
|
var node = {};
|
|
@@ -711,7 +715,7 @@
|
|
|
711
715
|
return DomHandler;
|
|
712
716
|
}());
|
|
713
717
|
exports.DomHandler = DomHandler;
|
|
714
|
-
exports.default = DomHandler;
|
|
718
|
+
exports.default = DomHandler;
|
|
715
719
|
} (lib$2));
|
|
716
720
|
|
|
717
721
|
// constants
|
|
@@ -1910,11 +1914,7 @@
|
|
|
1910
1914
|
|
|
1911
1915
|
var cjs = {};
|
|
1912
1916
|
|
|
1913
|
-
var
|
|
1914
|
-
var styleToObject = {
|
|
1915
|
-
get exports(){ return styleToObjectExports; },
|
|
1916
|
-
set exports(v){ styleToObjectExports = v; },
|
|
1917
|
-
};
|
|
1917
|
+
var styleToObject = {exports: {}};
|
|
1918
1918
|
|
|
1919
1919
|
// http://www.w3.org/TR/CSS21/grammar.html
|
|
1920
1920
|
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
|
|
@@ -2216,7 +2216,9 @@
|
|
|
2216
2216
|
}
|
|
2217
2217
|
|
|
2218
2218
|
styleToObject.exports = StyleToObject;
|
|
2219
|
-
|
|
2219
|
+
styleToObject.exports.default = StyleToObject; // ESM support
|
|
2220
|
+
|
|
2221
|
+
var styleToObjectExports = styleToObject.exports;
|
|
2220
2222
|
|
|
2221
2223
|
var utilities$3 = {};
|
|
2222
2224
|
|
|
@@ -2271,7 +2273,7 @@
|
|
|
2271
2273
|
});
|
|
2272
2274
|
return output;
|
|
2273
2275
|
}
|
|
2274
|
-
exports["default"] = StyleToJS;
|
|
2276
|
+
exports["default"] = StyleToJS;
|
|
2275
2277
|
} (cjs));
|
|
2276
2278
|
|
|
2277
2279
|
var React$1 = require$$0__default["default"];
|
|
@@ -2689,7 +2691,9 @@
|
|
|
2689
2691
|
var htmlReactParser = HTMLReactParser;
|
|
2690
2692
|
HTMLReactParser.default = HTMLReactParser;
|
|
2691
2693
|
|
|
2692
|
-
|
|
2694
|
+
var index = /*@__PURE__*/getDefaultExportFromCjs(htmlReactParser);
|
|
2695
|
+
|
|
2696
|
+
return index;
|
|
2693
2697
|
|
|
2694
2698
|
}));
|
|
2695
2699
|
//# sourceMappingURL=html-react-parser.js.map
|