Skip to content

Commit

Permalink
docs(readme): update FAQ with how to preserve case of tags (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jun 7, 2020
1 parent 8a6589f commit dc543d1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,27 @@ See [#158](https://github.com/remarkablemark/html-react-parser/issues/158).

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

#### Don't change case of tags.

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

```js
const options = {
htmlparser2: {
lowerCaseTags: false
}
};
parse('<CustomElement>', options); // React.createElement('CustomElement')
```

> **Warning**: By preserving case-sensitivity of the tags, you may get rendering warnings like:
>
> ```
> Warning: <CustomElement> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
> ```
See [#62](https://github.com/remarkablemark/html-react-parser/issues/62) and [example](https://repl.it/@remarkablemark/html-react-parser-62).
## Benchmarks
```sh
Expand Down

0 comments on commit dc543d1

Please sign in to comment.