html-react-parser 5.1.9 → 5.1.11
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 +3 -3
- package/dist/html-react-parser.js +6 -6
- 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/lib/attributes-to-props.js +1 -1
- package/lib/attributes-to-props.js.map +1 -1
- package/lib/dom-to-react.js +1 -1
- package/lib/dom-to-react.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utilities.js +3 -3
- package/lib/utilities.js.map +1 -1
- package/package.json +21 -21
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://github.com/remarkablemark/html-react-parser/actions?query=workflow%3Abuild)
|
|
8
8
|
[](https://codecov.io/gh/remarkablemark/html-react-parser)
|
|
9
9
|
[](https://www.npmjs.com/package/html-react-parser)
|
|
10
|
-
[](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
|
-
|
|
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
|
|
|
@@ -2460,7 +2460,9 @@
|
|
|
2460
2460
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2461
2461
|
};
|
|
2462
2462
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2463
|
-
exports.returnFirstArg = exports.canTextBeChildOfNode = exports.ELEMENTS_WITH_NO_TEXT_CHILDREN = exports.PRESERVE_CUSTOM_ATTRIBUTES =
|
|
2463
|
+
exports.returnFirstArg = exports.canTextBeChildOfNode = exports.ELEMENTS_WITH_NO_TEXT_CHILDREN = exports.PRESERVE_CUSTOM_ATTRIBUTES = void 0;
|
|
2464
|
+
exports.isCustomComponent = isCustomComponent;
|
|
2465
|
+
exports.setStyleProp = setStyleProp;
|
|
2464
2466
|
var react_1 = require$$0;
|
|
2465
2467
|
var style_to_js_1 = __importDefault(cjs);
|
|
2466
2468
|
var RESERVED_SVG_MATHML_ELEMENTS = new Set([
|
|
@@ -2495,7 +2497,6 @@
|
|
|
2495
2497
|
}
|
|
2496
2498
|
return true;
|
|
2497
2499
|
}
|
|
2498
|
-
exports.isCustomComponent = isCustomComponent;
|
|
2499
2500
|
var styleOptions = {
|
|
2500
2501
|
reactCompat: true,
|
|
2501
2502
|
};
|
|
@@ -2520,7 +2521,6 @@
|
|
|
2520
2521
|
props.style = {};
|
|
2521
2522
|
}
|
|
2522
2523
|
}
|
|
2523
|
-
exports.setStyleProp = setStyleProp;
|
|
2524
2524
|
/**
|
|
2525
2525
|
* @see https://reactjs.org/blog/2017/09/08/dom-attributes-in-react-16.html
|
|
2526
2526
|
*/
|
|
@@ -2561,6 +2561,7 @@
|
|
|
2561
2561
|
} (utilities$1));
|
|
2562
2562
|
|
|
2563
2563
|
Object.defineProperty(attributesToProps$1, "__esModule", { value: true });
|
|
2564
|
+
attributesToProps$1.default = attributesToProps;
|
|
2564
2565
|
var react_property_1 = lib;
|
|
2565
2566
|
var utilities_1$1 = utilities$1;
|
|
2566
2567
|
// https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components
|
|
@@ -2622,7 +2623,6 @@
|
|
|
2622
2623
|
(0, utilities_1$1.setStyleProp)(attributes.style, props);
|
|
2623
2624
|
return props;
|
|
2624
2625
|
}
|
|
2625
|
-
attributesToProps$1.default = attributesToProps;
|
|
2626
2626
|
/**
|
|
2627
2627
|
* Gets prop name from lowercased attribute name.
|
|
2628
2628
|
*
|
|
@@ -2639,6 +2639,7 @@
|
|
|
2639
2639
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2640
2640
|
};
|
|
2641
2641
|
Object.defineProperty(domToReact$1, "__esModule", { value: true });
|
|
2642
|
+
domToReact$1.default = domToReact;
|
|
2642
2643
|
var react_1 = require$$0;
|
|
2643
2644
|
var attributes_to_props_1 = __importDefault(attributesToProps$1);
|
|
2644
2645
|
var utilities_1 = utilities$1;
|
|
@@ -2742,7 +2743,6 @@
|
|
|
2742
2743
|
}
|
|
2743
2744
|
return reactElements.length === 1 ? reactElements[0] : reactElements;
|
|
2744
2745
|
}
|
|
2745
|
-
domToReact$1.default = domToReact;
|
|
2746
2746
|
/**
|
|
2747
2747
|
* Determines whether DOM element attributes should be transformed to props.
|
|
2748
2748
|
* Web Components should not have their attributes transformed except for `style`.
|
|
@@ -2762,6 +2762,7 @@
|
|
|
2762
2762
|
};
|
|
2763
2763
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2764
2764
|
exports.htmlToDOM = exports.domToReact = exports.attributesToProps = exports.Text = exports.ProcessingInstruction = exports.Element = exports.Comment = void 0;
|
|
2765
|
+
exports.default = HTMLReactParser;
|
|
2765
2766
|
var html_dom_parser_1 = __importDefault(htmlToDom);
|
|
2766
2767
|
exports.htmlToDOM = html_dom_parser_1.default;
|
|
2767
2768
|
var attributes_to_props_1 = __importDefault(attributesToProps$1);
|
|
@@ -2790,7 +2791,6 @@
|
|
|
2790
2791
|
}
|
|
2791
2792
|
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
2793
|
}
|
|
2793
|
-
exports.default = HTMLReactParser;
|
|
2794
2794
|
|
|
2795
2795
|
} (lib$3));
|
|
2796
2796
|
|