html-react-parser 0.8.0 → 0.9.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/CHANGELOG.md +59 -0
- package/README.md +56 -13
- package/dist/html-react-parser.js +1634 -269
- package/dist/html-react-parser.min.js +2 -2
- package/dist/html-react-parser.min.js.map +1 -1
- package/index.d.ts +10 -11
- package/index.js +7 -10
- package/lib/attributes-to-props.js +47 -42
- package/lib/dom-to-react.js +4 -4
- package/package.json +17 -11
- package/lib/property-config.js +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.9.2](https://github.com/remarkablemark/html-react-parser/compare/v0.9.1...v0.9.2) (2019-11-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* refactor TypeScript declaration file for `index.d.ts` ([f1fc00b](https://github.com/remarkablemark/html-react-parser/commit/f1fc00b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Build System
|
|
14
|
+
|
|
15
|
+
* **package:** remove `opencollective-postinstall` ([6e0b870](https://github.com/remarkablemark/html-react-parser/commit/6e0b870))
|
|
16
|
+
* **package:** upgrade dependency html-dom-parser@0.2.3 ([891eda4](https://github.com/remarkablemark/html-react-parser/commit/891eda4)), closes [#126](https://github.com/remarkablemark/html-react-parser/issues/126) [remarkablemark/html-dom-parser#18](https://github.com/remarkablemark/html-react-parser/issues/18)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### [0.9.1](https://github.com/remarkablemark/html-react-parser/compare/v0.9.0...v0.9.1) (2019-07-09)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Build System
|
|
24
|
+
|
|
25
|
+
* replace `webpack` with `rollup` in order to optimize bundle ([a04ef27](https://github.com/remarkablemark/html-react-parser/commit/a04ef27))
|
|
26
|
+
* **index:** fix rollup error of mixing named and default exports ([230de70](https://github.com/remarkablemark/html-react-parser/commit/230de70))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [0.9.0](https://github.com/remarkablemark/html-react-parser/compare/v0.8.1...v0.9.0) (2019-07-09)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* **attributes-to-props:** handle attr named after Object properties ([3f857bb](https://github.com/remarkablemark/html-react-parser/commit/3f857bb))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Build System
|
|
39
|
+
|
|
40
|
+
* **package:** update `react-property` to 1.0.1 ([26ebef9](https://github.com/remarkablemark/html-react-parser/commit/26ebef9))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
|
|
45
|
+
* **attributes-to-props:** check for overloaded boolean values ([1151cfb](https://github.com/remarkablemark/html-react-parser/commit/1151cfb))
|
|
46
|
+
* **attributes-to-props:** replace `react-dom` with `react-property` ([d6274b9](https://github.com/remarkablemark/html-react-parser/commit/d6274b9)), closes [#107](https://github.com/remarkablemark/html-react-parser/issues/107)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Tests
|
|
50
|
+
|
|
51
|
+
* **attributes-to-props:** improve test names ([17fbdfd](https://github.com/remarkablemark/html-react-parser/commit/17fbdfd))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### [0.8.1](https://github.com/remarkablemark/html-react-parser/compare/v0.8.0...v0.8.1) (2019-07-03)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Tests
|
|
59
|
+
|
|
60
|
+
* **html-to-react:** update variable name to fix test ([73237dd](https://github.com/remarkablemark/html-react-parser/commit/73237dd))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
5
64
|
## [0.8.0](https://github.com/remarkablemark/html-react-parser/compare/v0.7.1...v0.8.0) (2019-06-24)
|
|
6
65
|
|
|
7
66
|
|
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
[](https://coveralls.io/github/remarkablemark/html-react-parser?branch=master)
|
|
8
8
|
[](https://david-dm.org/remarkablemark/html-react-parser)
|
|
9
9
|
[](https://www.npmjs.com/package/html-react-parser)
|
|
10
|
+
[](https://opencollective.com/html-react-parser)
|
|
10
11
|
|
|
11
12
|
HTML to React parser that works on both the server (Node.js) and the client (browser):
|
|
12
13
|
|
|
@@ -159,15 +160,13 @@ const options = {
|
|
|
159
160
|
if (!attribs) return;
|
|
160
161
|
|
|
161
162
|
if (attribs.id === 'main') {
|
|
162
|
-
return (
|
|
163
|
-
<h1 style={{ fontSize: 42 }}>{domToReact(children, parserOptions)}</h1>
|
|
164
|
-
);
|
|
163
|
+
return <h1 style={{ fontSize: 42 }}>{domToReact(children, options)}</h1>;
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
if (attribs.class === 'prettify') {
|
|
168
167
|
return (
|
|
169
168
|
<span style={{ color: 'hotpink' }}>
|
|
170
|
-
{domToReact(children,
|
|
169
|
+
{domToReact(children, options)}
|
|
171
170
|
</span>
|
|
172
171
|
);
|
|
173
172
|
}
|
|
@@ -199,15 +198,19 @@ parse('<p><br id="remove"></p>', {
|
|
|
199
198
|
|
|
200
199
|
#### Is this library XSS safe?
|
|
201
200
|
|
|
202
|
-
No, this library
|
|
201
|
+
No, this library is **_not_** [XSS (Cross-Site Scripting)](https://wikipedia.org/wiki/Cross-site_scripting) safe. See [#94](https://github.com/remarkablemark/html-react-parser/issues/94).
|
|
202
|
+
|
|
203
|
+
#### Does this library sanitize invalid HTML?
|
|
204
|
+
|
|
205
|
+
No, this library does **_not_** perform HTML sanitization. See [#124](https://github.com/remarkablemark/html-react-parser/issues/124).
|
|
203
206
|
|
|
204
207
|
#### Are `<script>` tags parsed?
|
|
205
208
|
|
|
206
|
-
|
|
209
|
+
Although `<script>` tags and their contents are rendered on the server-side, they're not evaluated on the client-side. See [#98](https://github.com/remarkablemark/html-react-parser/issues/98).
|
|
207
210
|
|
|
208
|
-
####
|
|
211
|
+
#### Why aren't my HTML attributes getting called?
|
|
209
212
|
|
|
210
|
-
|
|
213
|
+
This is because [inline event handlers](https://developer.mozilla.org/docs/Web/Guide/Events/Event_handlers) (e.g., `onclick`) are parsed as a _string_ instead of a _function_. See [#73](https://github.com/remarkablemark/html-react-parser/issues/73).
|
|
211
214
|
|
|
212
215
|
## Testing
|
|
213
216
|
|
|
@@ -223,10 +226,18 @@ Run tests with coverage:
|
|
|
223
226
|
$ npm run test:coverage
|
|
224
227
|
```
|
|
225
228
|
|
|
229
|
+
View coverage in browser:
|
|
230
|
+
|
|
231
|
+
```sh
|
|
232
|
+
$ npm run test:coverage:report
|
|
233
|
+
$ open coverage/index.html
|
|
234
|
+
```
|
|
235
|
+
|
|
226
236
|
Lint files:
|
|
227
237
|
|
|
228
238
|
```sh
|
|
229
239
|
$ npm run lint
|
|
240
|
+
$ npm run dtslint
|
|
230
241
|
```
|
|
231
242
|
|
|
232
243
|
Fix lint errors:
|
|
@@ -258,12 +269,44 @@ $ npm run release
|
|
|
258
269
|
$ git push --follow-tags && npm publish
|
|
259
270
|
```
|
|
260
271
|
|
|
261
|
-
##
|
|
272
|
+
## Contributors
|
|
273
|
+
|
|
274
|
+
### Code Contributors
|
|
275
|
+
|
|
276
|
+
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
|
277
|
+
<a href="https://github.com/remarkablemark/html-react-parser/graphs/contributors"><img src="https://opencollective.com/html-react-parser/contributors.svg?width=890&button=false" /></a>
|
|
278
|
+
|
|
279
|
+
### Financial Contributors
|
|
280
|
+
|
|
281
|
+
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/html-react-parser/contribute)]
|
|
282
|
+
|
|
283
|
+
#### Individuals
|
|
284
|
+
|
|
285
|
+
<a href="https://opencollective.com/html-react-parser"><img src="https://opencollective.com/html-react-parser/individuals.svg?width=890"></a>
|
|
286
|
+
|
|
287
|
+
#### Organizations
|
|
288
|
+
|
|
289
|
+
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/html-react-parser/contribute)]
|
|
290
|
+
|
|
291
|
+
<a href="https://opencollective.com/html-react-parser/organization/0/website"><img src="https://opencollective.com/html-react-parser/organization/0/avatar.svg"></a>
|
|
292
|
+
<a href="https://opencollective.com/html-react-parser/organization/1/website"><img src="https://opencollective.com/html-react-parser/organization/1/avatar.svg"></a>
|
|
293
|
+
<a href="https://opencollective.com/html-react-parser/organization/2/website"><img src="https://opencollective.com/html-react-parser/organization/2/avatar.svg"></a>
|
|
294
|
+
<a href="https://opencollective.com/html-react-parser/organization/3/website"><img src="https://opencollective.com/html-react-parser/organization/3/avatar.svg"></a>
|
|
295
|
+
<a href="https://opencollective.com/html-react-parser/organization/4/website"><img src="https://opencollective.com/html-react-parser/organization/4/avatar.svg"></a>
|
|
296
|
+
<a href="https://opencollective.com/html-react-parser/organization/5/website"><img src="https://opencollective.com/html-react-parser/organization/5/avatar.svg"></a>
|
|
297
|
+
<a href="https://opencollective.com/html-react-parser/organization/6/website"><img src="https://opencollective.com/html-react-parser/organization/6/avatar.svg"></a>
|
|
298
|
+
<a href="https://opencollective.com/html-react-parser/organization/7/website"><img src="https://opencollective.com/html-react-parser/organization/7/avatar.svg"></a>
|
|
299
|
+
<a href="https://opencollective.com/html-react-parser/organization/8/website"><img src="https://opencollective.com/html-react-parser/organization/8/avatar.svg"></a>
|
|
300
|
+
<a href="https://opencollective.com/html-react-parser/organization/9/website"><img src="https://opencollective.com/html-react-parser/organization/9/avatar.svg"></a>
|
|
301
|
+
|
|
302
|
+
## Support
|
|
262
303
|
|
|
263
|
-
- [
|
|
264
|
-
- [
|
|
265
|
-
- [
|
|
266
|
-
- [
|
|
304
|
+
- [Patreon](https://b.remarkabl.org/patreon)
|
|
305
|
+
- [Open Collective](https://b.remarkabl.org/open-collective-html-react-parser)
|
|
306
|
+
- [Ko-fi](https://b.remarkabl.org/ko-fi)
|
|
307
|
+
- [Tidelift](https://b.remarkabl.org/tidelift-html-react-parser)
|
|
308
|
+
- [Liberapay](https://b.remarkabl.org/liberapay)
|
|
309
|
+
- [Teepsring](https://b.remarkabl.org/teespring)
|
|
267
310
|
|
|
268
311
|
## License
|
|
269
312
|
|