Skip to content

Conversation

@Ariges770
Copy link

🔗 Linked issue

isCustomElement isn't used in resolveComponent which means that custom elements receive warnings when used in MDC.
Nuxt Issue #24104

This workaround resolves the following issues.

When using html mode for mathjax or katex, there is no current way to avoid warnings.
Issue #250

Furthermore, this problem is affecting Nuxt Content as well.
Nuxt Content Issue #1774

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This change allows users to define an isCustomElement function which informs vue to ignore custom elements.

Recently, I was trying to integrate mathjax into nuxt content and the custom elements were being sanitised and the dashes were being removed (such as <mjx-container> to <mjx-container>) which was breaking the html tags. Additionally, the warnings are annoying and clutter the terminal when debugging.

The primary issue here is when defining the isCustomElement function, it is only available at build time which means MDC can't use it to ignore custom elements at run time. Thus, I created a workaround where the user can define their own isCustomElement as a util function which can be imported into the nuxt.config file and MDC will read the function and use it to ignore custom tags.

Finally, I still need to add some tests, however, since I'm unfamiliar with testing in Nuxt, I would first like to know if this is a valid approach before spending time writing a test for this fix.

Ariges770 and others added 3 commits August 27, 2025 16:07
Fixed an issue where custom tags would generate a warning despite
defining an exeption in vue.compilerOptions.isCustomElement.

In order to use custom elements in MDC markdown, the user must define a
function in `utils/compilerOptions/isCustomElement.ts` as the default
function. This is then read my `MDCRenderer` which in turn will not
generate the warning.
Users can create a js or ts file in `~/utils/compilerOptions/isCustomElement` which can be used for both `MDCRenderer` and Vue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant