remarkjs/remark-math

katex error: Module parse failed: Identifier directly after number

jackykwandesign opened this issue · 6 comments

Initial checklist

Affected packages and versions

"rehype-katex": "^6.0.1"

Link to runnable example

https://github.com/jackykwandesign/react-markdown-katex-error

Steps to reproduce

  1. just use rehype-katex in react-markdown will produce error

Expected behavior

show katex

Actual behavior

show babel-loader error

Failed to compile.

./node_modules/hast-util-to-text/index.js 363:65
Module parse failed: Identifier directly after number (363:65)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     //     break is the zero-width space character (U+200B), then the break is
|     //     removed, leaving behind the zero-width space.
>     if (lines[index].charCodeAt(lines[index].length - 1) === 0x20_0b
|     /* ZWSP */
|     || index < lines.length - 1 && lines[index + 1].charCodeAt(0) === 0x20_0b

Runtime

Node v12

Package manager

yarn v1

OS

Linux

Build and bundle tools

Create React App

The error is coming from hast-util-to-text.
This is being discussed at syntax-tree/hast-util-to-text#4

same problem, React 17.0.2

Then please comment on the place where the discussion is being held about this problem with details.

I am a freshman in programing and can't understand your solution, but i found using the specific version remark-math@4.0.0 would deal with this problem.

Please see the linked discussion, read through it, and provide information there

solved over there