##// END OF EJS Templates
use highlight.js to highlight markdown code blocks
MinRK -
Show More
@@ -93,6 +93,24 b' $(document).ready(function () {'
93
93
94 $([IPython.events]).on('notebook_loaded.Notebook', first_load);
94 $([IPython.events]).on('notebook_loaded.Notebook', first_load);
95 IPython.notebook.load_notebook($('body').data('notebookId'));
95 IPython.notebook.load_notebook($('body').data('notebookId'));
96
97 if (marked) {
98 marked.setOptions({
99 gfm : true,
100 tables: true,
101 langPrefix: "language-",
102 highlight: function(code, lang) {
103 console.log(lang, code);
104 var highlighted;
105 if (lang) {
106 highlighted = hljs.highlight(lang, code, false);
107 } else {
108 highlighted = hljs.highlightAuto(code);
109 }
110 return highlighted.value;
111 }
112 })
113 }
96
114
97 });
115 });
98
116
@@ -298,7 +298,7 b' var IPython = (function (IPython) {'
298
298
299 MarkdownCell.options_default = {
299 MarkdownCell.options_default = {
300 cm_config: {
300 cm_config: {
301 mode: 'markdown'
301 mode: 'gfm'
302 },
302 },
303 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
303 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
304 }
304 }
@@ -329,18 +329,6 b' var IPython = (function (IPython) {'
329 }
329 }
330 this.element.find('div.text_cell_input').hide();
330 this.element.find('div.text_cell_input').hide();
331 this.element.find("div.text_cell_render").show();
331 this.element.find("div.text_cell_render").show();
332 var code_snippets = this.element.find("pre > code");
333 code_snippets.replaceWith(function () {
334 var code = $(this).html();
335 /* Substitute br for newlines and   for spaces
336 before highlighting, since prettify doesn't
337 preserve those on all browsers */
338 code = code.replace(/(\r\n|\n|\r)/gm, "<br/>");
339 code = code.replace(/ /gm, '&nbsp;');
340 code = prettyPrintOne(code);
341
342 return '<code class="prettyprint">' + code + '</code>';
343 });
344 this.typeset()
332 this.typeset()
345 this.rendered = true;
333 this.rendered = true;
346 }
334 }
@@ -12,9 +12,9 b' window.mathjax_url = "{{mathjax_url}}";'
12 </script>
12 </script>
13
13
14 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
14 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
15 <link rel="stylesheet" href="{{ static_url("components/highlight.js/src/styles/github.css") }}"/>
15 <link rel="stylesheet" href="{{ static_url("css/codemirror-ipython.css") }}">
16 <link rel="stylesheet" href="{{ static_url("css/codemirror-ipython.css") }}">
16
17
17 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
18
18
19 <link rel="stylesheet" href="{{ static_url("css/celltoolbar.css") }}" type="text/css" />
19 <link rel="stylesheet" href="{{ static_url("css/celltoolbar.css") }}" type="text/css" />
20
20
@@ -198,6 +198,7 b' class="notebook_app"'
198 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
198 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
199 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
199 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
200 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
200 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
201 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
201 <script src="{{ static_url("js/codemirror-ipython.js") }}" charset="utf-8"></script>
202 <script src="{{ static_url("js/codemirror-ipython.js") }}" charset="utf-8"></script>
202 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
203 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
203 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
204 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
@@ -205,8 +206,10 b' class="notebook_app"'
205 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
206 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
206 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
207 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
207 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
208 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
209 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
208
210
209 <script src="{{ static_url("components/marked/lib/marked.js") }}" charset="utf-8"></script>
211 <script src="{{ static_url("components/marked/lib/marked.js") }}" charset="utf-8"></script>
212 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
210
213
211 <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script>
214 <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script>
212 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
215 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
General Comments 0
You need to be logged in to leave comments. Login now