Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected package
remark-mdx
Steps to reproduce
curly braces {}
are removed from alt attribute of an image when parsed by remark-mdx
.
This is related with syntax-tree/mdast-util-from-markdown#44
Actual behavior
Regarding with {}
,
- mdx expressions in the link (anchor) text for example
[**{name}**](...)
are interpolated, parsed into inline markdown, and produce a JSX like<strong>{name}</strong>
equivalent, as expected in MDX, it is okey. - however, in the image alt for example

produces<img src="..." alt="name">
, but should produce<img src="..." alt="{name}">
as the commonmark spec says. If I use double curly braces in alt, one curly braces appear in my tests.
produces<img src="..." alt="{name}">
, meaningly mdx parser does not remove all curly braces.
Expected behavior
At least I would expect curly braces are preserved in "alt" once remark-mdx
parses since commonmark spec also keeps the curly braces in alt attribute. (see in dingus)
%100 commonmark compliance is always mentioned in the docs!
Curly braces in an image like 
should not be removed, especially considering that MDX is still markdown at its core, just with JSX extensions.
Whereas the title of image/link can hold {}
even in MDX, why alt
can not hold {}
inline with commonmark ? Why I've insisted on that issue this is because of that
As a conclusion, the authors of the MDX spec should allow to appear {}
in alt attribute in order to meet the commonmark compliance.
Runtime
node@22
Package manager
npm
Operating system
macos
Build and bundle tools
No response