From 3b50d4b4ad8bd0df68876bd60186b86a41ccc857 Mon Sep 17 00:00:00 2001 From: Lorenzo Gasparini Date: Wed, 1 Mar 2017 18:53:34 +0100 Subject: [PATCH] Add comments --- notebook/static/notebook/js/mathjaxutils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/notebook/static/notebook/js/mathjaxutils.js b/notebook/static/notebook/js/mathjaxutils.js index d55255fde..b68fa8522 100644 --- a/notebook/static/notebook/js/mathjaxutils.js +++ b/notebook/static/notebook/js/mathjaxutils.js @@ -204,6 +204,11 @@ define([ // and clear the math array (no need to keep it around). // var replace_math = function (text, math) { + // + // Replaces a math placeholder with its corresponding group. + // The math delimiters "\\(", "\\[", "\\)" and "\\]" are replaced + // removing one backslash in order to be interpreted correctly by MathJax. + // var math_group_process = function (match, n) { var math_group = math[n]; @@ -216,6 +221,8 @@ define([ return math_group; }; + // Replace all the math group placeholders in the text + // with the saved strings. text = text.replace(/@@(\d+)@@/g, math_group_process); return text;