Skip to content

Commit d83bf94

Browse files
docs(readme): improve headings and update "Table of Contents"
1 parent 21b45a4 commit d83bf94

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')
3333

3434
- [Install](#install)
3535
- [Usage](#usage)
36-
- [Options](#options)
37-
- [replace(domNode)](#replacedomnode)
36+
- [replace(domNode)](#replacedomnode)
3837
- [library](#library)
3938
- [htmlparser2](#htmlparser2)
4039
- [trim](#trim)
40+
- [Migration](#migration)
41+
- [v1.0.0](#v100)
4142
- [FAQ](#faq)
4243
- [Is this XSS safe?](#is-this-xss-safe)
4344
- [Does invalid HTML get sanitized?](#does-invalid-html-get-sanitized)
@@ -48,6 +49,7 @@ parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')
4849
- [Elements aren't nested correctly](#elements-arent-nested-correctly)
4950
- [Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table](#warning-validatedomnesting-whitespace-text-nodes-cannot-appear-as-a-child-of-table)
5051
- [Don't change case of tags](#dont-change-case-of-tags)
52+
- [TS Error: Property 'attribs' does not exist on type 'DOMNode'](#ts-error-property-attribs-does-not-exist-on-type-domnode)
5153
- [Performance](#performance)
5254
- [Contributors](#contributors)
5355
- [Code Contributors](#code-contributors)
@@ -133,9 +135,7 @@ parse(
133135
);
134136
```
135137

136-
### Options
137-
138-
#### replace(domNode)
138+
### replace(domNode)
139139

140140
The `replace` option allows you to replace an element with another React element.
141141

@@ -365,7 +365,7 @@ parse('<p> </p>', { trim: true }); // React.createElement('p')
365365

366366
## Migration
367367

368-
### 1.0.0
368+
### v1.0.0
369369

370370
TypeScript projects will need to check the types in [v1.0.0](https://github.com/remarkablemark/html-react-parser/releases/tag/v1.0.0).
371371

@@ -385,31 +385,31 @@ parse('<br class="remove">', {
385385

386386
## FAQ
387387

388-
#### Is this XSS safe?
388+
### Is this XSS safe?
389389

390390
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).
391391

392-
#### Does invalid HTML get sanitized?
392+
### Does invalid HTML get sanitized?
393393

394394
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).
395395

396-
#### Are `<script>` tags parsed?
396+
### Are `<script>` tags parsed?
397397

398398
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).
399399

400-
#### Attributes aren't getting called
400+
### Attributes aren't getting called
401401

402402
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).
403403

404-
#### Parser throws an error
404+
### Parser throws an error
405405

406406
If the parser throws an erorr, check if your arguments are valid. See ["Does invalid HTML get sanitized?"](#does-invalid-html-get-sanitized).
407407

408-
#### Is SSR supported?
408+
### Is SSR supported?
409409

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

412-
#### Elements aren't nested correctly
412+
### Elements aren't nested correctly
413413

414414
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:
415415

@@ -419,11 +419,11 @@ parse('<div /><div />'); // returns single element instead of array of elements
419419

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

422-
#### Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table
422+
### Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table
423423

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

426-
#### Don't change case of tags
426+
### Don't change case of tags
427427

428428
Tags are lowercased by default. To prevent that from happening, pass the [htmlparser2 option](#htmlparser2):
429429

@@ -444,7 +444,7 @@ parse('<CustomElement>', options); // React.createElement('CustomElement')
444444
445445
See [#62](https://github.com/remarkablemark/html-react-parser/issues/62) and [example](https://repl.it/@remarkablemark/html-react-parser-62).
446446
447-
#### TS Error: Property 'attribs' does not exist on type 'DOMNode'
447+
### TS Error: Property 'attribs' does not exist on type 'DOMNode'
448448
449449
The TypeScript error happens because `DOMNode` needs be an instance of domhandler's `Element`. See [migration](#migration) or [#199](https://github.com/remarkablemark/html-react-parser/issues/199).
450450

0 commit comments

Comments
 (0)