Excerpts in search results breaks MathJax fragments

For example:

https://math.stackexchange.com/search?q=conditional+expectation+user%3Auser130272

The problem, of course, is that the excerpt extraction code apparently is not aware of MathJax boundaries. In the example above, it spits the following:

            <div class="excerpt">
$be the maximum of the three values, let$Y_2$be their product, .... </div>  Update: Well, this seems to have been already addressed here (I did a search before asking, but didn't find it - the "Related" sidebar is clever indeed). Feel free to close this as dup if appropiate. Update 2: The linked post seems to consider that this issue does not deserve to be fixed. Perhaps that should be reconsidered? I copy my comment: "we can't reasonably format the bodies because the snippets are outside of our control". I'm not sure of that. Every CMS or blog has the intelligence to strip out some unwanted content (for example, some HTML or BBCode) in search result pages with excerpts. That an unmatched$ spoils the text is a bug. If it's too difficult to match dollar signs, could't at least escape them, so that the MathJax formatter is not involved and the latex code is shown instead?