Skip to content

Commit bbd8cf6

Browse files
docs(readme): tidy README and improve headings and wording
1 parent 24c969a commit bbd8cf6

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ HTMLReactParser(string[, options])
1717

1818
It converts an HTML string to one or more [React elements](https://reactjs.org/docs/react-api.html#creating-react-elements). There's also an option to [replace an element](#replacedomnode) with your own.
1919

20-
#### Example:
20+
Example:
2121

2222
```js
23-
var parse = require('html-react-parser');
23+
const parse = require('html-react-parser');
2424
parse('<div>text</div>'); // equivalent to `React.createElement('div', {}, 'text')`
2525
```
2626

27-
[CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [Repl.it](https://repl.it/@remarkablemark/html-react-parser) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples)
27+
[CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [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)
2828

29-
## Installation
29+
## Install
3030

3131
[NPM](https://www.npmjs.com/package/html-react-parser):
3232

@@ -53,7 +53,7 @@ $ yarn add html-react-parser
5353

5454
## Usage
5555

56-
Import the module:
56+
Import or require the module:
5757

5858
```js
5959
// ES Modules
@@ -296,47 +296,47 @@ parse('<p> </p>', { trim: true }); // React.createElement('p')
296296

297297
## FAQ
298298

299-
#### Is this library XSS safe?
299+
#### Is this XSS safe?
300300

301301
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).
302302

303-
#### Does this library sanitize invalid HTML?
303+
#### Does invalid HTML get sanitized?
304304

305-
No, this library does _**not**_ perform HTML sanitization. See [#124](https://github.com/remarkablemark/html-react-parser/issues/124), [#125](https://github.com/remarkablemark/html-react-parser/issues/125), and [#141](https://github.com/remarkablemark/html-react-parser/issues/141).
305+
No, this library does _**not**_ sanitize HTML. See [#124](https://github.com/remarkablemark/html-react-parser/issues/124), [#125](https://github.com/remarkablemark/html-react-parser/issues/125), and [#141](https://github.com/remarkablemark/html-react-parser/issues/141).
306306

307307
#### Are `<script>` tags parsed?
308308

309309
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).
310310

311-
#### Why aren't my HTML attributes getting called?
311+
#### Attributes aren't getting called
312312

313-
This is because [inline event handlers](https://developer.mozilla.org/docs/Web/Guide/Events/Event_handlers) like `onclick` are parsed as a _string_ instead of a _function_. See [#73](https://github.com/remarkablemark/html-react-parser/issues/73).
313+
The reason why your HTML attributes aren't getting called is because [inline event handlers](https://developer.mozilla.org/docs/Web/Guide/Events/Event_handlers) (e.g., `onclick`) are parsed as a _string_ rather than a _function_. See [#73](https://github.com/remarkablemark/html-react-parser/issues/73).
314314

315-
#### The parser throws an error.
315+
#### Parser throws an error
316316

317-
Check if your arguments are valid. Also, see ["Does this library sanitize invalid HTML?"](https://github.com/remarkablemark/html-react-parser#does-this-library-sanitize-invalid-html).
317+
If the parser throws an erorr, check if your arguments are valid. See ["Does invalid HTML get sanitized?"](#does-invalid-html-get-sanitized).
318318

319-
#### Does this library support SSR?
319+
#### Is SSR supported?
320320

321-
Yes, this library supports server-side rendering on Node.js. See [demo](https://repl.it/@remarkablemark/html-react-parser-SSR).
321+
Yes, server-side rendering on Node.js is supported by this library. See [demo](https://repl.it/@remarkablemark/html-react-parser-SSR).
322322

323-
#### Why are my elements nested incorrectly?
323+
#### Elements aren't nested correctly
324324

325-
Make sure your [HTML markup is valid](https://validator.w3.org/). The HTML to DOM parsing will be affected if you're using self-closing syntax (`/>`) on non-void elements:
325+
If your elements are nested incorrectly, check to make sure your [HTML markup is valid](https://validator.w3.org/). The HTML to DOM parsing will be affected if you're using self-closing syntax (`/>`) on non-void elements:
326326

327327
```js
328328
parse('<div /><div />'); // returns single element instead of array of elements
329329
```
330330

331331
See [#158](https://github.com/remarkablemark/html-react-parser/issues/158).
332332

333-
#### I get "Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table."
333+
#### Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table
334334

335-
Enable the [trim](https://github.com/remarkablemark/html-react-parser#trim) option. See [#155](https://github.com/remarkablemark/html-react-parser/issues/155).
335+
Enable the [trim](#trim) option. See [#155](https://github.com/remarkablemark/html-react-parser/issues/155).
336336

337-
#### Don't change case of tags.
337+
#### Don't change case of tags
338338

339-
Tags are lowercased by default. To prevent that from happening, pass the [htmlparser2 option](https://github.com/remarkablemark/html-react-parser#htmlparser2):
339+
Tags are lowercased by default. To prevent that from happening, pass the [htmlparser2 option](#htmlparser2):
340340

341341
```js
342342
const options = {
@@ -403,10 +403,10 @@ Support this project with your organization. Your logo will show up here with a
403403
## Support
404404

405405
- [GitHub Sponsors](https://b.remarkabl.org/github-sponsors)
406-
- [Patreon](https://b.remarkabl.org/patreon)
407406
- [Open Collective](https://b.remarkabl.org/open-collective-html-react-parser)
408-
- [Ko-fi](https://b.remarkabl.org/ko-fi)
409407
- [Tidelift](https://b.remarkabl.org/tidelift-html-react-parser)
408+
- [Patreon](https://b.remarkabl.org/patreon)
409+
- [Ko-fi](https://b.remarkabl.org/ko-fi)
410410
- [Liberapay](https://b.remarkabl.org/liberapay)
411411
- [Teepsring](https://b.remarkabl.org/teespring)
412412

0 commit comments

Comments
 (0)