From 81f04f1382b1416480ed0bf0e4018afcce4cfef4 Mon Sep 17 00:00:00 2001 From: adityacp Date: Tue, 3 Nov 2020 16:46:29 +0530 Subject: Fix katex render to allow math inline --- yaksh/static/yaksh/js/lesson.js | 11 +++++++++-- yaksh/templates/base.html | 13 +++++++++++-- yaksh/templates/yaksh/show_lesson_quiz.html | 10 +++++++++- yaksh/templates/yaksh/show_video.html | 2 +- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/yaksh/static/yaksh/js/lesson.js b/yaksh/static/yaksh/js/lesson.js index 2cc2e62..586ae18 100644 --- a/yaksh/static/yaksh/js/lesson.js +++ b/yaksh/static/yaksh/js/lesson.js @@ -1,13 +1,20 @@ $(document).ready(function() { - MathJax.Hub.Queue(["Typeset", MathJax.Hub]); var simplemde = new SimpleMDE({ element: document.getElementById("id_description"), forceSync: true, hideIcons: ["preview", "side-by-side", "fullscreen"] }); simplemde.codemirror.on("change", function() { - MathJax.Hub.Queue(["Typeset", MathJax.Hub]); $("#description_body").html(simplemde.markdown(simplemde.value())); + renderMathInElement( + document.body, + { + delimiters: [ + {left: "$$", right: "$$", display: false}, + {left: "$", right: "$", display: true}, + ] + } + ); }); const player = new Plyr('#player'); var timer = $("#vtimer"); diff --git a/yaksh/templates/base.html b/yaksh/templates/base.html index 2cc607c..4fa12c7 100644 --- a/yaksh/templates/base.html +++ b/yaksh/templates/base.html @@ -52,12 +52,21 @@ - +