Skip to content

Commit

Permalink
Merge pull request #163 from remarkablemark/docs/readme-lowercase-tags
Browse files Browse the repository at this point in the history
docs(readme): update FAQ with how to preserve case of tags (#62)
  • Loading branch information
remarkablemark authored Jun 7, 2020
2 parents 8a6589f + dc543d1 commit 70e3a29
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 70e3a29

Please sign in to comment.