Add engine option

This commit is contained in:
Sauli Anto
2019-09-17 16:19:35 +03:00
parent a89cadeac5
commit dbaaa96ae9
6 changed files with 23 additions and 15 deletions

View File

@@ -8,17 +8,18 @@ export function renderEquation( equation, element, engine = 'katex', display = f
/* eslint-disable */
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, element ] );
/* eslint-enable */
}
else if ( engine === 'katex' && typeof katex !== 'undefined' ) {
} else if ( engine === 'katex' && typeof katex !== 'undefined' ) {
/* eslint-disable */
katex.render( equation, element, {
throwOnError: false,
displayMode: display
} );
/* eslint-enable */
} else if ( typeof engine === 'function' ) {
engine(equation, element, display);
} else {
element.innerHTML = equation;
console.warn( 'math-tex-typesetting-missing: Missing the mathematical typesetting engine for tex.' );
console.warn( `math-tex-typesetting-missing: Missing the mathematical typesetting engine (${engine}) for tex.` );
}
}