nuxt-modules / mdc

MDC supercharges regular Markdown to write documents interacting deeply with any Vue component.
MIT License
202 stars 23 forks source link

MathML and SVG tags considered non-native by parser #258

Open JakeIsMeh opened 2 months ago

JakeIsMeh commented 2 months ago

For a while, I've been getting Vue warnings about failure to resolve MathML tags during rendering with MDC. Initially I tried to set compilerOptions.isCustomElement to suppress the warnings but it seemed ignored when used with MDC (#250).

Vue added support for MathML tags all the way back in 3.4, and Katex's output seemed to be correct, so it has to come from MDC.

It seems to come from here: https://github.com/nuxt-modules/mdc/blob/150e2d4317216733f3442234e9720864963a9dbf/src/runtime/components/MDCRenderer.vue#L340-L342

due to MathML tags not being included in htmlTags, thus the component tries to resolve it as a Vue component.

I'm willing to create a PR if all it requires is adding the MathML tags to runtime/parser/utils/html-tags-list.ts.

EDIT: this also affects the <line> and <path> tags used by inline SVGs

JessicaSachs commented 3 days ago

:+1: I'm getting tons of warnings with Mermaid which is trying to load an svg diagram from within <ProseP> in a slot

adamdehaven commented 2 days ago

đź‘Ť I'm getting tons of warnings with Mermaid which is trying to load an svg diagram from within <ProseP> in a slot

Interesting; I have a solution to render mermaid on the client, although based on the ProsePre component and don’t have the issue