@@ -161,7 +161,9 @@ parse('<br>', {
161161});
162162```
163163
164- Console output:
164+ <details >
165+ <summary >Console output</summary >
166+ <p >
165167
166168``` js
167169Element {
@@ -177,6 +179,9 @@ Element {
177179}
178180```
179181
182+ </p >
183+ </details >
184+
180185The element is replaced if a ** valid** React element is returned:
181186
182187``` jsx
@@ -245,7 +250,9 @@ const options = {
245250parse (html, options);
246251```
247252
248- HTML output:
253+ <details >
254+ <summary >HTML output</summary >
255+ <p >
249256
250257<!-- prettier-ignore-start -->
251258
@@ -259,6 +266,9 @@ HTML output:
259266
260267<!-- prettier-ignore-end -->
261268
269+ </p >
270+ </details >
271+
262272#### replace element attributes
263273
264274Convert DOM attributes to React props with ` attributesToProps ` :
@@ -282,12 +292,17 @@ const options = {
282292parse (html, options);
283293```
284294
285- HTML output:
295+ <details >
296+ <summary >HTML output</summary >
297+ <p >
286298
287299``` html
288300<div class =" prettify" style =" background :#fff ;text-align :center " ></div >
289301```
290302
303+ </p >
304+ </details >
305+
291306#### replace and remove element
292307
293308[ Exclude] ( https://replit.com/@remarkablemark/html-react-parser-56 ) an element from rendering by replacing it with ` <React.Fragment> ` :
@@ -298,12 +313,17 @@ parse('<p><br id="remove"></p>', {
298313});
299314```
300315
301- HTML output:
316+ <details >
317+ <summary >HTML output</summary >
318+ <p >
302319
303320``` html
304321<p ></p >
305322```
306323
324+ </p >
325+ </details >
326+
307327### transform
308328
309329The ` transform ` option allows you to transform each element individually after it's parsed.
@@ -522,7 +542,7 @@ If you see the TypeScript error:
522542node_modules/htmlparser2/lib/index.d.ts:2:23 - error TS1005: ',' expected.
523543
5245442 export { Parser, type ParserOptions };
525- ~~~~~~~~~~~~~
545+ ~~~~~~~~~~~~~
526546```
527547
528548Then upgrade to the latest version of [ typescript] ( https://www.npmjs.com/package/typescript ) . See [ #748 ] ( https://github.com/remarkablemark/html-react-parser/issues/748 ) .
0 commit comments