content icon indicating copy to clipboard operation
content copied to clipboard

ERROR [unhandledRejection] Cannot read properties of undefined (reading 'mathFlowInside')

Open wokalek opened this issue 2 years ago • 6 comments

Environment

Nuxt project info: 18:45:21



Reproduction

I update nuxt/content, rehype-katex and remark-math and then get an error on production build.

By removing the unnecessary stuff, I found out that the block below breaks the nuxt build in production mode.

$$
{\frac{x-x_a}{x_b-x_a} = \frac{y-y_a}{y_b-y_a}}
$$

Even code below not render.

$$
123
$$

In remark-math repo already have issue, but the developer responded to contact nuxt developers.

So, I just can't use new versions of nuxt/content or rehype-katex+remark-math newer then these:

"@nuxt/content": "^2.8.2", "rehype-katex": "^6.0.3", "remark-math": "^5.1.1",

Describe the bug

 ERROR  [unhandledRejection] Cannot read properties of undefined (reading 'mathFlowInside')                                                                                                     18:38:19

  at Object.exitMathFlowFence (node_modules/.pnpm/[email protected]/node_modules/mdast-util-math/lib/index.js:96:19)
  at compile (node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:352:40)
  at fromMarkdown (node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:187:29)
  at parser (node_modules/.pnpm/[email protected]/node_modules/remark-parse/lib/index.js:18:12)
  at Function.parse (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:668:12)
  at executor (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:734:40)
  at new Promise (<anonymous>)
  at Function.process (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:720:47)
  at parseMarkdown (.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:3325:41)
  at async Object.parse (.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:3423:20)

Additional context

No response

Logs

No response

wokalek avatar Nov 27 '23 15:11 wokalek

@Sun-ZhenXing do you resolve this?

wokalek avatar Nov 27 '23 16:11 wokalek

@Sun-ZhenXing do you resolve this?

@wokalek Not yet. I think it has something to do with the order of plugins parsed within the @nuxtjs/mdc.

If this isn't officially supported, it may have to be solved by starting with the source code.

Sun-ZhenXing avatar Nov 28 '23 01:11 Sun-ZhenXing

remark-math uses remark^11 which is not supported by Content module yet. There is a breaking change between remark^10 and remark^11. The upgrade is planned for the next version of @nuxtjs/mdc.

farnabaz avatar Dec 12 '23 10:12 farnabaz

remark-math uses remark^11 which is not supported by Content module yet. There is a breaking change between remark^10 and remark^11. The upgrade is planned for the next version of @nuxtjs/mdc.

Good news! I'm really looking forward to it!

wokalek avatar Dec 12 '23 12:12 wokalek

Thank you @wokalek !

@farnabaz I test "remark-math": "^5.1.1" and it work well!

Try my proj: algo-code-mgr. If you try, the warning you see is due to Vue not supporting MathML, and Vue will soon support MathML!

Sun-ZhenXing avatar Dec 12 '23 13:12 Sun-ZhenXing

remark-math uses remark^11 which is not supported by Content module yet. There is a breaking change between remark^10 and remark^11. The upgrade is planned for the next version of @nuxtjs/mdc.

@farnabaz

Hello. I tried updating to the latest versions:

"@nuxt/content": "2.10.0",
"rehype-katex": "^7.0.0",
"remark-math": "^6.0.0",

and it didn't help. As far as I can see, @nuxtjs/mdc version has been updated inside nuxt/content to version 0.3.0.

So, no updates on this issue yet?

wokalek avatar Dec 22 '23 22:12 wokalek

I updated it to everything new, the problem disappeared by itself. I think we can close it. None of the new users will encounter this problem anymore.

wokalek avatar Feb 28 '24 15:02 wokalek

The $$ syntax no longer works for LaTeX

remark-math removed the $$ syntax in version v6 and replaced it with the math block.

Before you had to do this

$$
123
$$

Now you have to do this

	```math
	x^2
	```

dephraiim avatar Jun 01 '24 11:06 dephraiim

@dephraiim Thank you so much :), this saved me so much time, I couldn't figure out the issue before

nico778 avatar Jul 07 '24 12:07 nico778