From dc543d145e74acf4f88be9c97fbe3a600a6d8d7f Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 7 Jun 2020 16:33:03 -0400 Subject: [PATCH] docs(readme): update FAQ with how to preserve case of tags (#62) --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 144b4c1f..6d3fc7a8 100644 --- a/README.md +++ b/README.md @@ -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('', options); // React.createElement('CustomElement') +``` + +> **Warning**: By preserving case-sensitivity of the tags, you may get rendering warnings like: +> +> ``` +> Warning: 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