html-react-parser 1.2.9 → 1.4.2
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 +5 -7
- package/dist/html-react-parser.js +864 -623
- 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/index.js +1 -0
- package/index.mjs +1 -0
- package/lib/attributes-to-props.js +22 -30
- package/package.json +22 -23
- package/CHANGELOG.md +0 -539
package/README.md
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/html-react-parser)
|
|
6
6
|
[](https://github.com/remarkablemark/html-react-parser/actions?query=workflow%3Abuild)
|
|
7
|
-
[](https://david-dm.org/remarkablemark/html-react-parser)
|
|
7
|
+
[](https://codecov.io/gh/remarkablemark/html-react-parser)
|
|
9
8
|
[](https://www.npmjs.com/package/html-react-parser)
|
|
10
9
|
[](https://discord.gg/njExwXdrRJ)
|
|
11
10
|
|
|
@@ -188,8 +187,7 @@ parse('<p id="replace">text</p>', {
|
|
|
188
187
|
For TypeScript projects, you may need to check that `domNode` is an instance of domhandler's `Element`:
|
|
189
188
|
|
|
190
189
|
```tsx
|
|
191
|
-
import { HTMLReactParserOptions } from 'html-react-parser';
|
|
192
|
-
import { Element } from 'domhandler/lib/node';
|
|
190
|
+
import { HTMLReactParserOptions, Element } from 'html-react-parser';
|
|
193
191
|
|
|
194
192
|
const options: HTMLReactParserOptions = {
|
|
195
193
|
replace: domNode => {
|
|
@@ -200,7 +198,7 @@ const options: HTMLReactParserOptions = {
|
|
|
200
198
|
};
|
|
201
199
|
```
|
|
202
200
|
|
|
203
|
-
If you're having issues
|
|
201
|
+
If you're having issues take a look at our [Create React App example](./examples/create-react-app-typescript/src/App.tsx).
|
|
204
202
|
|
|
205
203
|
#### replace element and children
|
|
206
204
|
|
|
@@ -477,8 +475,8 @@ Then update your Webpack config to:
|
|
|
477
475
|
module.exports = {
|
|
478
476
|
// ...
|
|
479
477
|
resolve: {
|
|
480
|
-
mainFields: ['browser', 'main', 'module']
|
|
481
|
-
}
|
|
478
|
+
mainFields: ['browser', 'main', 'module']
|
|
479
|
+
}
|
|
482
480
|
};
|
|
483
481
|
```
|
|
484
482
|
|