Anki Stopped Responding when entering MathJax inline formula near images

Anki Version(s)

Version ⁨23.12 (edd38ca0)⁩ AND Version 23.10.1
Python 3.9.15 Qt 6.6.1 PyQt 6.6.0

Description

While adding cards, it stopped responding as I was typing the LaTeX inline brackets (MathJax inline formula) \( \) in the following position:


After typing, the tab will freeze, leaving no option but to force quit Anki.

Reproduce

As I try to figure out how to reproduce this bug (I guess), I found whether images are shown is affecting this bug.
Pasting the first code to the HTML editor and reproduce my actions (add backslash and left brackets) will cause it to freeze, while the second will act properly.

<div>解得 <anki-mathjax>x=1, y=1</anki-mathjax>,</div>
<div>由此可得直线系横过点 <anki-mathjax>A(1,1)</anki-mathjax></div>
<div><img src="paste-fc507a8aab426d36542c44c60e9ee4943222446b.png"><br></div><div>由图,A点为垂足时距离最大。</div><div>因此<anki-mathjax>P</anki-mathjax> 到直线 <anki-mathjax>l</anki-mathjax> 的最远距离为 <anki-mathjax>|P A|,</anki-mathjax></div><div><anki-mathjax>|P A|=\sqrt{(1+3)^2+(1+1)^2}=2\sqrt{5}</anki-mathjax>.</div>
<div>解得 <anki-mathjax>x=1, y=1</anki-mathjax>,</div>
<div>由此可得直线系横过点 <anki-mathjax>A(1,1)</anki-mathjax></div>
由图,A点为垂足时距离最大。<div>因此<anki-mathjax>P</anki-mathjax> 到直线 <anki-mathjax>l</anki-mathjax> 的最远距离为 <anki-mathjax>|P A|,</anki-mathjax></div><div><anki-mathjax>|P A|=\sqrt{(1+3)^2+(1+1)^2}=2\sqrt{5}</anki-mathjax>.</div>

Supplement: Can reproduce after enabling MathJax rendering. Seems to be relevant with it.


Can not reproduce.

I’ve tried your images, my local images; simply input \(\)(both in HTML and Rich Text Editor), use Ctrl + M + M and click the bottom “MathJax Inline Formula” etc. However, everything goes well.

Anki <U+2068>23.12 (edd38ca0)<U+2069>
Python 3.9.15 Qt 6.6.1 PyQt 6.6.1

Thanks for the report; I’ve logged this on Certain inputs can cause editor to hang/freeze · Issue #2897 · ankitects/anki · GitHub

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.