kentcdodds / mdx-bundler

🦤 Give me MDX/TSX strings and I'll give you back a component you can render. Supports imports!
MIT License
1.78k stars 75 forks source link

bug: can't handle HTML tags within link label brackets like [<body>]() #136

Open CanRau opened 2 years ago

CanRau commented 2 years ago

Relevant code or config happens even with all xdmOptions disabled

What you did:

I've got the following link in a mdx file

[Mistake 5: rel=canonical in the <body> - 5 common mistakes with rel=canonical](https://developers.google.com/search/blog/2013/04/5-common-mistakes-with-relcanonical#mistake-5:-rel=canonical-in-the-body)

What happened:

error: [plugin: esbuild-xdm] Expected a closing tag for `<body>` (103:36-103:42) before the end of `link`
     103 │ - [Mistake 5: rel=canonical in the <body> - 5 common mistakes with

Problem description:

I think this shouldn't happen, I can fix it by wrapping it in backticks ( `<body>`) or self-close it (<body/>), but I think it shouldn't be necessary, should it? Or is there any reason we'd want the option to add HTML to markdown syntaxed links? Personally I'd just use a HTML link in this case instead, but I could be wrong.

Though while writing this I feel like I should open this upstream in xdm right? Though their issue template is way more intimidating 😳😅

Suggested solution: