I don’t know whether MathJax/KaTeX do anything special about wrapping. They could hard-code the lot, they could use markup and styles that will leave the browser to handle wrapping, or they could do active reflow where they adjust the DOM depending on the available space. But server-side rendering is still feasible and desirable even in that last case: you render to some baseline markup that will work in all cases but perhaps not have ideal layout, and then add a bit of optional JavaScript to reflow and optimise the layout. Ideally you separate the mathematical markup rendering from the reflow completely, so that you can ship much less JavaScript (more targeted and faster JavaScript, at that).