Skip to content

Commit 07586e3

Browse files
committed
Merge pull request ipython#3836 from jhamrick/no-mathjax
Parse markdown correctly when mathjax is disabled Closes ipython#3835
2 parents f7ffc4f + 4c4c8f5 commit 07586e3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

IPython/html/static/notebook/js/mathjaxutils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ IPython.mathjaxutils = (function (IPython) {
131131
//
132132
var remove_math = function (text) {
133133
if (!window.MathJax) {
134-
return text;
134+
return [text, null];
135135
}
136136

137137
var math = []; // stores math strings for later

IPython/html/static/notebook/js/textcell.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,11 @@ var IPython = (function (IPython) {
314314
MarkdownCell.prototype.render = function () {
315315
if (this.rendered === false) {
316316
var text = this.get_text();
317+
var math = null;
317318
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];
321322
var html = marked.parser(marked.lexer(text));
322323
html = $(IPython.mathjaxutils.replace_math(html, math));
323324
// links in markdown cells should open in new tabs
@@ -517,13 +518,14 @@ var IPython = (function (IPython) {
517518
HeadingCell.prototype.render = function () {
518519
if (this.rendered === false) {
519520
var text = this.get_text();
521+
var math = null;
520522
// Markdown headings must be a single line
521523
text = text.replace(/\n/g, ' ');
522524
if (text === "") { text = this.placeholder; }
523525
text = Array(this.level + 1).join("#") + " " + text;
524526
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];
527529
var html = marked.parser(marked.lexer(text));
528530
var h = $(IPython.mathjaxutils.replace_math(html, math));
529531
// add id and linkback anchor

0 commit comments

Comments
 (0)