Line break should not happen after/before math if there is no whitespace

Here’s the screenshot again, with the incorrectly wrapped part marked with an arrow.

This is wrong:

This would be correct:

Wrapping should happen only at whitespace. Words are not broken into half in the middle. The same way, $b_2$ should not separate from ) because there is no space between them.


Here’s another, artifical example. Compare when “x” is math vs when it is not math. When it is not math, it is not separated from the closing parenthesis. This is how it should be. Placing “x” into math mode should not change this.

Screenshot:

Markdown:

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm hhhh hhhh (a $x$)

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm hhhh hhhh (a x)