fix: added workaround for ignoring custom elements when using isCustomElement
#444
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
isCustomElementisn't used inresolveComponentwhich 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
📚 Description
This change allows users to define an
isCustomElementfunction 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
isCustomElementfunction, 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 ownisCustomElementas a util function which can be imported into thenuxt.configfile 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.