##// END OF EJS Templates
Finalizing fixes to MathJax enhancements...
Aron Ahmadia -
Show More
@@ -50,8 +50,11 b' var IPython = (function (IPython) {'
50 });
50 });
51 };
51 };
52
52
53 // prototype typeset method does nothing, see TextCell typeset
54 Cell.prototype.typeset = function () {
53 Cell.prototype.typeset = function () {
54 if (window.MathJax){
55 var cell_math = this.element.get(0);
56 MathJax.Hub.Queue(["Typeset",MathJax.Hub,cell_math]);
57 }
55 };
58 };
56
59
57 Cell.prototype.select = function () {
60 Cell.prototype.select = function () {
@@ -16,6 +16,18 b' IPython.mathjaxutils = (function (IPython) {'
16 var init = function () {
16 var init = function () {
17 if (window.MathJax) {
17 if (window.MathJax) {
18 // MathJax loaded
18 // MathJax loaded
19 MathJax.Hub.Config({
20 tex2jax: {
21 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
22 displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
23 processEnvironments: true
24 },
25 displayAlign: 'left', // Change this to 'center' to center equations.
26 "HTML-CSS": {
27 styles: {'.MathJax_Display': {"margin": 0}}
28 }
29 });
30 MathJax.Hub.Configured();
19 } else if (window.mathjax_url != "") {
31 } else if (window.mathjax_url != "") {
20 // Don't have MathJax, but should. Show dialog.
32 // Don't have MathJax, but should. Show dialog.
21 var dialog = $('<div></div>')
33 var dialog = $('<div></div>')
@@ -89,12 +101,12 b' IPython.mathjaxutils = (function (IPython) {'
89 // math, then push the math string onto the storage array.
101 // math, then push the math string onto the storage array.
90 // The preProcess function is called on all blocks if it has been passed in
102 // The preProcess function is called on all blocks if it has been passed in
91 var process_math = function (i, j, pre_process) {
103 var process_math = function (i, j, pre_process) {
92 var HUB = MathJax.Hub;
104 var hub = MathJax.Hub;
93 var block = blocks.slice(i, j + 1).join("").replace(/&/g, "&amp;") // use HTML entity for &
105 var block = blocks.slice(i, j + 1).join("").replace(/&/g, "&amp;") // use HTML entity for &
94 .replace(/</g, "&lt;") // use HTML entity for <
106 .replace(/</g, "&lt;") // use HTML entity for <
95 .replace(/>/g, "&gt;") // use HTML entity for >
107 .replace(/>/g, "&gt;") // use HTML entity for >
96 ;
108 ;
97 if (HUB.Browser.isMSIE) {
109 if (hub.Browser.isMSIE) {
98 block = block.replace(/(%[^\n]*)\n/g, "$1<br/>\n")
110 block = block.replace(/(%[^\n]*)\n/g, "$1<br/>\n")
99 }
111 }
100 while (j > i) {
112 while (j > i) {
@@ -40,7 +40,6 b' var IPython = (function (IPython) {'
40 onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this)
40 onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this)
41 });
41 });
42 // The tabindex=-1 makes this div focusable.
42 // The tabindex=-1 makes this div focusable.
43 // id is a unique cell_id necessary for updating MathJax intelligently
44 var render_area = $('<div/>').addClass('text_cell_render border-box-sizing').
43 var render_area = $('<div/>').addClass('text_cell_render border-box-sizing').
45 addClass('rendered_html').attr('tabindex','-1');
44 addClass('rendered_html').attr('tabindex','-1');
46 cell.append(input_area).append(render_area);
45 cell.append(input_area).append(render_area);
@@ -78,13 +77,6 b' var IPython = (function (IPython) {'
78 return false;
77 return false;
79 };
78 };
80
79
81 TextCell.prototype.typeset = function () {
82 if (window.MathJax){
83 var cell_math = this.element.get(0);
84 MathJax.Hub.Queue(["Typeset",MathJax.Hub,cell_math]);
85 }
86 };
87
88
80
89 TextCell.prototype.select = function () {
81 TextCell.prototype.select = function () {
90 IPython.Cell.prototype.select.apply(this);
82 IPython.Cell.prototype.select.apply(this);
@@ -229,7 +221,6 b' var IPython = (function (IPython) {'
229 if (this.rendered === false) {
221 if (this.rendered === false) {
230 var text = this.get_text();
222 var text = this.get_text();
231 if (text === "") { text = this.placeholder; }
223 if (text === "") { text = this.placeholder; }
232 else {
233 text = IPython.mathjaxutils.remove_math(text)
224 text = IPython.mathjaxutils.remove_math(text)
234 var html = IPython.markdown_converter.makeHtml(text);
225 var html = IPython.markdown_converter.makeHtml(text);
235 html = IPython.mathjaxutils.replace_math(html)
226 html = IPython.mathjaxutils.replace_math(html)
@@ -257,7 +248,6 b' var IPython = (function (IPython) {'
257 return '<code class="prettyprint">' + code + '</code>';
248 return '<code class="prettyprint">' + code + '</code>';
258 });
249 });
259 this.typeset()
250 this.typeset()
260 }
261 this.rendered = true;
251 this.rendered = true;
262 }
252 }
263 };
253 };
@@ -2,21 +2,7 b''
2 {% block stylesheet %}
2 {% block stylesheet %}
3
3
4 {% if mathjax_url %}
4 {% if mathjax_url %}
5 <script type="text/x-mathjax-config">
5 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
6 MathJax.Hub.Config({
7 tex2jax: {
8 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
9 displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
10 processEnvironments: true
11 },
12 displayAlign: 'left', // Change this to 'center' to center equations.
13 "HTML-CSS": {
14 styles: {'.MathJax_Display': {"margin": 0}}
15 }
16 });
17 </script>
18
19 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full" charset="utf-8"></script>
20 {% end %}
6 {% end %}
21 <script type="text/javascript">
7 <script type="text/javascript">
22 // MathJax disabled, set as null to distingish from *missing* MathJax,
8 // MathJax disabled, set as null to distingish from *missing* MathJax,
@@ -3,21 +3,7 b''
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 {% if mathjax_url %}
5 {% if mathjax_url %}
6 <script type="text/x-mathjax-config">
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
7 MathJax.Hub.Config({
8 tex2jax: {
9 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
10 displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
11 processEnvironments: true
12 },
13 displayAlign: 'left', // Change this to 'center' to center equations.
14 "HTML-CSS": {
15 styles: {'.MathJax_Display': {"margin": 0}}
16 }
17 });
18 </script>
19
20 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full" charset="utf-8"></script>
21 {% end %}
7 {% end %}
22 <script type="text/javascript">
8 <script type="text/javascript">
23 // MathJax disabled, set as null to distingish from *missing* MathJax,
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
General Comments 0
You need to be logged in to leave comments. Login now