0

I want to prerender my MathJax with KaTeX to create a pdf, I did this:

var re = new RegExp('<span class="math-tex">\\\((.+)\\\)\<\/span>','gmi');
var htmlR = html.replace(re, function(match, i){
    console.log(match);
    console.log(i);
    return Katex.renderToString(i);
});

But it's returning nothing, my string:

<p>En effet,&nbsp;<span style="background-color:#fff0f5"><span class="math-tex">\(P = P' - \frac{1}{2}\rho\upsilon^2((\frac{r}{r'})^4 -1)\)</span></span></p>

My regex is working on regex101.com.

John Slegers
  • 45,213
  • 22
  • 199
  • 169
user2650746
  • 61
  • 1
  • 1
  • 3

0 Answers0