Describe the feature
It would be nice to introduce support for custom math rendering via a new math option in RenderOptions. This allows users to intercept and replace LaTeX math spans (both inline and display) with any custom string (e.g., KaTeX/MathJax rendered HTML or specific ANSI sequences for terminal).
const html = await renderToHtml("This is $E=mc^2$", {
math: (code, display) => {
return display
? `<div class="math-display">${render(code)}</div>`
: `<span class="math-inline">${render(code)}</span>`;
}
});
Additional information
Describe the feature
It would be nice to introduce support for custom math rendering via a new
mathoption inRenderOptions. This allows users to intercept and replace LaTeX math spans (both inline and display) with any custom string (e.g., KaTeX/MathJax rendered HTML or specific ANSI sequences for terminal).Additional information