# "Less than" symbol breaks mathjax

I’m currently running on last version of main I downloaded, f61c64dd3408670a23ef035b623af69d50e8ec7d , on ubuntu. All addons disabled

Reproduction step:

• Open a note
• In a field, open the mathjax editor, and enter “a<b”.
• Leave the mathjax editor

Expected result:

• Seeing “a<b” in mathematical notation in the field

Actual result

• seeing “a<b” in the field for a second
• see “a” in the field

Investigation:

• Open the html editor
• Enter a lot of spaces (because otherwise the mathjax editor hides the html editor)
• Open the mathjax editor. Type “a<”, you’ll see in html “a<”
• type “b”, you’ll see that “&lt” disappeared and “b” never appeared

So it seems that if < is not the last symbol, it disappear with everything after it.
My guess is that it’s related to the meaning of < in html.

1 Like

Workaround: Use \lt instead of <, or leave a space after <. I’ll also take a look, if there’s a good way to deal with it otherwise (probably needs escaping at some point).

2 Likes

I indeed used \lt in order to move on.
I assume you don’t plan it to be the long term solution here.
The main trouble is that the text after < disappears with no warning. I went on and edit a different field. It’s only by luck that I double-checked a previous field and realized something was off. Which means a lot of people will miss the issue and maybe won’t know how to correct it (I thought about it after maybe a minute or two. Admittedly, I spent the time investigating whether the bug was reproducible without add-on to write this forum post instead of just going on with my note)

A lesser trouble is that, even in a word where I always recall to use lt, I still have tons of notes which use < in mathjax, and that suddenly makes them risky to edit, as I may not think about checking whether they use < or lt, and not think about replacing < with lt immediately.
I could replace all [$]…<…[/$] using regexp, but honestly, doing a huge search and replace with regexp mostly sounds the good way to make disastrous irreversible change (Or maybe I’m just paranoid because I lost 10k cards two weeks ago due to a broken script and it took me hours to revert using a backup)

1 Like