source:
\begin{equation} \int_{\gamma} f(z)\,\rd z = 0 \mbox{ where $\gamma$ is the boundary of a triangle} \end{equation}
translate to
<math display="block">\int_{\gamma} f(z)\,\mbox{d} z = 0 \mbox{ where $\gamma$ is the boundary of a triangle}</math>
Ok, this last example also have the problem of havng a newline inside the curly braces
Here there are a couple of examples: https://en.tuttorotto.org/Course:Complex_Analysis_(Intermediate_Level)/Cauchy%27s_Theorem_and_its_Consequences/The_Fundamental_Theorem_of_Calculus_and_its_converse
Edit: Idea!
We can transform
\begin{equation} \int_\gamma f = 0 \mbox{ for all closed curves $\gamma$ in $\Omega$ } \end{equation}
to
\begin{equation} \int_\gamma f = 0 \mbox{ for all closed curves } \gamma \mbox{ in } \Omega \end{equation}
(please notice the spaces before and after the text inside the mboxs) during the preparsing phase. I know that this would require a clever parsing of the math environment, but it is a way to tackle this problem.