I suspect it has to do with the fact that Katex is not Markdown code. (The $
and $$
markers or not in the Markdown specification.) But I can't answer that for sure, since I'm not a Ace Editor developer. Maybe this question is better directed to their repo and/or forum.
According to the developer tools, it's <span class="ace_text ace_xml">$katex_here$</span>
. However, this might very well be also used for other code. Yet again, this is a question for the Ace Editor devs.