-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Astro Info
Astro v5.16.11
Vite v6.4.1
Node v22.16.0
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations @astrojs/mdx (v4.3.13)
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
We use Astro to generate component documentation. Our docs support multiple themes, and to render each example per theme via static URLs, we store examples in an MDX content collection.
After upgrading Astro and related dependencies, we noticed that many examples no longer have working JavaScript.
After investigation, we found that scripts inside Astro components are not rendered when those components are wrapped in plain HTML inside an MDX file.
When checking back, we had mdx plugin 4.0.8 where it was working, but it seems to be broken starting at 4.1.0. If you check the example in the linked stackblitz you'll see the Javascript in the broken example won't even be added.
What's the expected result?
Astro component scripts should be preserved and emitted regardless of whether the component is rendered directly in MDX or nested inside standard HTML elements.
Wrapping a component in HTML within MDX should not change the component’s script behavior or output.
Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.