remark-math: invalid javascript @ generated object keys
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
rehype-mathjax: 4.0.2
Link to runnable example
No response
Steps to reproduce
// @ vite.config.js
{
plugins: [
XDM({
rehypePlugins: [Rehype_MathJax],
remarkPlugins: [Remark_Math ],
})
]
}
Expected behavior
Example snippet
Lift($L$) can be determined by Lift Coefficient ($C_L$) like the following equation.
should compile from an mdx
file without error.
Actual behavior
Browser Error:
Uncaught (in promise) SyntaxError: Unexpected token '-'
It seems that the error would be prevented by wrapping the generated mdx-container
key in quotes.
Through trial & error I found that this issue:
- occurs when parsing
mdx
files via eithermdx-js
orxdm
- does not occur when swapping
rehype-katex
in place ofrehype-mathjax
Runtime
Node v16
Package manager
yarn v1
OS
Windows
Build and bundle tools
Vite
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (18 by maintainers)
Commits related to this issue
- Fix custom elements Related-to: remarkjs/remark-math#72. — committed to wooorm/xdm by wooorm 2 years ago
- Fix mathjax font url Related-to GH-72. Closes GH-73. Reviewed-by: Titus Wormer <tituswormer@gmail.com> — committed to remarkjs/remark-math by Enteleform 2 years ago
- Fix generated JSX for custom elements Related to: ddcebdb. Related to: remarkjs/remark-math#72. Closes GH-106. Co-authored-by: Titus Wormer <tituswormer@gmail.com> — committed to wooorm/xdm by mdynnl 2 years ago
- Fix custom elements Backports: wooorm/xdm@ddcebdb. Backports: wooorm/xdm@0c6d8ac. Related-to: remarkjs/remark-math#72. Related-to: wooorm/xdm#106. — committed to mdx-js/mdx by wooorm 2 years ago
- Fix custom elements (#1911) Backports: wooorm/xdm@ddcebdb. Backports: wooorm/xdm@0c6d8ac. Related-to: remarkjs/remark-math#72. Related-to: wooorm/xdm#106. — committed to mdx-js/mdx by wooorm 2 years ago
Ah yeah, that was the issue. Ok I’ll try diffing that result against the one from Solid & see if anybody @ their Discord might know what’s going on if I can’t figure it out. Thanks for the assistance!
Thanks for the report! I fixed it in xdm (expect a release in a minute), and will release it in MDX in the next RC / actual release (a week or two?). I’ll close this issue here because there are no code changes required in
remarkjs/remark-math
!