i-d-template icon indicating copy to clipboard operation
i-d-template copied to clipboard

mathjax breaks

Open cabo opened this issue 6 months ago • 3 comments

I'm getting a mathjax (tex2svg) problem:

https://github.com/core-wg/href/actions/runs/16129811255

...that looks like something isn't put together quite right in the build environment.

I can't reproduce this on my local systems (but then I have node v24.2.0 and not the v22.16.0 listed in the error message).

(Since I can always submit from local systems, this is NOT an urgent problem.)

cabo avatar Jul 10 '25 22:07 cabo

I've traced this to here: https://github.com/mathjax/mathjax-node-cli/blob/master/bin/tex2svg

It looks like its use of "yargs" is now broken. Given how old this package is (the last update is 7 years back) it might be that this is just busted and we need to look for an alternative. The mathjax documentation doesn't mention CLI tools directly, but points to https://github.com/mathjax/MathJax-demos-node which is almost as old. That mathjax hasn't been touched in 2 years is a further concern.

~~https://katex.org/docs/cli might be a better choice now. I will see what the dependency tree looks like. It might not require a full LaTeX installation, which would be nice, but then I don't know about asciitex.~~ Of course, katex is much neater, but it only produces MathML and HTML, not SVG.

martinthomson avatar Jul 11 '25 01:07 martinthomson

As the general approach, I think we need to bridge the time until RFCXML speaks MathML. So I would be quite happy with just patching this up for now. We could do a PR for mathjax-node-cli. We could also fork mathjax-node-cli. We could extract tex2svg from mathjax-node-cli into a separate tool (i.e., a focused fork).

cabo avatar Jul 11 '25 06:07 cabo

I don't really speak 2025 JavaScript, but I know a genAI that pretends to :-). It recommends to replace L28/L29

var argv = require("yargs")
  .demand(1).strict()

with:

const yargs = require("yargs/yargs");
const { hideBin } = require("yargs/helpers");

const argv = yargs(hideBin(process.argv))
  .demandCommand(1, "Error: Missing math expression!")
  .strict()

cabo avatar Jul 11 '25 06:07 cabo