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