Skip to content

Commit

Permalink
fix: ref not supported in arbitrary html
Browse files Browse the repository at this point in the history
Fixes #591
  • Loading branch information
quantizor committed Nov 20, 2024
1 parent 5d7900b commit 23caecb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-cups-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'markdown-to-jsx': patch
---

Drop encountered `ref` attributes when processing inline HTML, React doesn't handle it well.
4 changes: 4 additions & 0 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,10 @@ export function compiler(
const value = unquote(raw.slice(delimiterIdx + 1).trim())

const mappedKey = ATTRIBUTE_TO_JSX_PROP_MAP[key] || key

// bail out, not supported
if (mappedKey === 'ref') return map

const normalizedValue = (map[mappedKey] = attributeValueToJSXPropValue(
tag,
key,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@
"size-limit": [
{
"path": "./dist/index.module.js",
"limit": "6.3 kB"
"limit": "6.5 kB"
},
{
"path": "./dist/index.modern.js",
"limit": "6.3 kB"
"limit": "6.5 kB"
}
],
"jest": {
Expand Down

0 comments on commit 23caecb

Please sign in to comment.