Skip to content

Commit 0473e83

Browse files
committed
feat: export domhandler's Element
1 parent bcf3d57 commit 0473e83

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ parse('<p id="replace">text</p>', {
188188
For TypeScript projects, you may need to check that `domNode` is an instance of domhandler's `Element`:
189189

190190
```tsx
191-
import { HTMLReactParserOptions } from 'html-react-parser';
192-
import { Element } from 'domhandler/lib/node';
191+
import { HTMLReactParserOptions, Element } from 'html-react-parser';
193192

194193
const options: HTMLReactParserOptions = {
195194
replace: domNode => {

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var domToReact = require('./lib/dom-to-react');
22
var attributesToProps = require('./lib/attributes-to-props');
33
var htmlToDOM = require('html-dom-parser');
4+
var { Element } = require('domhandler/lib/node');
45

56
var domParserOptions = { lowerCaseAttributeNames: false };
67

@@ -31,6 +32,7 @@ function HTMLReactParser(html, options) {
3132
HTMLReactParser.domToReact = domToReact;
3233
HTMLReactParser.htmlToDOM = htmlToDOM;
3334
HTMLReactParser.attributesToProps = attributesToProps;
35+
HTMLReactParser.Element = Element;
3436

3537
// support CommonJS and ES Modules
3638
module.exports = HTMLReactParser;

index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import HTMLReactParser from './index.js';
33
export var domToReact = HTMLReactParser.domToReact;
44
export var htmlToDOM = HTMLReactParser.htmlToDOM;
55
export var attributesToProps = HTMLReactParser.attributesToProps;
6+
export var Element = HTMLReactParser.Element;
67

78
export default HTMLReactParser;

0 commit comments

Comments
 (0)