From 332e178084ef40a75ba23270938b8bbe7ef0e459 Mon Sep 17 00:00:00 2001 From: Josh Barnes Date: Tue, 14 Feb 2017 21:03:06 +0000 Subject: [PATCH] [codemirror_mode_extensions] add new nbextension --- .../codemirror_mode_extensions.yaml | 7 +++++++ .../nbextensions/codemirror_mode_extensions/main.js | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml create mode 100644 src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/main.js diff --git a/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml b/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml new file mode 100644 index 000000000..527864633 --- /dev/null +++ b/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml @@ -0,0 +1,7 @@ +Type: Jupyter Notebook Extension +Name: CodeMirror mode extensions +Description: | + Extends some CodeMirror modes with extra features. Currently just adds + support for comment/uncomment and folding for octave/MATLAB mode. +Main: main.js +Compatibility: 4.x diff --git a/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/main.js b/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/main.js new file mode 100644 index 000000000..d960d1ffd --- /dev/null +++ b/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/main.js @@ -0,0 +1,11 @@ +define(['codemirror/lib/codemirror'], function (CodeMirror) { + "use strict"; + return { + load_ipython_extension : function () { + CodeMirror.extendMode('octave', { + lineComment: '%', + fold: 'indent', + }); + } + }; +});