Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async afterRender(params, renderer) {
try {
return `<span class="math">${katex.renderToString(params._)}</span>`;
} catch(e) {
if(e instanceof katex.ParseError) {
return await renderer(
"ambox",
{
type: "serious",
text: "Incorrect formula",
"text-small": `Formula <code>${params._}</code> is incorrect.`
}
);
} else {
return await renderer(
"ambox",
{
type: "serious",
text: "Error during rendering formula",
"text-small": e.message
}