Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDX closing tag bug #10318

Closed
1 task
theRealProHacker opened this issue Mar 4, 2024 · 3 comments
Closed
1 task

MDX closing tag bug #10318

theRealProHacker opened this issue Mar 4, 2024 · 3 comments
Labels
needs triage Issue needs to be triaged

Comments

@theRealProHacker
Copy link

theRealProHacker commented Mar 4, 2024

Astro Info

Astro                    v4.2.1
Node                     v21.6.0
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I have an Astro component Abbr which I use in an MDX file, I use the Astro component as explained in https://docs.astro.build/en/guides/markdown-content/#using-components-in-mdx:

---
lang: "en"
--- 

import Abbr from '../../components/Abbr.astro'

<br>
<Abbr e="Natural Language Processing">NLP</Abbr>

The resulting error stack trace is:

MDXError: Expected a closing tag for `</Abbr>` (26:1-26:5)
    at TransformContext.transform (file:///C:/Users/Rashid/Desktop/Programmieren/personal-website/node_modules/@astrojs/mdx/dist/index.js:92:27)
    at async Object.transform (file:///C:/Users/Rashid/Desktop/Programmieren/personal-website/node_modules/astro/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:64063:30)
    at async loadAndTransform (file:///C:/Users/Rashid/Desktop/Programmieren/personal-website/node_modules/astro/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:49741:29)
    at async instantiateModule (file:///C:/Users/Rashid/Desktop/Programmieren/personal-website/node_modules/astro/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:50759:10)

What's the expected result?

The expected result should be that the <br> is auto-closed. Another acceptable but not desired result is an error that tells me that the <br> is not closed.

There are several hints. For example, it is clear that </Abbr> is a closing tag and so the error simply logically makes no sense: A closing tag can impossibly be missing a closing tag.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ojtesw?file=src%2Fpages%2Findex.mdx

Participation

  • I am willing to submit a pull request for this issue.

Tasks

@github-actions github-actions bot added the needs triage Issue needs to be triaged label Mar 4, 2024
@matthewp
Copy link
Contributor

matthewp commented Mar 4, 2024

Auto-closing tags are not supported in mdx. You can go to mdxjs.com/playground and test it out, you get the same error you're reporting here.

@matthewp matthewp closed this as completed Mar 4, 2024
@theRealProHacker
Copy link
Author

theRealProHacker commented Mar 4, 2024

Sorry, but this doesn't seem satisfactory to me. I explicitly said that auto-closing would be cool, but the minimum is to get a good error. That is the real issue, not that it doesn't auto-close, but I can also open an issue with MDX if that is necessary

@theRealProHacker
Copy link
Author

I filed an issue with MDX as this is clearly an issue with MDX: mdx-js/mdx#2451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants