##// END OF EJS Templates
Parse markdown correctly when mathjax is disabled
Jessica B. Hamrick -
Show More
@@ -131,7 +131,7 IPython.mathjaxutils = (function (IPython) {
131 131 //
132 132 var remove_math = function (text) {
133 133 if (!window.MathJax) {
134 return text;
134 return [text, null];
135 135 }
136 136
137 137 var math = []; // stores math strings for later
@@ -314,10 +314,11 var IPython = (function (IPython) {
314 314 MarkdownCell.prototype.render = function () {
315 315 if (this.rendered === false) {
316 316 var text = this.get_text();
317 var math = null;
317 318 if (text === "") { text = this.placeholder; }
318 var text_math = IPython.mathjaxutils.remove_math(text);
319 var text = text_math[0];
320 var math = text_math[1];
319 var text_and_math = IPython.mathjaxutils.remove_math(text);
320 text = text_and_math[0];
321 math = text_and_math[1];
321 322 var html = marked.parser(marked.lexer(text));
322 323 html = $(IPython.mathjaxutils.replace_math(html, math));
323 324 // links in markdown cells should open in new tabs
@@ -517,13 +518,14 var IPython = (function (IPython) {
517 518 HeadingCell.prototype.render = function () {
518 519 if (this.rendered === false) {
519 520 var text = this.get_text();
521 var math = null;
520 522 // Markdown headings must be a single line
521 523 text = text.replace(/\n/g, ' ');
522 524 if (text === "") { text = this.placeholder; }
523 525 text = Array(this.level + 1).join("#") + " " + text;
524 526 var text_and_math = IPython.mathjaxutils.remove_math(text);
525 var text = text_and_math[0];
526 var math = text_and_math[1];
527 text = text_and_math[0];
528 math = text_and_math[1];
527 529 var html = marked.parser(marked.lexer(text));
528 530 var h = $(IPython.mathjaxutils.replace_math(html, math));
529 531 // add id and linkback anchor
General Comments 0
You need to be logged in to leave comments. Login now