From 8e00885b29216d8cf9c0868fe181e0d70dc33eeb Mon Sep 17 00:00:00 2001 From: Sauli Anto Date: Sat, 28 Sep 2019 18:30:56 +0300 Subject: [PATCH] Add temporary flickering fix --- src/utils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils.js b/src/utils.js index fcd682581..ce9412cd2 100644 --- a/src/utils.js +++ b/src/utils.js @@ -28,15 +28,15 @@ export function renderEquation( equation, element, engine = 'katex', display = f MathJax.startup.document.updateDocument(); } ); } else { - if ( display ) { - element.innerHTML = '\\[' + equation + '\\]'; - } else { - element.innerHTML = '\\(' + equation + '\\)'; - } - // Fixme: MathJax render occasionally math processing error without timeout + // Fixme: MathJax typesetting cause occasionally math processing error without timeout setTimeout( () => { + if ( display ) { + element.innerHTML = '\\[' + equation + '\\]'; + } else { + element.innerHTML = '\\(' + equation + '\\)'; + } MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, element ] ); - }, 100); + }, 50); } } else if ( engine === 'katex' && typeof katex !== 'undefined' ) { katex.render( equation, element, {