'Using mathjax to create svg from html containing mathml

I have been trying to use the mathjax library to achieve something similar to what they have on this demo here: https://www.mathjax.org/#demo

It works perfectly with my use case, because it parses strings like this: <p>\\frac{n!}{k!(n-k)!} = \\binom{n}{k}</p> and outputs the rendered HTML and LateX.

The difference is I need it output as SVG. I am trying to add it to a NestJS application.

So far, I have tried using both mathjax-node and mathjax-full and none of them have been able to solve the issue. Depending on the input format, either the string cannot be parsed (MatML - needs <math> tags), or the html is spewed out without being rendered.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source