diff --git a/IPython/frontend/html/notebook/static/js/cell.js b/IPython/frontend/html/notebook/static/js/cell.js index 4dbb9e6..ade8f9d 100644 --- a/IPython/frontend/html/notebook/static/js/cell.js +++ b/IPython/frontend/html/notebook/static/js/cell.js @@ -51,14 +51,6 @@ var IPython = (function (IPython) { }; - // typeset with MathJax if MathJax is available - Cell.prototype.typeset = function () { - if (window.MathJax){ - MathJax.Hub.Queue(["Typeset",MathJax.Hub]); - } - }; - - Cell.prototype.select = function () { this.element.addClass('ui-widget-content ui-corner-all'); this.selected = true; diff --git a/IPython/frontend/html/notebook/static/js/mathjaxutils.js b/IPython/frontend/html/notebook/static/js/mathjaxutils.js index 2dea85e..b8df58a 100644 --- a/IPython/frontend/html/notebook/static/js/mathjaxutils.js +++ b/IPython/frontend/html/notebook/static/js/mathjaxutils.js @@ -16,18 +16,6 @@ IPython.mathjaxutils = (function (IPython) { var init = function () { if (window.MathJax) { // MathJax loaded - MathJax.Hub.Config({ - TeX: { equationNumbers: { autoNumber: "AMS", useLabelIds: true } }, - tex2jax: { - inlineMath: [ ['$','$'], ["\\(","\\)"] ], - displayMath: [ ['$$','$$'], ["\\[","\\]"] ], - processEnvironments: true - }, - displayAlign: 'left', // Change this to 'center' to center equations. - "HTML-CSS": { - styles: {'.MathJax_Display': {"margin": 0}} - } - }); } else if (window.mathjax_url != "") { // Don't have MathJax, but should. Show dialog. var dialog = $('
') @@ -225,8 +213,14 @@ IPython.mathjaxutils = (function (IPython) { var queue_render = function () { // see https://groups.google.com/forum/?fromgroups=#!topic/mathjax-users/cpwy5eCH1ZQ + var jax = MathJax.Hub.getAllJax(); + MathJax.Hub.Queue( - ["resetEquationNumbers",MathJax.InputJax.TeX], + function () { + if (MathJax.InputJax.TeX.resetEquationNumbers) { + MathJax.InputJax.TeX.resetEquationNumbers(); + } + }, ["PreProcess",MathJax.Hub], ["Reprocess",MathJax.Hub] ); diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js index 8b46bbe..809776b 100644 --- a/IPython/frontend/html/notebook/static/js/textcell.js +++ b/IPython/frontend/html/notebook/static/js/textcell.js @@ -221,37 +221,36 @@ var IPython = (function (IPython) { if (this.rendered === false) { var text = this.get_text(); if (text === "") { text = this.placeholder; } - - text = IPython.mathjaxutils.remove_math(text) - var html = IPython.markdown_converter.makeHtml(text); - html = IPython.mathjaxutils.replace_math(html) - - try { - this.set_rendered(html); - } catch (e) { - console.log("Error running Javascript in Markdown:"); - console.log(e); - this.set_rendered($("").addClass("js-error").html( - "Error rendering Markdown!' + code + '
';
+ });
+
+ IPython.mathjaxutils.queue_render()
}
- this.typeset()
- this.element.find('div.text_cell_input').hide();
- this.element.find("div.text_cell_render").show();
- var code_snippets = this.element.find("pre > code");
- code_snippets.replaceWith(function () {
- var code = $(this).html();
- /* Substitute br for newlines and for spaces
- before highlighting, since prettify doesn't
- preserve those on all browsers */
- code = code.replace(/(\r\n|\n|\r)/gm, "' + code + '
';
- });
-
- IPython.mathjaxutils.queue_render()
this.rendered = true;
}
};
diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html
index 7eea6e8..865e439 100644
--- a/IPython/frontend/html/notebook/templates/notebook.html
+++ b/IPython/frontend/html/notebook/templates/notebook.html
@@ -2,6 +2,21 @@
{% block stylesheet %}
{% if mathjax_url %}
+
+
{% end %}
+
{% end %}