diff --git a/.changeset/gold-kiwis-peel.md b/.changeset/gold-kiwis-peel.md new file mode 100644 index 00000000..c2c1ab3f --- /dev/null +++ b/.changeset/gold-kiwis-peel.md @@ -0,0 +1,5 @@ +--- +'markdown-to-jsx': patch +--- + +Factor out unnecessary element cloning. diff --git a/index.tsx b/index.tsx index 36f76c7f..e91773ad 100644 --- a/index.tsx +++ b/index.tsx @@ -1265,9 +1265,7 @@ export function compiler( (HTML_BLOCK_ELEMENT_R.test(normalizedValue) || HTML_SELF_CLOSING_ELEMENT_R.test(normalizedValue)) ) { - map[mappedKey] = React.cloneElement(compile(normalizedValue.trim()), { - key: index, - }) + map[mappedKey] = compile(normalizedValue.trim()) } } else if (raw !== 'style') { map[ATTRIBUTE_TO_JSX_PROP_MAP[raw] || raw] = true