Highlighting in editor

I’ve noticed a weird behavior in the editor. To explain it with a picture:

The first paragraph works as it is supposed to. The italics text is highlighted and rendered.

The next 2 examples are the issue. Within text an underscore (or asterisk) does not mean that it is rendered as italics, as you can clearly see in the preview.
Italics should only be highlighted when surrounded by

  • at least one space on both sides
  • at least one space on one side and a punctuation character on the other

But for some reason the highlighter still parses it as italics, which is rather annoying.

This is not a Joplin issue, but rather an upstream problem. It has either to do with the editor or the highlighting package. Any hint would help me to open a bug in the correct repo.

I found an issue in the Ace repo. I’ve added my findings, but unless someone creates a PR for that in the Ace repo, I’m afraid this won’t be fixed anytime soon.