Spurious "<span>" tag in Cloze deletions with hints

For several cards I’ve created recently, I’ve had a problem with an HTML span tags being automatically inserted into a cloze block. The opening tag is put immediately before the second “::” (used to mark the start of a cloze hint) whereas the closing tag is placed within the cloze hint, right before the closing braces “}}”.

An example of the HTML code is shown here:

For {{c1::a quaternion<span style="background-color: rgb(255, 255, 255);">::a(n) <anki-mathjax>\cdots</anki-mathjax></span>}}<anki-mathjax block="true">a+b\mathbf i+c \mathbf j+d\mathbf k,</anki-mathjax> ... (rest of card ommited)

This causes the blue cloze-highlighting to extend to the end of the card, when showing the back:
image

I’ve not been able to narrow down exactly when it happens, but it appears to be related to pasting “::a(n) (\cdots)” to create a cloze hint.

Has anybody else run into similar problems? I was using Anki version 2.1.53, but I just upgraded to 2.1.54, so I’ll post an update if it happens again.

It just happened again on 2.1.54. Here’s the resulting HTML:

Theorem. Consider {{c4::a closed<span style="background-color: rgb(255, 255, 255);">::a(n) <anki-mathjax>\cdots</anki-mathjax></span>}} subset <anki-mathjax>

This might be caused by using the Ditto clipboard manager. I have a saved clip for “a(n) (\cdots)”. It worked fine on older versions of Anki but something about the new version caused the pasted text to have the tags.

Yeah, it’s very sad that this problem still exists, and I’m not using any other tools. I realized this problem when I reviewed some cards in dark mode, and the texts all had a bright background. It happens after I copy texts from the websites (I want to save the attached links as well) and sometimes even after I have removed all the formats with Ctrl+R.

What you’re describing doesn’t sound anything like OP’s problem (from 2+ years ago). If you have an issue with the formatting eraser not working, you should probably post separately asking for help. First, make sure you have the correct options ticked.
image