mathjax / mathjax/MathJax

Make AsciiMath work with Vite

Open
#3,122 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request v3
Dominant language
JavaScript
Stars
10.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Issue Summary

Vite uses strict mode, so the usage of arguments.callee fails. Besides removing arguments.callee from the relevant JS files, Vite compatibility evidently requires slight changes to an additional AsciiMath JS file.

Steps to Reproduce:

See https://excalidraw-mcjzus0ve-excalidraw.vercel.app/ (source commit https://github.com/excalidraw/excalidraw/pull/6037/commits/27a8cda8fdf7e7bc4e0d44f27bfa11cee21fc1cd) for an example of https://github.com/mathjax/MathJax-src/pull/854 in use. In this deployment:

  1. Select "Math" in the toolbar.
  2. Type \(\alpha\) and press "Escape".
  3. Rendering fails with the browser console error "ReferenceError: MathJax is not defined", traced back to an AsciiMath JS file.
Technical Details:
  • MathJax Version: 3.2.2/4.0.0-beta.3
  • Client OS: Linux
  • Browser: Multiple

I am configuring and loading MathJax via loadMathJax() in src/element/subtypes/mathjax/implementation.tsx.

Supporting Information:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the relevant AsciiMath JavaScript files, especially js/input/asciimath/mathjax2/input/AsciiMath.js and the legacy shim.js, then review the loadMathJax() entry point in src/element/subtypes/mathjax/implementation.tsx and the referenced patch. Reproduce the Vite deployment case and verify that Math rendering completes without the strict-mode or global errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, vite
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.