Mangled Cloze Deletion When Cloze includes MathJax

I’ve noticed some problems when using cloze deletion to automatically add a clozure (CTRL+SHIFT+C on Windows). Here are two examples:

Suppose I have the following bit of text with math in the middle:
Now, if I use cloze deletion, on the entire line, this works fine…
…but after I undo, there is an extra copy of the equation at the start of the line:

On a related note, if you use CTRL+M, M on text that already includes an equation, then it creates an equation with many lines of SVG source code.

1 Like

I also ran into a problem once where the clozure was inserted with the closing brackets before the opening brackets (e.g., “}}{{c4::”) but I haven’t been able to replicate it to get a screenshot or a description of how to reproduce it.

What would you expect to happen in that scenario?

Maybe it should extend the mathjax block instead?

I’m not sure. Even doing nothing would be better than the current behavior. Extending the block might be nice, as BlackBeans suggested.

Another problem with editing MathJax in the new editor: If you copy and paste a section of text containing a MathJax equation, then the output is often mangled (but not always).

Before cutting:
After cutting and pasting:

Pasting a second time often produces the correct output.

That looks like you’re not running the latest Anki version.

@dae, I’ve just upgraded to version ⁨2.1.54 (b6a7760c)⁩ and tested all of the problems I listed above. They all appear to be problems with the new version. The problem with cutting and pasting is somewhat different. The output isn’t quite so mangled, but it’s still not correct.

I was referring to the StartHTML/EndFragment stuff - you should not be seeing that on .54

I also saw this on .54 yesterday and couldn’t reproduce it again so far.