##// END OF EJS Templates
Create ipythongfm mode
Jonathan Frederic -
Show More
@@ -0,0 +1,45 b''
1 // IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM
2 // Mode with support for latex.
3 //
4 // Latex support was supported by Codemirror GFM as of
5 // https://github.com/marijnh/CodeMirror/pull/567
6 // But was later removed in
7 // https://github.com/marijnh/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c
8
9 CodeMirror.requireMode('gfm', function(){
10 CodeMirror.requireMode('stex', function(){
11 console.log('defining custom mode...');
12 CodeMirror.defineMode("ipythongfm", function(config, parserConfig) {
13
14 var gfm_mode = CodeMirror.getMode(config, "gfm");
15 var tex_mode = CodeMirror.getMode(config, "stex");
16
17 return CodeMirror.multiplexingMode(
18 gfm_mode,
19 {
20 open: "$", close: "$",
21 mode: tex_mode,
22 delimStyle: "delimit"
23 },
24 {
25 open: "$$", close: "$$",
26 mode: tex_mode,
27 delimStyle: "delimit"
28 },
29 {
30 open: "\\(", close: "\\)",
31 mode: tex_mode,
32 delimStyle: "delimit"
33 },
34 {
35 open: "\\[", close: "\\]",
36 mode: tex_mode,
37 delimStyle: "delimit"
38 }
39 // .. more multiplexed styles can follow here
40 );
41 }, 'gfm');
42
43 CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm");
44 });
45 });
@@ -234,7 +234,7 b' var IPython = (function (IPython) {'
234
234
235 MarkdownCell.options_default = {
235 MarkdownCell.options_default = {
236 cm_config: {
236 cm_config: {
237 mode: 'gfm'
237 mode: 'ipythongfm'
238 },
238 },
239 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
239 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
240 };
240 };
@@ -316,6 +316,7 b' class="notebook_app"'
316 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
316 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
317 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
317 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
318 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
318 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
319 <script src="{{ static_url("notebook/js/codemirror-ipythongfm.js") }}" charset="utf-8"></script>
319
320
320 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
321 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
321
322
General Comments 0
You need to be logged in to leave comments. Login now