Change to mathjax 4 for format preview - #1598
Conversation
|
I've added a sandbox to the PR but haven't tested it myself. A nice-to-have (not in this PR) would be to get this bundled as part of our deployment process so it's served locally instead of via the CDN. |
| prevWin.innerHTML = preview.txtout; | ||
| if (preview.ok && previewStyles.allowMathPreview) { | ||
| try { | ||
| MathJax.typeset([prevWin]); |
There was a problem hiding this comment.
Are you sure this is still ok with MathJax 4? From Upgrading from v3 to v4:
If you are calling the MathJax API, then you may need to change to using the promise-based calls like MathJax.typesetPromise() rather than the synchronous ones like MathJax.typeset(). See the MathJax v4.0 and Promises section for details and suggestions for how to proceed.
Update: I tried the sandbox. For the first thing I tried, I got this error:
MathJax error: Error: MathJax retry -- an asynchronous action is required; try using one of the promise-based functions and await its resolution.
There was a problem hiding this comment.
Are you sure this is still ok with MathJax 4? From Upgrading from v3 to v4:
If you are calling the MathJax API, then you may need to change to using the promise-based calls like MathJax.typesetPromise() rather than the synchronous ones like MathJax.typeset(). See the MathJax v4.0 and Promises section for details and suggestions for how to proceed.
Update: I tried the sandbox. For the first thing I tried, I got this error:
MathJax error: Error: MathJax retry -- an asynchronous action is required; try using one of the promise-based functions and await its resolution.
@mrducky4 -- can you share what you used to test with? I'm not even a novice LaTeX/MathJax user, so I have to look in existing projects for things to test with.
There was a problem hiding this comment.
I used the same math markup that is in PR #1527, copied here:
Thus we are led to three general definitions for descriptive double
functions, namely (if \(x\unicode{x2640} y\) be any such function)
\[
\begin{aligned}
x\unicode{x2640} \text{ is the relation of }x\unicode{x2640} y\text{ to }&y\text{ for any }y,\\
\unicode{x2640} y\quad "\quad "\quad "\quad "\quad " &x\quad "\quad x,\\
\alpha \unicode{x2640}_{,,} y\text{ is the class of values of }&x\unicode{x2640} y\text{ when }x\text{ is an }\alpha .
\end{aligned}
\]
From 579.png
\(\ast \)<b>88\(\cdot \)14</b>\(\ldotp ~~\vdash\colon\ldotp \kappa \subset A'P\ldotp \supset :P\upharpoonright \kappa \epsilon \text{Rel Mult}\ldotp \equiv \ldotp \exists !P_{\Delta }'\kappa \)
<i>Dem</i>.
\[
\begin{aligned}
&\vdash\ldotp \ast 80\cdot 23\ldotp \supset \vdash:\exists !P_{\Delta }'\kappa \ldotp \equiv \ldotp \exists !(P\upharpoonright \kappa )_{\Delta }'\kappa \quad (1)\\
&\vdash\ldotp \ast 35\cdot 65\ldotp \supset \vdash:\kappa \subset A'P\ldotp \supset \ldotp A'(P\upharpoonright \kappa )=\kappa \quad (2)\\
&\vdash\ldotp (1)\ldotp (2)\ldotp \supset \vdash\colon\ldotp \text{Hp}\ldotp \supset :\exists !P_{\Delta }'\kappa \ldotp \equiv \ldotp \exists !(P\upharpoonright \kappa )_{\Delta }'A'(P\upharpoonright \kappa )\ldotp\\
&[\ast 88\cdot 1] \qquad \equiv \ldotp P\upharpoonright \kappa \epsilon \text{Rel Mult}\colon\ldotp\supset \vdash\ldotp \text{Prop}
\end{aligned}
\]
I see now the error happens once (per project page I think). I got the error, clicked exit to close preview, then clicked preview again. The second time entering preview, it showed the formatted math properly with no error.
There was a problem hiding this comment.
Are you sure this is still ok with MathJax 4? From Upgrading from v3 to v4:
If you are calling the MathJax API, then you may need to change to using the promise-based calls like MathJax.typesetPromise() rather than the synchronous ones like MathJax.typeset(). See the MathJax v4.0 and Promises section for details and suggestions for how to proceed.
Update: I tried the sandbox. For the first thing I tried, I got this error:
MathJax error: Error: MathJax retry -- an asynchronous action is required; try using one of the promise-based functions and await its resolution.
Good point, I can't look at this till next month but feel free to change it if like
cpeel
left a comment
There was a problem hiding this comment.
Requires update before it can be merged.
|
Resolved by #1599 |
Sandbox: https://www.pgdp.org/~cpeel/c.branch/mj4/