I'm using MathJax (mathjax-full) to render LaTeX. For browser preview, it converts LaTeX to SVG on the client side.
For PDF export, the rendered HTML (with SVG math) is sent to the server where Puppeteer generates the PDF.