html-react-parser
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.1.2](https://github.com/remarkablemark/html-react-parser/compare/v1.1.1...v1.1.2) (2021-01-12) | ||
### Bug Fixes | ||
* **index:** include domhandler `Node` in `DOMNode` type ([ac4aff3](https://github.com/remarkablemark/html-react-parser/commit/ac4aff3e094254d985124759c590d14eaa506168)), closes [#207](https://github.com/remarkablemark/html-react-parser/issues/207) | ||
### [1.1.1](https://github.com/remarkablemark/html-react-parser/compare/v1.1.0...v1.1.1) (2020-12-27) | ||
@@ -7,0 +14,0 @@ |
@@ -8,2 +8,3 @@ // TypeScript Version: 4.1 | ||
Element, | ||
Node, | ||
ProcessingInstruction, | ||
@@ -19,4 +20,4 @@ Text | ||
export type HTMLParser2Options = ParserOptions & DomHandlerOptions; | ||
export { Comment, Element, ProcessingInstruction, Text }; | ||
export type DOMNode = Comment | Element | ProcessingInstruction | Text; | ||
export { Comment, Element, Node, ProcessingInstruction, Text }; | ||
export type DOMNode = Comment | Element | Node | ProcessingInstruction | Text; | ||
@@ -23,0 +24,0 @@ export interface HTMLReactParserOptions { |
{ | ||
"name": "html-react-parser", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "HTML to React parser.", | ||
@@ -5,0 +5,0 @@ "author": "Mark <mark@remarkablemark.org>", |
@@ -10,3 +10,3 @@ # html-react-parser | ||
[](https://www.npmjs.com/package/html-react-parser) | ||
[](https://opencollective.com/html-react-parser) | ||
[](https://discord.gg/njExwXdrRJ) | ||
@@ -21,3 +21,3 @@ HTML to React parser that works on both the server (Node.js) and the client (browser): | ||
To replace an element with a custom element, check out the [replace option](#replacedomnode). | ||
To replace an element with another element, check out the [`replace`](#replace) option. | ||
@@ -31,3 +31,3 @@ #### Example | ||
[CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [CodeSandbox (TypeScript)](https://codesandbox.io/s/html-react-parser-z0kp6) | [Repl.it](https://repl.it/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples) | ||
[Repl.it](https://repl.it/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [TypeScript](https://codesandbox.io/s/html-react-parser-z0kp6) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples) | ||
@@ -39,3 +39,3 @@ <details> | ||
- [Usage](#usage) | ||
- [replace(domNode)](#replacedomnode) | ||
- [replace](#replace) | ||
- [library](#library) | ||
@@ -57,2 +57,3 @@ - [htmlparser2](#htmlparser2) | ||
- [TS Error: Property 'attribs' does not exist on type 'DOMNode'](#ts-error-property-attribs-does-not-exist-on-type-domnode) | ||
- [Can I enable `trim` for certain elements?](#can-i-enable-trim-for-certain-elements) | ||
- [Performance](#performance) | ||
@@ -143,7 +144,7 @@ - [Contributors](#contributors) | ||
### replace(domNode) | ||
### replace | ||
The `replace` option allows you to replace an element with another React element. | ||
The `replace` option allows you to replace an element with another element. | ||
The `replace` callback's 1st argument is a [domhandler](https://github.com/fb55/domhandler#example) node: | ||
The `replace` callback's first argument is [domhandler](https://github.com/fb55/domhandler#example)'s node: | ||
@@ -162,2 +163,3 @@ ```js | ||
Element { | ||
type: 'tag', | ||
parent: null, | ||
@@ -392,2 +394,4 @@ prev: null, | ||
Since [v1.1.1](https://github.com/remarkablemark/html-react-parser/releases/tag/v1.1.1), Internet Explorer 9 (IE9) is no longer supported. | ||
## FAQ | ||
@@ -458,2 +462,6 @@ | ||
### Can I enable `trim` for certain elements? | ||
Yes, you can enable or disable [`trim`](#trim) for certain elements using the [`replace`](#replace) option. See [#205](https://github.com/remarkablemark/html-react-parser/issues/205). | ||
## Performance | ||
@@ -460,0 +468,0 @@ |
318324
2289
524