https://www.npmjs.com/package/mathml2latex
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="./node_modules//mathml2latex/dist/mathml2latex.js"></script>
</head>
<body>
<script>
// const mathmlHtml =
// '<math display="block"><mfrac><mi>a</mi><mi>b</mi></mfrac></math>'
const mathmlHtml = ` <div>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<msup><mi>a</mi><mn>2</mn></msup>
<mo>+</mo>
<msup><mi>b</mi><mn>2</mn></msup>
<mo>=</mo>
<msup><mi>c</mi><mn>2</mn></msup>
</mrow>
</math>
</div>`
const latex = MathML2LaTeX.convert(mathmlHtml)
console.log(latex)
</script>
</body>
</html>