diff --git a/.changeset/large-beds-pump.md b/.changeset/large-beds-pump.md
new file mode 100644
index 00000000..6eef7d2a
--- /dev/null
+++ b/.changeset/large-beds-pump.md
@@ -0,0 +1,5 @@
+---
+'markdown-to-jsx': patch
+---
+
+Simplify handling of fallback scenario if a link reference is missing its corresponding footnote.
diff --git a/index.tsx b/index.tsx
index e6a563a3..766e0d43 100644
--- a/index.tsx
+++ b/index.tsx
@@ -280,7 +280,6 @@ const PARAGRAPH_R = /^[^\n]+(?: \n|\n{2,})/
const REFERENCE_IMAGE_OR_LINK = /^\[([^\]]*)\]:\s+([^\s>]+)>?\s*("([^"]*)")?/
const REFERENCE_IMAGE_R = /^!\[([^\]]*)\] ?\[([^\]]*)\]/
const REFERENCE_LINK_R = /^\[([^\]]*)\] ?\[([^\]]*)\]/
-const SQUARE_BRACKETS_R = /(\[|\])/g
const SHOULD_RENDER_AS_BLOCK_R = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/
const TAB_R = /\t/g
const TABLE_TRIM_PIPES = /(^ *\||\| *$)/g
@@ -1764,10 +1763,7 @@ export function compiler(
parse(capture, parse, state) {
return {
children: parse(capture[1], state),
- fallbackChildren: parse(
- capture[0].replace(SQUARE_BRACKETS_R, '\\$1'),
- state
- ),
+ fallbackChildren: capture[0],
ref: capture[2],
}
},
@@ -1781,7 +1777,7 @@ export function compiler(
{output(node.children, state)}
) : (
- {output(node.fallbackChildren, state)}
+ {node.fallbackChildren}
)
},
},
@@ -2152,7 +2148,7 @@ export namespace MarkdownToJSX {
export interface ReferenceLinkNode {
type: typeof RuleType.refLink
children: MarkdownToJSX.ParserResult[]
- fallbackChildren: MarkdownToJSX.ParserResult[]
+ fallbackChildren: string
ref: string
}