-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MathJax error -- TypeError: Cannot read properties of null (reading '4') #88
Comments
Welcome @rrcobb! 👋 |
This comment has been minimized.
This comment has been minimized.
Huh, super weird! It looks like there is an issue when running on pnpm: https://stackblitz.com/edit/stackblitz-starters-kwh7sk?file=index.js I'll take compare the package-lock.json and pnpm-lock.yml to see if there's a difference in the modules that are getting resolved |
It seems like it's probably a peer module resolution issue? https://pnpm.io/how-peers-are-resolved seems like the most likely difference in the resolution algorithms that pnpm and npm use |
Huh. it seems like it's not a pnpm issue after all, but is instead a parsing error because I used invalid syntax, and it threw this weird index error. I had the (bad, not working):
where your repro had the (good, working):
note the double Maybe should be a better error message, but not a package manager issue. |
fwiw, I had copied mine right from https://github.com/remarkjs/remark-math#example-katex I assumed it was correct as rendered, but it was not! |
What is going on here is that you paste markdown inside a JavaScript string and assume it works exactly the same. |
I assumed this was an error on our side, but it’s not in micromark/mdast: import {micromark} from 'micromark'
import {math, mathHtml} from 'micromark-extension-math'
const source = `
Lift($$L$$) can be determined by Lift Coefficient ($$C_L$$) like the following
equation.
$$
L = \frac{1}{2} \rho v^2 S C_L
$$
`
const output = micromark(source, {
extensions: [math()],
htmlExtensions: [mathHtml()]
})
console.log(output) ->
KaTeX throws a rather readable error. You’re supplying a |
This comment was marked as resolved.
This comment was marked as resolved.
Thanks @wooorm that clarifies things quite a bit. The rendered version in github is different from what the raw string in js should be, which tripped me up. I'lll open an issue in MathJax about the error message, it looks like it's on their end not the unified ecosystem |
Passing an invalid character into MathJax, and it reporting that it is invalid doesn't feel like a bug in |
Initial checklist
Affected packages and versions
remark-mathjax@5.0.0, remark-math@6.0.0
Link to runnable example
No response
Steps to reproduce
index.js
package.json
Expected behavior
This should process and render without errors. Instead, it hits an error within mathjax.
Actual behavior
Runtime
Node v16
Package manager
pnpm
OS
macOS
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: