0-hero commited on
Commit
745e7ed
·
verified ·
1 Parent(s): a1271b8

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .cache/pip/http-v2/0/4/1/8/c/0418c83b80f7f7bfaec2738bfbbee53d2c1562196c0781702f6eddc8 +0 -0
  2. .cache/pip/http-v2/0/4/1/8/c/0418c83b80f7f7bfaec2738bfbbee53d2c1562196c0781702f6eddc8.body +0 -0
  3. .cache/pip/http-v2/0/7/5/9/3/07593bb905dded4b84aacb1d96c1e64704669d6bab658dcaeab79c36 +0 -0
  4. .cache/pip/http-v2/0/7/5/9/3/07593bb905dded4b84aacb1d96c1e64704669d6bab658dcaeab79c36.body +0 -0
  5. .cache/pip/http-v2/0/c/2/1/8/0c218d526767991766d9b365a4f3e4449ce3579fd8b0f96a707d5a52 +0 -0
  6. .cache/pip/http-v2/0/c/f/6/e/0cf6e817e2c5554000c735ecab0f3cf492f7d33b50d5a474a801ba24.body +0 -0
  7. .cache/pip/http-v2/1/2/e/6/c/12e6c0100f8dcc54f1445b9845cfdcecf519882e2fe2767cf43bd439 +0 -0
  8. .cache/pip/http-v2/1/6/9/3/2/1693297fb9daf7bfe370bf51d371acfeb8ff40759bf8650dfd404ba4 +0 -0
  9. .local/share/jupyter/nbextensions/codefolding/main.js +282 -0
  10. .local/share/jupyter/nbextensions/codemirror_mode_extensions/main.js +11 -0
  11. .local/share/jupyter/nbextensions/comment-uncomment/comment-uncomment.yaml +16 -0
  12. .local/share/jupyter/nbextensions/comment-uncomment/main.js +63 -0
  13. .local/share/jupyter/nbextensions/contrib_nbextensions_help_item/README.md +6 -0
  14. .local/share/jupyter/nbextensions/datestamper/readme.md +6 -0
  15. .local/share/jupyter/nbextensions/equation-numbering/button.png +0 -0
  16. .local/share/jupyter/nbextensions/equation-numbering/main.js +39 -0
  17. .local/share/jupyter/nbextensions/execute_time/ExecuteTime.css +6 -0
  18. .local/share/jupyter/nbextensions/execute_time/execution-timings-box.png +0 -0
  19. .local/share/jupyter/nbextensions/exercise/image.gif +0 -0
  20. .local/share/jupyter/nbextensions/exercise/readme.md +52 -0
  21. .local/share/jupyter/nbextensions/go_to_current_running_cell/README.md +22 -0
  22. .local/share/jupyter/nbextensions/go_to_current_running_cell/go_to_current_running_cell.yaml +26 -0
  23. .local/share/jupyter/nbextensions/go_to_current_running_cell/jump_to_cell.gif +0 -0
  24. .local/share/jupyter/nbextensions/help_panel/help_panel.yaml +12 -0
  25. .local/share/jupyter/nbextensions/hide_input_all/hide_input_all_hide.png +0 -0
  26. .local/share/jupyter/nbextensions/highlight_selected_word/README.md +117 -0
  27. .local/share/jupyter/nbextensions/highlight_selected_word/main.js +419 -0
  28. .local/share/jupyter/nbextensions/highlighter/demo_highlighter.html +0 -0
  29. .local/share/jupyter/nbextensions/highlighter/export_highlights.html +0 -0
  30. .local/share/jupyter/nbextensions/highlighter/export_highlights.ipynb +194 -0
  31. .local/share/jupyter/nbextensions/highlighter/image.gif +0 -0
  32. .local/share/jupyter/nbextensions/highlighter/tst_highlights.html +0 -0
  33. .local/share/jupyter/nbextensions/highlighter/tst_highlights.pdf +0 -0
  34. .local/share/jupyter/nbextensions/highlighter/tst_highlights.tex +279 -0
  35. .local/share/jupyter/nbextensions/hinterland/hinterland.js +194 -0
  36. .local/share/jupyter/nbextensions/keyboard_shortcut_editor/readme_add_new_select_action.png +0 -0
  37. .local/share/jupyter/nbextensions/keyboard_shortcut_editor/readme_shortcut_editor_blank.png +0 -0
  38. .local/share/jupyter/nbextensions/livemdpreview/livemdpreview.yml +24 -0
  39. .local/share/jupyter/nbextensions/move_selected_cells/move_selected_cells.yaml +6 -0
  40. .local/share/jupyter/nbextensions/navigation-hotkeys/main.js +286 -0
  41. .local/share/jupyter/nbextensions/nbTranslate/languages.js +114 -0
  42. .local/share/jupyter/nbextensions/nbTranslate/mutils.js +201 -0
  43. .local/share/jupyter/nbextensions/python-markdown/main.css +4 -0
  44. .local/share/jupyter/nbextensions/python-markdown/python-markdown.yaml +8 -0
  45. .local/share/jupyter/nbextensions/rubberband/main.js +237 -0
  46. .local/share/jupyter/nbextensions/ruler/readme.md +56 -0
  47. .local/share/jupyter/nbextensions/runtools/demo.gif +0 -0
  48. .local/share/jupyter/nbextensions/runtools/gutter.css +3 -0
  49. .local/share/jupyter/nbextensions/runtools/icon.png +0 -0
  50. .local/share/jupyter/nbextensions/runtools/main.css +27 -0
.cache/pip/http-v2/0/4/1/8/c/0418c83b80f7f7bfaec2738bfbbee53d2c1562196c0781702f6eddc8 ADDED
Binary file (1.82 kB). View file
 
.cache/pip/http-v2/0/4/1/8/c/0418c83b80f7f7bfaec2738bfbbee53d2c1562196c0781702f6eddc8.body ADDED
Binary file (147 kB). View file
 
.cache/pip/http-v2/0/7/5/9/3/07593bb905dded4b84aacb1d96c1e64704669d6bab658dcaeab79c36 ADDED
Binary file (1.81 kB). View file
 
.cache/pip/http-v2/0/7/5/9/3/07593bb905dded4b84aacb1d96c1e64704669d6bab658dcaeab79c36.body ADDED
Binary file (1.58 kB). View file
 
.cache/pip/http-v2/0/c/2/1/8/0c218d526767991766d9b365a4f3e4449ce3579fd8b0f96a707d5a52 ADDED
Binary file (1.82 kB). View file
 
.cache/pip/http-v2/0/c/f/6/e/0cf6e817e2c5554000c735ecab0f3cf492f7d33b50d5a474a801ba24.body ADDED
Binary file (7.87 kB). View file
 
.cache/pip/http-v2/1/2/e/6/c/12e6c0100f8dcc54f1445b9845cfdcecf519882e2fe2767cf43bd439 ADDED
Binary file (1.81 kB). View file
 
.cache/pip/http-v2/1/6/9/3/2/1693297fb9daf7bfe370bf51d371acfeb8ff40759bf8650dfd404ba4 ADDED
Binary file (1.81 kB). View file
 
.local/share/jupyter/nbextensions/codefolding/main.js ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Allow codefolding in code cells
2
+ //
3
+ // This extension enables the CodeMirror feature
4
+ // It works by adding a gutter area to each code cell.
5
+ // Fold-able code is marked using small triangles in the gutter.
6
+ //
7
+ // The current folding state is saved in the cell metadata as an array
8
+ // of line numbers.
9
+ // Format: cell.metadata.code_folding = [ line1, line2, line3, ...]
10
+ //
11
+
12
+ define([
13
+ 'base/js/namespace',
14
+ 'jquery',
15
+ 'require',
16
+ 'base/js/events',
17
+ 'services/config',
18
+ 'notebook/js/codecell',
19
+ 'codemirror/lib/codemirror',
20
+ 'codemirror/addon/fold/foldcode',
21
+ 'codemirror/addon/fold/foldgutter',
22
+ 'codemirror/addon/fold/brace-fold',
23
+ 'codemirror/addon/fold/indent-fold'
24
+ ], function (Jupyter, $, requirejs, events, configmod, codecell, CodeMirror) {
25
+ "use strict";
26
+
27
+ // define default config parameter values
28
+ var params = {
29
+ codefolding_hotkey : 'Alt-f',
30
+ init_delay : 1000
31
+ };
32
+
33
+ // updates default params with any specified in the provided config data
34
+ var update_params = function (config_data) {
35
+ for (var key in params) {
36
+ if (config_data.hasOwnProperty(key)) {
37
+ params[key] = config_data[key];
38
+ }
39
+ }
40
+ };
41
+
42
+ var on_config_loaded = function () {
43
+ if (Jupyter.notebook !== undefined) {
44
+ // register actions with ActionHandler instance
45
+ var prefix = 'auto';
46
+ var name = 'toggle-codefolding';
47
+ var action = {
48
+ icon: 'fa-comment-o',
49
+ help : 'Toggle codefolding',
50
+ help_index : 'ec',
51
+ id : 'toggle_codefolding',
52
+ handler : toggleFolding
53
+ };
54
+ var action_full_name = Jupyter.keyboard_manager.actions.register(action, name, prefix);
55
+
56
+ // define keyboard shortcuts
57
+ var edit_mode_shortcuts = {};
58
+ edit_mode_shortcuts[params.codefolding_hotkey] = action_full_name;
59
+
60
+ // register keyboard shortcuts with keyboard_manager
61
+ Jupyter.notebook.keyboard_manager.edit_shortcuts.add_shortcuts(edit_mode_shortcuts);
62
+ Jupyter.notebook.keyboard_manager.command_shortcuts.add_shortcuts(edit_mode_shortcuts);
63
+ }
64
+ else {
65
+ // we're in edit view
66
+ var extraKeys = Jupyter.editor.codemirror.getOption('extraKeys');
67
+ extraKeys[params.codefolding_hotkey] = toggleFolding;
68
+ CodeMirror.normalizeKeyMap(extraKeys);
69
+ console.log('[codefolding] binding hotkey', params.codefolding_hotkey);
70
+ Jupyter.editor.codemirror.setOption('extraKeys', extraKeys);
71
+ }
72
+ };
73
+
74
+ /*
75
+ * Toggle folding on/off at current line
76
+ *
77
+ * @param cm CodeMirror instance
78
+ *
79
+ */
80
+ function toggleFolding () {
81
+ var cm;
82
+ var pos = {line: 0, ch: 0, xRel: 0};
83
+ if (Jupyter.notebook !== undefined) {
84
+ cm = Jupyter.notebook.get_selected_cell().code_mirror;
85
+ if (Jupyter.notebook.mode === 'edit') {
86
+ pos = cm.getCursor();
87
+ }
88
+ }
89
+ else {
90
+ cm = Jupyter.editor.codemirror;
91
+ pos = cm.getCursor();
92
+ }
93
+ var opts = cm.state.foldGutter.options;
94
+ cm.foldCode(pos, opts.rangeFinder);
95
+ }
96
+
97
+ /**
98
+ * Update cell metadata with folding info, so folding state can be restored after reloading notebook
99
+ *
100
+ * @param cm CodeMirror instance
101
+ */
102
+ function updateMetadata (cm) {
103
+ var list = cm.getAllMarks();
104
+ var lines = [];
105
+ for (var i = 0; i < list.length; i++) {
106
+ if (list[i].__isFold) {
107
+ var range = list[i].find();
108
+ lines.push(range.from.line);
109
+ }
110
+ }
111
+ /* User can click on gutter of unselected cells, so make sure we store metadata in the correct cell */
112
+ var cell = Jupyter.notebook.get_selected_cell();
113
+ if (cell.code_mirror !== cm) {
114
+ var cells = Jupyter.notebook.get_cells();
115
+ var ncells = Jupyter.notebook.ncells();
116
+ for (var k = 0; k < ncells; k++) {
117
+ var _cell = cells[k];
118
+ if (_cell.code_mirror === cm ) { cell = _cell; break; }
119
+ }
120
+ }
121
+ cell.metadata.code_folding = lines;
122
+ }
123
+
124
+ /**
125
+ * Activate codefolding in CodeMirror options, don't overwrite other settings
126
+ *
127
+ * @param cm codemirror instance
128
+ */
129
+ function activate_cm_folding (cm) {
130
+ var gutters = cm.getOption('gutters').slice();
131
+ if ( $.inArray("CodeMirror-foldgutter", gutters) < 0) {
132
+ gutters.push('CodeMirror-foldgutter');
133
+ cm.setOption('gutters', gutters);
134
+ }
135
+
136
+ /* set indent or brace folding */
137
+ var opts = true;
138
+ if (Jupyter.notebook) {
139
+ opts = {
140
+ rangeFinder: new CodeMirror.fold.combine(
141
+ CodeMirror.fold.firstline,
142
+ CodeMirror.fold.magic,
143
+ CodeMirror.fold.blockcomment,
144
+ cm.getMode().fold === 'indent' ? CodeMirror.fold.indent : CodeMirror.fold.brace
145
+ )
146
+ };
147
+ }
148
+ cm.setOption('foldGutter', opts);
149
+ }
150
+
151
+ /**
152
+ * Restore folding status from metadata
153
+ * @param cell
154
+ */
155
+ var restoreFolding = function (cell) {
156
+ if (cell.metadata.code_folding === undefined || !(cell instanceof codecell.CodeCell)) {
157
+ return;
158
+ }
159
+ // visit in reverse order, as otherwise nested folds un-fold outer ones
160
+ var lines = cell.metadata.code_folding.slice().sort();
161
+ for (var idx = lines.length - 1; idx >= 0; idx--) {
162
+ var line = lines[idx];
163
+ var opts = cell.code_mirror.state.foldGutter.options;
164
+ var linetext = cell.code_mirror.getLine(line);
165
+ if (linetext !== undefined) {
166
+ cell.code_mirror.foldCode(CodeMirror.Pos(line, 0), opts.rangeFinder);
167
+ }
168
+ else {
169
+ // the line doesn't exist, so we should remove it from metadata
170
+ cell.metadata.code_folding = lines.slice(0, idx);
171
+ }
172
+ cell.code_mirror.refresh();
173
+ }
174
+ };
175
+
176
+ /**
177
+ * Add codefolding gutter to a new cell
178
+ *
179
+ * @param event
180
+ * @param nbcell
181
+ *
182
+ */
183
+ var createCell = function (event, nbcell) {
184
+ var cell = nbcell.cell;
185
+ if ((cell instanceof codecell.CodeCell)) {
186
+ activate_cm_folding(cell.code_mirror);
187
+ cell.code_mirror.on('fold', updateMetadata);
188
+ cell.code_mirror.on('unfold', updateMetadata);
189
+ // queue restoring folding, to run once metadata is set, hopefully.
190
+ // This can be useful if cells are un-deleted, for example.
191
+ setTimeout(function () { restoreFolding(cell); }, 500);
192
+ }
193
+ };
194
+
195
+ /*
196
+ * Initialize gutter in existing cells
197
+ *
198
+ */
199
+ var initExistingCells = function () {
200
+ var cells = Jupyter.notebook.get_cells();
201
+ var ncells = Jupyter.notebook.ncells();
202
+ for (var i = 0; i < ncells; i++) {
203
+ var cell = cells[i];
204
+ if ((cell instanceof codecell.CodeCell)) {
205
+ activate_cm_folding(cell.code_mirror);
206
+ /* restore folding state if previously saved */
207
+ restoreFolding(cell);
208
+ cell.code_mirror.on('fold', updateMetadata);
209
+ cell.code_mirror.on('unfold', updateMetadata);
210
+ }
211
+ }
212
+ events.on('create.Cell', createCell);
213
+ };
214
+
215
+ /**
216
+ * Load my own CSS file
217
+ *
218
+ * @param name off CSS file
219
+ *
220
+ */
221
+ var load_css = function (name) {
222
+ var link = document.createElement("link");
223
+ link.type = "text/css";
224
+ link.rel = "stylesheet";
225
+ link.href = requirejs.toUrl(name, 'css');
226
+ document.getElementsByTagName("head")[0].appendChild(link);
227
+ };
228
+
229
+ /**
230
+ * Initialize extension
231
+ *
232
+ */
233
+ var load_extension = function () {
234
+ // first, check which view we're in, in order to decide whether to load
235
+ var conf_sect;
236
+ if (Jupyter.notebook) {
237
+ // we're in notebook view
238
+ conf_sect = Jupyter.notebook.config;
239
+ }
240
+ else if (Jupyter.editor) {
241
+ // we're in file-editor view
242
+ conf_sect = new configmod.ConfigSection('notebook', {base_url: Jupyter.editor.base_url});
243
+ conf_sect.load();
244
+ }
245
+ else {
246
+ // we're some other view like dashboard, terminal, etc, so bail now
247
+ return;
248
+ }
249
+
250
+ load_css('codemirror/addon/fold/foldgutter.css');
251
+ /* change default gutter width */
252
+ load_css( './foldgutter.css');
253
+
254
+ conf_sect.loaded
255
+ .then(function () { update_params(conf_sect.data); })
256
+ .then(on_config_loaded);
257
+
258
+ if (Jupyter.notebook) {
259
+ /* require our additional custom codefolding modes before initialising fully */
260
+ requirejs(['./firstline-fold', './magic-fold', './blockcomment-fold'], function () {
261
+ if (Jupyter.notebook._fully_loaded) {
262
+ setTimeout(function () {
263
+ console.log('Codefolding: Wait for', params.init_delay, 'ms');
264
+ initExistingCells();
265
+ }, params.init_delay);
266
+ }
267
+ else {
268
+ events.one('notebook_loaded.Notebook', initExistingCells);
269
+ }
270
+ });
271
+ }
272
+ else {
273
+ activate_cm_folding(Jupyter.editor.codemirror);
274
+ setTimeout(function () {
275
+ console.log('Codefolding: Wait for', params.init_delay, 'ms');
276
+ Jupyter.editor.codemirror.refresh();
277
+ }, params.init_delay);
278
+ }
279
+ };
280
+
281
+ return {load_ipython_extension : load_extension};
282
+ });
.local/share/jupyter/nbextensions/codemirror_mode_extensions/main.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ define(['codemirror/lib/codemirror'], function (CodeMirror) {
2
+ "use strict";
3
+ return {
4
+ load_ipython_extension : function () {
5
+ CodeMirror.extendMode('octave', {
6
+ lineComment: '%',
7
+ fold: 'indent',
8
+ });
9
+ }
10
+ };
11
+ });
.local/share/jupyter/nbextensions/comment-uncomment/comment-uncomment.yaml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Type: IPython Notebook Extension
2
+ Compatibility: 4.x, 5.x
3
+ Name: Comment/Uncomment Hotkey
4
+ Main: main.js
5
+ Description: add new configurable hotkey binding to toggle comments
6
+ Icon: icon.png
7
+ Link: readme.md
8
+ Parameters:
9
+ - name: comment_uncomment_keybinding
10
+ description: keybinding for toggling comments
11
+ input_type: hotkey
12
+ default: alt-c
13
+ - name: comment_uncomment_indent
14
+ description: indent comment at current indent level instead of at beginning of line
15
+ default: false
16
+ input_type: checkbox
.local/share/jupyter/nbextensions/comment-uncomment/main.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // add new configurable hotkey binding to toggle comments
2
+
3
+ define([
4
+ 'base/js/namespace',
5
+ ], function(
6
+ IPython
7
+ ) {
8
+ "use strict";
9
+
10
+ // define default config parameter values
11
+ var params = {
12
+ comment_uncomment_keybinding : 'alt-c',
13
+ comment_uncomment_indent: false,
14
+ };
15
+
16
+ // updates default params with any specified in the server's config
17
+ var update_params = function() {
18
+ var config = IPython.notebook.config;
19
+ for (var key in params){
20
+ if (config.data.hasOwnProperty(key) ){
21
+ params[key] = config.data[key];
22
+ }
23
+ }
24
+ };
25
+
26
+ var initialize = function () {
27
+ // update defaults
28
+ update_params();
29
+
30
+ // register actions with ActionHandler instance
31
+ var prefix = 'auto';
32
+ var name = 'toggle-comment';
33
+ var action = {
34
+ icon: 'fa-comment-o',
35
+ help : 'Toggle comments',
36
+ help_index : 'eb',
37
+ id : 'read_only_codecell',
38
+ handler : toggle_comment
39
+ };
40
+ var action_full_name = IPython.keyboard_manager.actions.register(action, name, prefix);
41
+
42
+ // define keyboard shortcuts
43
+ var edit_mode_shortcuts = {};
44
+ edit_mode_shortcuts[params.comment_uncomment_keybinding] = action_full_name;
45
+
46
+ // register keyboard shortcuts with keyboard_manager
47
+ IPython.notebook.keyboard_manager.edit_shortcuts.add_shortcuts(edit_mode_shortcuts);
48
+ };
49
+
50
+ var toggle_comment = function() {
51
+ var cm = IPython.notebook.get_selected_cell().code_mirror;
52
+ cm.toggleComment({ indent: params.comment_uncomment_indent });
53
+ return false;
54
+ };
55
+
56
+ var load_ipython_extension = function () {
57
+ return IPython.notebook.config.loaded.then(initialize);
58
+ };
59
+
60
+ return {
61
+ load_ipython_extension : load_ipython_extension
62
+ };
63
+ });
.local/share/jupyter/nbextensions/contrib_nbextensions_help_item/README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Help menu entry
2
+ ===============
3
+
4
+ The `contrib_nbextensions_help_item` is a tiny nbextension that just adds an
5
+ item to the notebook's help menu, pointing to the docs at readthedocs:
6
+ [jupyter_contrib_nbextensions.readthedocs.io](https://jupyter_contrib_nbextensions.readthedocs.io)
.local/share/jupyter/nbextensions/datestamper/readme.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Datestamper
2
+ ===========
3
+
4
+ Adds a toolbar button which pastes the current time & date into the current cell:
5
+
6
+ ![](icon.png)
.local/share/jupyter/nbextensions/equation-numbering/button.png ADDED
.local/share/jupyter/nbextensions/equation-numbering/main.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) IPython-Contrib Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+
4
+ define([
5
+ 'base/js/namespace',
6
+ 'jquery',
7
+ 'require',
8
+ 'notebook/js/textcell',
9
+ 'base/js/utils',
10
+ ], function(Jupyter, $, requirejs, textcell, utils) {
11
+ "use strict";
12
+
13
+ var MathJax = window.MathJax;
14
+
15
+ var load_ipython_extension = function() {
16
+ var btn_grp = Jupyter.toolbar.add_buttons_group([
17
+ Jupyter.keyboard_manager.actions.register ({
18
+ help : 'Reset equation numbering',
19
+ icon : 'fa-sort-numeric-asc',
20
+ handler: function () {
21
+ MathJax.Hub.Queue(
22
+ ["resetEquationNumbers", MathJax.InputJax.TeX],
23
+ ["PreProcess", MathJax.Hub],
24
+ ["Reprocess", MathJax.Hub]
25
+ );
26
+ $('#reset_numbering').blur();
27
+ }
28
+ }, 'reset-numbering', 'equation_numbering')
29
+ ]);
30
+ $(btn_grp).find('.btn').attr('id', 'reset_numbering');
31
+ MathJax.Hub.Config({
32
+ TeX: { equationNumbers: { autoNumber: "AMS" } }
33
+ });
34
+ };
35
+
36
+ return {
37
+ load_ipython_extension : load_ipython_extension
38
+ };
39
+ });
.local/share/jupyter/nbextensions/execute_time/ExecuteTime.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ .timing_area {
2
+ padding: 0 5px;
3
+ border: none;
4
+ border-top: 1px solid #CFCFCF;
5
+ font-size: 80%;
6
+ }
.local/share/jupyter/nbextensions/execute_time/execution-timings-box.png ADDED
.local/share/jupyter/nbextensions/exercise/image.gif ADDED
.local/share/jupyter/nbextensions/exercise/readme.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Exercise
2
+ ========
3
+
4
+ These are two extensions for Jupyter, for hiding/showing solutions cells.
5
+ They use the same approach and codebase and differ only by the type of
6
+ `cell widget` used the show/hide the solutions. The two extensions can be used
7
+ simultaneously. They require the `rubberband` extension to be installed and
8
+ enabled.
9
+
10
+ The example below demonstrates some of the features of the exercise extensions.
11
+
12
+ - First, an solution or "details" cell is created by (a) selecting two cells with the rubberband and (b) clicking on the menu-button [exercise extension]
13
+ - Second, the two next cells are selected using a keyboard shortcut, and a solution is created using the shortcut Alt-D [exercise2 extension]
14
+ - Third, the two solutions are expanded by clicking on the corresponding widgets
15
+ - Fourth, the solutions are removed by selecting them and clicking on the buttons in the toolbar.
16
+
17
+ ![](image.gif)
18
+
19
+
20
+ The extensions provide
21
+ ----------------------
22
+
23
+ - a menubar button
24
+ - a cell widget -- A plus/minus button in `exercise` and a sliding checkbox in `exercise2`.
25
+
26
+ The menubar button is devoted to the creation or removing of the solution. The solution consists in several consecutive cells that can be selected by the usual notebook multicell selection methods (e.g. *Shift-down* (select next) or *Shift-up* (select previous) keyboard shortcuts, or using the rubberband extension.
27
+
28
+
29
+ ### Creating a solution
30
+
31
+ Several cells being selected, pressing the menubar button adds a `cell widget` and hides the cells excepted the first one which serves as a heading cell. *Do not forget to keep the Shift key pressed down while clicking on the menu button
32
+ (otherwise selected cells will be lost)*. It is also possible to use a keyboard shortcut for creating the solution from selected cells: Alt-S for exercise extension and Alt-D for exercise2.
33
+
34
+
35
+ ### Removing a solution
36
+
37
+ If a solution heading (first) cell is selected, then clicking the menu bar button removes this solution and its solutions cells are shown. Using the keyboard shortcut has the same effect.
38
+
39
+
40
+ ### Showing/hiding solution
41
+
42
+ At creation of the solution, the solution cells are hidden. Clicking the `cell widget` toggles the hidden/shown state of the solution.
43
+
44
+
45
+ ### Persistence
46
+
47
+ The state of solutions, hidden or shown, is preserved and automatically restored at startup and on reload.
48
+
49
+
50
+ ### Internals
51
+
52
+ exercise and exercise2 add respectively a solution and solution2 metadata to solution cells, with for value the current state hidden/shown of the solution. For exercise, a div with the plus/minus character is prepended to the solution heading cell. For exercise2, a flex-wrap style is added to the solution heading cell and a checkbox widget, with some css styling, is appended to the cell. A solution[.2]_first metadada is also added to enable an easy detection of the first cell in an "exercise" and then allow several consecutive exercises.
.local/share/jupyter/nbextensions/go_to_current_running_cell/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Go to Running Cell
2
+ ==================
3
+
4
+ This is an extension allows you to jump to the current running cell. You can also activate this functionality automatically, i.e., your view is always scolling to the current cell.
5
+
6
+ Button: A button with eye icon that you can go to the first running cell.
7
+ ![button](anchor.png)
8
+
9
+ Keyboard shortcuts:
10
+ -------------------
11
+ __*Alt-I*__ (Jump to first running cell)
12
+ __*Meta-[*__ (Follow executing cell On)
13
+ __*Meta-]*__(Follow executing cell Off)
14
+
15
+ Demo
16
+ ----
17
+ ### Jump to first running cell
18
+ ![button](jump_to_cell.gif)
19
+
20
+ ### Follow executing cell
21
+
22
+ ![button](auto_focus.gif)
.local/share/jupyter/nbextensions/go_to_current_running_cell/go_to_current_running_cell.yaml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Type: Jupyter Notebook Extension
2
+ Name: Go to Current Running Cells
3
+ Description: Go to Running cell and always scroll into current running cell view
4
+ Link: README.md
5
+ Main: main.js
6
+ Compatibility: 4.x, 5.x
7
+
8
+ Parameters:
9
+ - name: is_follow_cell
10
+ description: Activate follow executing cells, default behavior is false.
11
+ input_type: checkbox
12
+ - name: go_to_running_cell_shortcut
13
+ description: Go to first running cell
14
+ input_type: input
15
+ default: Alt-I
16
+ - name: follow_cell_on_shortcut
17
+ description: Enable following running cell
18
+ input_type: input
19
+ default: Alt-;
20
+ - name: follow_cell_off_shortcut
21
+ description: Disable following running cell
22
+ input_type: input
23
+ default: Alt-'
24
+ - name: button_icon
25
+ description: Button for go to first running cell
26
+ default: fa-anchor
.local/share/jupyter/nbextensions/go_to_current_running_cell/jump_to_cell.gif ADDED
.local/share/jupyter/nbextensions/help_panel/help_panel.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Type: IPython Notebook Extension
2
+ Compatibility: 3.x, 4.x, 5.x
3
+ Name: Help panel
4
+ Main: help_panel.js
5
+ Icon: icon.png
6
+ Link: readme.md
7
+ Description: Add a toolbar button to display a help panel showing shortcuts to the right side of the notebook
8
+ Parameters:
9
+ - name: help_panel_add_toolbar_button
10
+ description: add a toolbar button to open the shortcuts dialog/panel
11
+ input_type: checkbox
12
+ default: false
.local/share/jupyter/nbextensions/hide_input_all/hide_input_all_hide.png ADDED
.local/share/jupyter/nbextensions/highlight_selected_word/README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Highlight selected word
2
+ =======================
3
+
4
+ [![Join the chat at https://gitter.im/jcb91/jupyter_highlight_selected_word](https://badges.gitter.im/jcb91/jupyter_highlight_selected_word.svg)](https://gitter.im/jcb91/jupyter_highlight_selected_word?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
+ [![GitHub issues](https://img.shields.io/github/issues/jcb91/jupyter_highlight_selected_word.svg?maxAge=3600)](https://github.com/jcb91/jupyter_highlight_selected_word/issues)
6
+
7
+
8
+ This nbextension highlights all instances of the selected word in either the
9
+ current cell's editor, or in all cells in the notebook.
10
+ It is based on the CodeMirror addon
11
+ [Match Highlighter](https://codemirror.net/demo/matchhighlighter.html),
12
+ but now uses its own codebase in order to permit matching across multiple
13
+ editors.
14
+
15
+ There are a few configurable [options](#Options), all of which sit under the
16
+ config key `highlight_selected_word` in the `notebook` config section.
17
+
18
+
19
+ Options
20
+ -------
21
+
22
+ Options are stored in the notebook section of the nbconfig.
23
+ The easiest way to configure these is using the
24
+ [jupyter_nbextensions_configurator](https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator)
25
+ serverextension, but you can also configure them directly with a few lines of
26
+ python.
27
+
28
+ The available options are:
29
+
30
+ * `highlight_selected_word.highlight_across_all_cells` - if `true`, (default)
31
+ highlight matches across all cells. If `false`, only matches within the
32
+ currently selected cell will be highlighted.
33
+
34
+ * `highlight_selected_word.code_cells_only` - Only apply highlights to editors
35
+ for Code cells, not, for example, Markdown or Raw cells
36
+
37
+ * `highlight_selected_word.highlight_color` - Color used to highlight matching
38
+ words in the focused (active) cell
39
+
40
+ * `highlight_selected_word.highlight_color_blurred` - Color used to highlight
41
+ matching words in blurred (non-active) cells
42
+
43
+ * `highlight_selected_word.outlines_only` - Highlight words using just an
44
+ outline, rather than the background color. In contrast to the default
45
+ background-color highlight, the outline-only is also applied to the
46
+ currently-selected word
47
+
48
+ * `highlight_selected_word.outline_width` - Width, in pixels, of the outline
49
+ used to highlight words when the outline-only setting (above) is selected.
50
+ Defaults to 1.
51
+
52
+ * `highlight_selected_word.delay` - Wait time (in milliseconds) before
53
+ highlighting the matches
54
+
55
+ * `highlight_selected_word.words_only` - If true, only highlight matches if the
56
+ selected text is a word
57
+
58
+ * `highlight_selected_word.highlight_only_whole_words` - Only highlight matches
59
+ which are surrounded by non-word characters. This will use the token
60
+ `highlight_selected_word.show_token` to identify word characters, if it's
61
+ set, otherwise the regular expression `[\w$]` will be used.
62
+
63
+ * `highlight_selected_word.show_token` - Token (regex) to identify word
64
+ characters, used to determine what to highlight when nothing is selected.
65
+ If blank, nothing is highlighted when nothing is selected.
66
+ This regex is also used to determine word boundaries for
67
+ `highlight_selected_word.highlight_only_whole_words`.
68
+
69
+ * `highlight_selected_word.min_chars` - Minimum number of characters that must
70
+ be selected for the highlighting behavior to occur
71
+
72
+ * `highlight_selected_word.use_toggle_hotkey` - Bind the
73
+ `highlight_selected_word.toggle` action to a hotkey. Defaults to `false`.
74
+
75
+ * `highlight_selected_word.toggle_hotkey` - Which hotkey to bind to the
76
+ `highlight_selected_word.toggle` action (if set to use, see item above).
77
+ Defaults to `alt-h`
78
+
79
+ * `highlight_selected_word.only_cells_in_scroll` - Only apply highlights to
80
+ editors which are visible in the scrolled view. This may offer performance
81
+ benefits for larger notebooks, but may be annoying if you're doing a lot of
82
+ scrolling :/
83
+
84
+ * `highlight_selected_word.scroll_min_delay` - Minimum delay in ms between
85
+ updating highlights on scrolling the notebook (used only if
86
+ `highlight_selected_word.only_cells_in_scroll` is `true`).
87
+ If set to zero, no update is done on scroll.
88
+
89
+ * `highlight_selected_word.hide_selections_in_unfocussed` - Hide any text
90
+ selection in non-focussed cells. Otherwise, each cell can show a text
91
+ selection even when its editor is not focussed, which can be confused with
92
+ match highlights.
93
+
94
+ For example, to set the delay to half a second, and limit highlighting to code
95
+ cells, we can use the following python snippet:
96
+
97
+ ```python
98
+ from notebook.services.config import ConfigManager
99
+ cm = ConfigManager()
100
+ cm.update('notebook', {'highlight_selected_word': {
101
+ 'delay': 500,
102
+ 'code_cells_only': True,
103
+ }})
104
+ ```
105
+
106
+
107
+ Feedback
108
+ --------
109
+
110
+ If you have any feedback, or have any problems, please let me know by
111
+ [opening an issue](https://github.com/jcb91/jupyter_highlight_selected_word/issues/new)
112
+ at the project's
113
+ [github repository](https://github.com/jcb91/jupyter_highlight_selected_word).
114
+
115
+ Thanks!
116
+
117
+ Josh.
.local/share/jupyter/nbextensions/highlight_selected_word/main.js ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Enable highlighting of matching words in cells' CodeMirror editors.
3
+ *
4
+ * This extension was adapted from the CodeMirror addon
5
+ * codemirror/addon/search/match-highlighter.js
6
+ */
7
+
8
+ define([
9
+ 'require',
10
+ 'jquery',
11
+ 'base/js/namespace',
12
+ 'notebook/js/cell',
13
+ 'notebook/js/codecell',
14
+ 'codemirror/lib/codemirror',
15
+ // The mark-selection addon is need to ensure that the highlighting styles
16
+ // are *not* applied to the actual selection, as otherwise it can become
17
+ // difficult to see which is selected vs just highlighted.
18
+ 'codemirror/addon/selection/mark-selection'
19
+ ], function (
20
+ requirejs,
21
+ $,
22
+ Jupyter,
23
+ cell,
24
+ codecell,
25
+ CodeMirror
26
+ ) {
27
+ 'use strict';
28
+
29
+ var Cell = cell.Cell;
30
+ var CodeCell = codecell.CodeCell;
31
+
32
+ var mod_name = 'highlight_selected_word';
33
+ var log_prefix = '[' + mod_name + ']';
34
+ var menu_toggle_class = 'highlight_selected_word_toggle';
35
+
36
+ // Parameters (potentially) stored in server config.
37
+ // This object gets updated on config load.
38
+ var params = {
39
+ highlight_across_all_cells: true,
40
+ enable_on_load : true,
41
+ code_cells_only: false,
42
+ delay: 100,
43
+ words_only: false,
44
+ highlight_only_whole_words: true,
45
+ min_chars: 2,
46
+ show_token: '[\\w$]',
47
+ highlight_color: '#90EE90',
48
+ highlight_color_blurred: '#BBFFBB',
49
+ highlight_style: 'matchhighlight',
50
+ trim: true,
51
+ use_toggle_hotkey: false,
52
+ toggle_hotkey: 'alt-h',
53
+ outlines_only: false,
54
+ outline_width: 2,
55
+ only_cells_in_scroll: true,
56
+ scroll_min_delay: 100,
57
+ hide_selections_in_unfocussed: false,
58
+ };
59
+
60
+ // these are set on registering the action(s)
61
+ var action_names = {
62
+ toggle: '',
63
+ };
64
+
65
+ /**
66
+ * the codemirror matchHighlighter has a separate state object for each cm
67
+ * instance, but since our state is global over all cells' editors, we can
68
+ * use a single object for simplicity, and don't need to store options
69
+ * inside the state, since we have closure-level access to the params
70
+ * object above.
71
+ */
72
+ var globalState = {
73
+ active: false,
74
+ timeout: null, // only want one timeout
75
+ scrollTimeout: null,
76
+ overlay: null, // one overlay suffices, as all cells use the same one
77
+ };
78
+
79
+ // define a CodeMirror option for highlighting matches in all cells
80
+ CodeMirror.defineOption("highlightSelectionMatchesInJupyterCells", false, function (cm, val, old) {
81
+ if (old && old != CodeMirror.Init) {
82
+ globalState.active = false;
83
+ // remove from all relevant, this can fail gracefully if not present
84
+ get_relevant_cells().forEach(function (cell, idx, array) {
85
+ cell.code_mirror.removeOverlay(mod_name);
86
+ });
87
+ globalState.overlay = null;
88
+ clearTimeout(globalState.timeout);
89
+ globalState.timeout = null;
90
+ cm.off("cursorActivity", callbackCursorActivity);
91
+ cm.off("focus", callbackOnFocus);
92
+ }
93
+ if (val) {
94
+ if (cm.hasFocus()) {
95
+ globalState.active = true;
96
+ highlightMatchesInAllRelevantCells(cm);
97
+ }
98
+ else {
99
+ cm.on("focus", callbackOnFocus);
100
+ }
101
+ cm.on("cursorActivity", callbackCursorActivity);
102
+ }
103
+ });
104
+
105
+ /**
106
+ * The functions callbackCursorActivity, callbackOnFocus and
107
+ * scheduleHighlight are taken without major modification from cm's
108
+ * match-highlighter.
109
+ * The main difference is using our global state rather than
110
+ * match-highlighter's per-cm state, and a different highlighting function
111
+ * is scheduled.
112
+ */
113
+ function callbackCursorActivity (cm) {
114
+ if (globalState.active || cm.hasFocus()) {
115
+ scheduleHighlight(cm);
116
+ }
117
+ }
118
+
119
+ function callbackOnFocus (cm) {
120
+ // unlike cm match-highlighter, we *do* want to schedule a highight on
121
+ // focussing the editor
122
+ globalState.active = true;
123
+ scheduleHighlight(cm);
124
+ }
125
+
126
+ function scheduleHighlight (cm) {
127
+ clearTimeout(globalState.timeout);
128
+ globalState.timeout = setTimeout(function () { highlightMatchesInAllRelevantCells(cm); }, params.delay);
129
+ }
130
+
131
+ /**
132
+ * Adapted from cm match-highlighter's highlightMatches, but adapted to
133
+ * use our global state and parameters, plus work either for only the
134
+ * current editor, or multiple cells' editors.
135
+ */
136
+ function highlightMatchesInAllRelevantCells (cm) {
137
+ var newOverlay = null;
138
+
139
+ var re = params.show_token === true ? /[\w$]/ : params.show_token;
140
+ var from = cm.getCursor('from');
141
+ if (!cm.somethingSelected() && params.show_token) {
142
+ var line = cm.getLine(from.line), start = from.ch, end = start;
143
+ while (start && re.test(line.charAt(start - 1))) {
144
+ --start;
145
+ }
146
+ while (end < line.length && re.test(line.charAt(end))) {
147
+ ++end;
148
+ }
149
+ if (start < end) {
150
+ newOverlay = makeOverlay(line.slice(start, end), re, params.highlight_style);
151
+ }
152
+ }
153
+ else {
154
+ var to = cm.getCursor("to");
155
+ if (from.line == to.line) {
156
+ if (!params.words_only || isWord(cm, from, to)) {
157
+ var selection = cm.getRange(from, to);
158
+ if (params.trim) {
159
+ selection = selection.replace(/^\s+|\s+$/g, "");
160
+ }
161
+ if (selection.length >= params.min_chars) {
162
+ var hasBoundary = params.highlight_only_whole_words ? (re instanceof RegExp ? re : /[\w$]/) : false;
163
+ newOverlay = makeOverlay(selection, hasBoundary, params.highlight_style);
164
+ }
165
+ }
166
+ }
167
+ }
168
+
169
+ var siterect = document.getElementById('site').getBoundingClientRect();
170
+ var viewtop = siterect.top, viewbot = siterect.bottom;
171
+ var cells = params.highlight_across_all_cells ? get_relevant_cells() : [
172
+ $(cm.getWrapperElement()).closest('.cell').data('cell')
173
+ ];
174
+ cells.forEach(function (cell, idx, array) {
175
+ // cm.operation to delay updating DOM until all work is done
176
+ cell.code_mirror.operation(function () {
177
+ cell.code_mirror.removeOverlay(mod_name);
178
+ if (newOverlay && is_in_view(cell.element[0], viewtop, viewbot)) {
179
+ cell.code_mirror.addOverlay(newOverlay);
180
+ }
181
+ });
182
+ });
183
+ }
184
+
185
+ /**
186
+ * isWord, boundariesAround and makeOverlay come pretty much directly from
187
+ * Codemirror/addon/search/matchHighlighter
188
+ * since they don't use state or config values.
189
+ */
190
+ function isWord (cm, from, to) {
191
+ var str = cm.getRange(from, to);
192
+ if (str.match(/^\w+$/) !== null) {
193
+ var pos, chr;
194
+ if (from.ch > 0) {
195
+ pos = {line: from.line, ch: from.ch - 1};
196
+ chr = cm.getRange(pos, from);
197
+ if (chr.match(/\W/) === null) {
198
+ return false;
199
+ }
200
+ }
201
+ if (to.ch < cm.getLine(from.line).length) {
202
+ pos = {line: to.line, ch: to.ch + 1};
203
+ chr = cm.getRange(to, pos);
204
+ if (chr.match(/\W/) === null) {
205
+ return false;
206
+ }
207
+ }
208
+ return true;
209
+ }
210
+ return false;
211
+ }
212
+ function boundariesAround (stream, re) {
213
+ return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) &&
214
+ (stream.pos == stream.string.length || !re.test(stream.string.charAt(stream.pos)));
215
+ }
216
+ function makeOverlay (query, hasBoundary, style) {
217
+ return {
218
+ name: mod_name,
219
+ token: function (stream) {
220
+ if (stream.match(query) &&
221
+ (!hasBoundary || boundariesAround(stream, hasBoundary))) {
222
+ return style;
223
+ }
224
+ stream.next();
225
+ if (!stream.skipTo(query.charAt(0))) {
226
+ stream.skipToEnd();
227
+ }
228
+ }
229
+ };
230
+ }
231
+
232
+ /**
233
+ * Returns true if part of elem is visible between viewtop & viewbot
234
+ */
235
+ var is_in_view = function (elem, viewtop, viewbot) {
236
+ var rect = elem.getBoundingClientRect();
237
+ // hidden elements show height 0
238
+ return (rect.top < viewbot) && (rect.bottom > viewtop) && rect.height;
239
+ }
240
+
241
+ /**
242
+ * Return an array of cells to which match highlighting is relevant,
243
+ * dependent on the code_cells_only parameter
244
+ */
245
+ function get_relevant_cells () {
246
+ var cells = Jupyter.notebook.get_cells();
247
+ return params.code_cells_only ? cells.filter(function (c) { return (c instanceof CodeCell); }) : cells;
248
+ }
249
+
250
+ function add_menu_item () {
251
+ if ($('#view_menu').find('.' + menu_toggle_class).length < 1) {
252
+ var menu_item = $('<li/>')
253
+ .appendTo('#view_menu');
254
+ var menu_link = $('<a/>')
255
+ .text('Highlight selected word')
256
+ .addClass(menu_toggle_class)
257
+ .attr({
258
+ title: 'Highlight all instances of the selected word in the current editor',
259
+ href: '#',
260
+ })
261
+ .on('click', function () { toggle_highlight_selected(); })
262
+ .appendTo(menu_item);
263
+ $('<i/>')
264
+ .addClass('fa menu-icon pull-right')
265
+ .css({'margin-top': '-2px', 'margin-right': '-16px'})
266
+ .prependTo(menu_link);
267
+ }
268
+ }
269
+
270
+ var throttled_highlight = (function () {
271
+ var last, throttle_timeout;
272
+ return function throttled_highlight (cm) {
273
+ var now = Number(new Date());
274
+ var do_it = function () {
275
+ last = Number(new Date());
276
+ highlightMatchesInAllRelevantCells(cm);
277
+ };
278
+ var remaining = last + params.scroll_min_delay - now;
279
+ if (last && remaining > 0) {
280
+ clearTimeout(throttle_timeout);
281
+ throttle_timeout = setTimeout(do_it, remaining);
282
+ }
283
+ else {
284
+ last = undefined; // so we will do it first time next streak
285
+ do_it();
286
+ }
287
+ }
288
+ })();
289
+
290
+ function scroll_handler (evt) {
291
+ if (globalState.active && Jupyter.notebook.mode === 'edit' && globalState.overlay) {
292
+ // add overlay to cells now in view which don't already have it.
293
+ // Don't bother removing from those no longer in view, as it would just
294
+ // cause more work for the browser, without any benefit
295
+ var siterect = document.getElementById('site').getBoundingClientRect();
296
+ get_relevant_cells().forEach(function (cell) {
297
+ var cm = cell.code_mirror;
298
+ if (is_in_view(cell.element, siterect.top, siterect.bot)) {
299
+ var need_it = !cm.state.overlays.some(function(ovr) {
300
+ return ovr.modeSpec.name === mod_name; });
301
+ if (need_it) cm.addOverlay(globalState.overlay);
302
+ }
303
+ });
304
+ }
305
+ }
306
+
307
+ function toggle_highlight_selected (set_on) {
308
+ set_on = (set_on !== undefined) ? set_on : !params.enable_on_load;
309
+ // update config to make changes persistent
310
+ if (set_on !== params.enable_on_load) {
311
+ params.enable_on_load = set_on;
312
+ Jupyter.notebook.config.update({highlight_selected_word: {enable_on_load: set_on}});
313
+ }
314
+
315
+ // Change defaults for new cells:
316
+ var cm_conf = (params.code_cells_only ? CodeCell : Cell).options_default.cm_config;
317
+ cm_conf.highlightSelectionMatchesInJupyterCells = cm_conf.styleSelectedText = set_on;
318
+
319
+ // And change any existing cells:
320
+ get_relevant_cells().forEach(function (cell, idx, array) {
321
+ cell.code_mirror.setOption('highlightSelectionMatchesInJupyterCells', set_on);
322
+ cell.code_mirror.setOption('styleSelectedText', set_on);
323
+ });
324
+ // update menu class
325
+ $('.' + menu_toggle_class + ' > .fa').toggleClass('fa-check', set_on);
326
+ // bind/unbind scroll handler
327
+ $('#site')[
328
+ (params.only_cells_in_scroll && params.scroll_min_delay > 0) ? 'on' : 'off'
329
+ ]('scroll', scroll_handler);
330
+ console.log(log_prefix, 'toggled', set_on ? 'on' : 'off');
331
+ return set_on;
332
+ }
333
+
334
+ function register_new_actions () {
335
+ action_names.toggle = Jupyter.keyboard_manager.actions.register({
336
+ handler : function (env) { toggle_highlight_selected(); },
337
+ help : "Toggle highlighting of selected word",
338
+ icon : 'fa-language',
339
+ help_index: 'c1'
340
+ }, 'toggle', mod_name);
341
+ }
342
+
343
+ function bind_hotkeys () {
344
+ if (params.use_toggle_hotkey && params.toggle_hotkey) {
345
+ Jupyter.keyboard_manager.command_shortcuts.add_shortcut(params.toggle_hotkey, action_names.toggle);
346
+ Jupyter.keyboard_manager.edit_shortcuts.add_shortcut(params.toggle_hotkey, action_names.toggle);
347
+ }
348
+ }
349
+
350
+ function insert_css () {
351
+ var css = [// in unselected cells, matches have blurred color
352
+ // in selected cells, we keep CodeMirror highlight for the actual selection to avoid confusion
353
+ '.edit_mode .unselected .CodeMirror .cm-matchhighlight {',
354
+ ' background-color: ' + params.highlight_color_blurred + ';',
355
+ '}',
356
+
357
+ // in active cell, matches which are not the current selection have focussed color
358
+ '.edit_mode .CodeMirror.CodeMirror-focused :not(.CodeMirror-selectedtext).cm-matchhighlight {',
359
+ ' background-color: ' + params.highlight_color + ';',
360
+ '}',
361
+
362
+ // in all cells, outline matches have blurred color
363
+ '.edit_mode .CodeMirror .cm-matchhighlight-outline {',
364
+ ' outline-style: solid;',
365
+ ' outline-width: ' + params.outline_width + 'px;',
366
+ ' outline-color: ' + params.highlight_color_blurred + ';',
367
+ '}',
368
+
369
+ // in active cell, outline matches have focussed color
370
+ '.edit_mode .CodeMirror.CodeMirror-focused .cm-matchhighlight-outline {',
371
+ ' outline-color: ' + params.highlight_color + ';',
372
+ '}'
373
+ ].join('\n');
374
+
375
+ if (params.hide_selections_in_unfocussed) {
376
+ css += [
377
+ // in unselected cells, selections which are not matches should have no background
378
+ '.unselected .CodeMirror :not(.cm-matchhighlight).CodeMirror-selected,',
379
+ '.unselected .CodeMirror :not(.cm-matchhighlight).CodeMirror-selectedtext {',
380
+ ' background: initial;',
381
+ '}',
382
+ ].join('\n');
383
+ }
384
+
385
+ $('<style type="text/css" id="highlight_selected_word_css">').appendTo('head').html(css);
386
+ }
387
+
388
+ function load_extension () {
389
+ // add menu item, as we need it to exist for later
390
+ // toggle_highlight_selected call to set its icon status
391
+ add_menu_item();
392
+
393
+ // load config & toggle on/off
394
+ Jupyter.notebook.config.loaded
395
+ .then(function () {
396
+ $.extend(true, params, Jupyter.notebook.config.data.highlight_selected_word);
397
+ }, function on_error (reason) {
398
+ console.warn(log_prefix, 'error loading config:', reason);
399
+ })
400
+ .then(insert_css)
401
+ .then(function () {
402
+ params.show_token = params.show_token ? new RegExp(params.show_token) : false;
403
+ if (params.outlines_only) {
404
+ params.highlight_style += '-outline'
405
+ }
406
+ // set highlight on/off
407
+ toggle_highlight_selected(params.enable_on_load);
408
+
409
+ register_new_actions();
410
+ bind_hotkeys();
411
+ })
412
+ // finally log any error we encountered
413
+ .catch(function on_error (reason) { console.warn(log_prefix, 'error loading:', reason); });
414
+ }
415
+
416
+ return {
417
+ load_ipython_extension : load_extension
418
+ };
419
+ });
.local/share/jupyter/nbextensions/highlighter/demo_highlighter.html ADDED
The diff for this file is too large to render. See raw diff
 
.local/share/jupyter/nbextensions/highlighter/export_highlights.html ADDED
The diff for this file is too large to render. See raw diff
 
.local/share/jupyter/nbextensions/highlighter/export_highlights.ipynb ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Exporting the notebook\n",
8
+ "\n",
9
+ "As suggested by @juhasch, it is interesting to keep the highlights when exporting the notebook to another format. We give and explain below some possibilities:"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "markdown",
14
+ "metadata": {},
15
+ "source": [
16
+ "## Short version\n",
17
+ "- Html export:\n",
18
+ "```bash\n",
19
+ " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_html_cfg.py \n",
20
+ "```\n",
21
+ "- LaTeX export:\n",
22
+ "```bash\n",
23
+ " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_latex_cfg.py \n",
24
+ "```\n",
25
+ "where JUPYTER_DATA_DIR can be found from the output of\n",
26
+ "```bash\n",
27
+ " jupyter --paths\n",
28
+ "```\n",
29
+ "eg `~/.local/share/jupyter` in my case. Seems to be `c:\\users\\NAME\\AppData\\Roaming\\jupyter` under Windows. \n",
30
+ "\n",
31
+ "Examples can be found here: [initial notebook](tst_highlights.ipynb), [html version](tst_highlights.html), [pdf version](tst_highlights.pdf) (after an additional LaTeX $\\rightarrow$ pdf compilation). "
32
+ ]
33
+ },
34
+ {
35
+ "cell_type": "markdown",
36
+ "metadata": {},
37
+ "source": [
38
+ "## Html export\n",
39
+ "This is quite easy. Actually, highlight formatting embedded in markdown cells is preserved while converting with the standard\n",
40
+ "```bash\n",
41
+ "jupyter nbconvert file.ipynb\n",
42
+ "```\n",
43
+ "\n",
44
+ "However, the css file is missing and must be added. Here we have several possibilities\n",
45
+ "\n",
46
+ "- Embed the css *within* the notebook. For that, consider the last cell of the present notebook. This code reads the css file `highlighter.css` in the extension directory and displays the corresponding style. So doing the `<style> ...</style>` section will be present in the cell output and interpreted by the web browser. Drawbacks of this solution is that user still have to execute this cell and that the this is not language agnostic. \n",
47
+ "- Use a **template file** to link or include the css file during conversion. Such a file is provided as `templates/highlighter.tpl`. It was choosen here to *include* the css content in the produced html file rather than linking it. This avoids the necessity to keep the css file with the html files. \n",
48
+ " - This works directly if the css resides in the same directory as the file the user is attempting to convert --thus requires the user to copy `highlighter.css` in the current directory. Then the conversion is simply \n",
49
+ "```bash\n",
50
+ " jupyter nbconvert file.ipynb --template highlighter\n",
51
+ "```\n",
52
+ "\n",
53
+ "- It still remains two problems with this approach. First, it can be annoying to have to systematically copy the css file in the current directory. Second, the data within the html tags is not converted (and thus markdown remains unmodified). A solution is to use a pair of preprocessor/postprocessor that modify the html tags and enable the subsequent markdown to html converter to operate on the included data. Also, a config file is provided which redefines the template path to enable direct inclusion of the css file in the extension directory. Unfortunately, <span class=\"mark\">it seems that the *full path* to the config file has to be provided</span>. This file resides in the extensions subdirectory of the jupyter_data_dir. The path can be found by looking at the output of\n",
54
+ "```bash\n",
55
+ " jupyter --paths\n",
56
+ "```\n",
57
+ "Then the command to issue for converting the notebook to html is\n",
58
+ "```bash\n",
59
+ " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_html_cfg.py \n",
60
+ "```\n",
61
+ "\n",
62
+ "For instance\n",
63
+ "```bash\n",
64
+ "jupyter nbconvert tst_highlights.ipynb --config ~/.local/share/jupyter/extensions/highlight_html_cfg.py \n",
65
+ "```"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "markdown",
70
+ "metadata": {},
71
+ "source": [
72
+ "## LaTeX export\n",
73
+ "This is a bit more complicated since the direct conversion removes all html formatting present in markdown cells. Thus use again a **preprocessor** which runs before the markdown $\\rightarrow$ LaTeX conversion. In turn, it appears that we also need to postprocess the result. \n",
74
+ "\n",
75
+ "Three LaTeX commands, namely *highlighta, highlightb, highlightc*, and three environments *highlightA, highlightB, highlightC* are defined. Highlighting html markup is then transformed into the corresponding LaTeX commands and the text for completely highlighted cells is put in the adequate LaTeX environment. \n",
76
+ "\n",
77
+ "Pre and PostProcessor classes are defined in the file `pp_highlighter.py` located in the `extensions` directory. A LaTeX template, that includes the necessary packages and the definitions of commands/environments is provides as `highlighter.tplx` in the template directory. \n",
78
+ "The template inherits from `article.ltx`. For more complex scenarios, typically if the latex template file has be customized, the user shall modify its template or inherit from his base template rather than from article. \n",
79
+ "\n",
80
+ "Finally, a config file fixes the different options for the conversion. Then the command to issue is simply \n",
81
+ "```bash\n",
82
+ " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_latex_cfg.py \n",
83
+ "```\n",
84
+ "e.g. \n",
85
+ "```bash\n",
86
+ "jupyter nbconvert tst_highlights.ipynb --config ~/.local/share/jupyter/extensions/highlight_latex_cfg.py \n",
87
+ "```\n"
88
+ ]
89
+ },
90
+ {
91
+ "cell_type": "markdown",
92
+ "metadata": {},
93
+ "source": [
94
+ "## Configuring paths\n",
95
+ "\n",
96
+ "<span class=\"mark\">For those who do not have taken the extension from the `jupyter_contrib_nbextensions` repository or have not configured extensions via its `setup.py` utility,</span> a file `set_paths.py` is present in the extension directory (it is merely a verbatim copy of the relevant parts in setup.py). This file configure the paths to the `templates` and `extension` directories. It should be executed by something like\n",
97
+ "```bash\n",
98
+ "python3 set_paths.py\n",
99
+ "```\n",
100
+ "Additionaly, you may also have to execute `mv_paths.py` if you installed from the original repo via `jupyter nbextension install ..`\n",
101
+ "```bash\n",
102
+ "python3 mv_paths.py\n",
103
+ "```"
104
+ ]
105
+ },
106
+ {
107
+ "cell_type": "markdown",
108
+ "metadata": {},
109
+ "source": [
110
+ "## Example for embedding the css within the notebook before conversion"
111
+ ]
112
+ },
113
+ {
114
+ "cell_type": "code",
115
+ "execution_count": 18,
116
+ "metadata": {
117
+ "collapsed": false
118
+ },
119
+ "outputs": [
120
+ {
121
+ "data": {
122
+ "text/html": [
123
+ "<style>.mark {\n",
124
+ " background-color: yellow;\n",
125
+ " color: red;\n",
126
+ " display:inline-block;\n",
127
+ "}\n",
128
+ "\n",
129
+ ".burk {\n",
130
+ " background-color: red;\n",
131
+ " color: yellow;\n",
132
+ " display:inline-block;\n",
133
+ "}\n",
134
+ "\n",
135
+ ".girk {\n",
136
+ " background-color: lime;\n",
137
+ " color: red;\n",
138
+ " display:inline-block;\n",
139
+ "}\n",
140
+ "\n",
141
+ "\n",
142
+ ".btnw{\n",
143
+ " background-color: white;\n",
144
+ "}\n",
145
+ "\n",
146
+ ".ret {\n",
147
+ " margin-left: -1em;\n",
148
+ "}\n",
149
+ "</style>"
150
+ ],
151
+ "text/plain": [
152
+ "<IPython.core.display.HTML object>"
153
+ ]
154
+ },
155
+ "execution_count": 18,
156
+ "metadata": {},
157
+ "output_type": "execute_result"
158
+ }
159
+ ],
160
+ "source": [
161
+ "from IPython.core.display import display, HTML\n",
162
+ "from jupyter_core.paths import jupyter_config_dir, jupyter_data_dir\n",
163
+ "import os\n",
164
+ "csspath=os.path.join(jupyter_data_dir(),'nbextensions',\n",
165
+ " 'highlighter','highlighter.css')\n",
166
+ "HTML('<style>'+open(csspath, \"r\").read()+'</style>')"
167
+ ]
168
+ }
169
+ ],
170
+ "metadata": {
171
+ "interactive_sols": {
172
+ "cbx_id": 1
173
+ },
174
+ "kernelspec": {
175
+ "display_name": "Python 3",
176
+ "language": "python",
177
+ "name": "python3"
178
+ },
179
+ "language_info": {
180
+ "codemirror_mode": {
181
+ "name": "ipython",
182
+ "version": 3
183
+ },
184
+ "file_extension": ".py",
185
+ "mimetype": "text/x-python",
186
+ "name": "python",
187
+ "nbconvert_exporter": "python",
188
+ "pygments_lexer": "ipython3",
189
+ "version": "3.4.3+"
190
+ },
191
+ },
192
+ "nbformat": 4,
193
+ "nbformat_minor": 0
194
+ }
.local/share/jupyter/nbextensions/highlighter/image.gif ADDED
.local/share/jupyter/nbextensions/highlighter/tst_highlights.html ADDED
The diff for this file is too large to render. See raw diff
 
.local/share/jupyter/nbextensions/highlighter/tst_highlights.pdf ADDED
Binary file (68.6 kB). View file
 
.local/share/jupyter/nbextensions/highlighter/tst_highlights.tex ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Default to the notebook output style
3
+
4
+
5
+ % Inherit from the specified cell style.
6
+
7
+
8
+
9
+
10
+
11
+
12
+ \documentclass{article}
13
+
14
+
15
+
16
+
17
+ \usepackage{graphicx} % Used to insert images
18
+ \usepackage{adjustbox} % Used to constrain images to a maximum size
19
+ \usepackage{color} % Allow colors to be defined
20
+ \usepackage{enumerate} % Needed for markdown enumerations to work
21
+ \usepackage{geometry} % Used to adjust the document margins
22
+ \usepackage{amsmath} % Equations
23
+ \usepackage{amssymb} % Equations
24
+ \usepackage{eurosym} % defines \euro
25
+ \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
26
+ \usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
27
+ \usepackage{fancyvrb} % verbatim replacement that allows latex
28
+ \usepackage{grffile} % extends the file name processing of package graphics
29
+ % to support a larger range
30
+ % The hyperref package gives us a pdf with properly built
31
+ % internal navigation ('pdf bookmarks' for the table of contents,
32
+ % internal cross-reference links, web links for URLs, etc.)
33
+ \usepackage{hyperref}
34
+ \usepackage{longtable} % longtable support required by pandoc >1.10
35
+ \usepackage{booktabs} % table support for pandoc > 1.12.2
36
+
37
+ \usepackage{color}
38
+ \usepackage{soul}
39
+ \usepackage[framemethod=tikz]{mdframed}
40
+
41
+
42
+
43
+
44
+ \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
45
+ \definecolor{darkorange}{rgb}{.71,0.21,0.01}
46
+ \definecolor{darkgreen}{rgb}{.12,.54,.11}
47
+ \definecolor{myteal}{rgb}{.26, .44, .56}
48
+ \definecolor{gray}{gray}{0.45}
49
+ \definecolor{lightgray}{gray}{.95}
50
+ \definecolor{mediumgray}{gray}{.8}
51
+ \definecolor{inputbackground}{rgb}{.95, .95, .85}
52
+ \definecolor{outputbackground}{rgb}{.95, .95, .95}
53
+ \definecolor{traceback}{rgb}{1, .95, .95}
54
+ % ansi colors
55
+ \definecolor{red}{rgb}{.6,0,0}
56
+ \definecolor{green}{rgb}{0,.65,0}
57
+ \definecolor{brown}{rgb}{0.6,0.6,0}
58
+ \definecolor{blue}{rgb}{0,.145,.698}
59
+ \definecolor{purple}{rgb}{.698,.145,.698}
60
+ \definecolor{cyan}{rgb}{0,.698,.698}
61
+ \definecolor{lightgray}{gray}{0.5}
62
+
63
+ % bright ansi colors
64
+ \definecolor{darkgray}{gray}{0.25}
65
+ \definecolor{lightred}{rgb}{1.0,0.39,0.28}
66
+ \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
67
+ \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
68
+ \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
69
+ \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
70
+
71
+ % commands and environments needed by pandoc snippets
72
+ % extracted from the output of `pandoc -s`
73
+ \providecommand{\tightlist}{%
74
+ \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
75
+ \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
76
+ % Add ',fontsize=\small' for more characters per line
77
+ \newenvironment{Shaded}{}{}
78
+ \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
79
+ \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
80
+ \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
81
+ \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
82
+ \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
83
+ \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
84
+ \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
85
+ \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
86
+ \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
87
+ \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
88
+ \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
89
+ \newcommand{\RegionMarkerTok}[1]{{#1}}
90
+ \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
91
+ \newcommand{\NormalTok}[1]{{#1}}
92
+
93
+ % Define a nice break command that doesn't care if a line doesn't already
94
+ % exist.
95
+ \def\br{\hspace*{\fill} \\* }
96
+ % Math Jax compatability definitions
97
+ \def\gt{>}
98
+ \def\lt{<}
99
+ % Document parameters
100
+ \title{tst\_highlights}
101
+
102
+
103
+ \author{}
104
+
105
+
106
+
107
+ % Pygments definitions
108
+
109
+ \makeatletter
110
+ \def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%
111
+ \let\PY@ul=\relax \let\PY@tc=\relax%
112
+ \let\PY@bc=\relax \let\PY@ff=\relax}
113
+ \def\PY@tok#1{\csname PY@tok@#1\endcsname}
114
+ \def\PY@toks#1+{\ifx\relax#1\empty\else%
115
+ \PY@tok{#1}\expandafter\PY@toks\fi}
116
+ \def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%
117
+ \PY@it{\PY@bf{\PY@ff{#1}}}}}}}
118
+ \def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}
119
+
120
+ \expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
121
+ \expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
122
+ \expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
123
+ \expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
124
+ \expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
125
+ \expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
126
+ \expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
127
+ \expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
128
+ \expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
129
+ \expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
130
+ \expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
131
+ \expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
132
+ \expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
133
+ \expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
134
+ \expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
135
+ \expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
136
+ \expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
137
+ \expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
138
+ \expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
139
+ \expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
140
+ \expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit}
141
+ \expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
142
+ \expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
143
+ \expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
144
+ \expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
145
+ \expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
146
+ \expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
147
+ \expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
148
+ \expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf}
149
+ \expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
150
+ \expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
151
+ \expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
152
+ \expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
153
+ \expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
154
+ \expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
155
+ \expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
156
+ \expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
157
+ \expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
158
+ \expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
159
+ \expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
160
+ \expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
161
+ \expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
162
+ \expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
163
+ \expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}
164
+ \expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
165
+ \expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
166
+ \expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
167
+ \expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
168
+ \expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
169
+ \expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
170
+ \expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
171
+ \expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
172
+ \expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
173
+ \expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
174
+ \expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
175
+ \expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
176
+ \expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
177
+ \expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
178
+ \expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
179
+ \expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
180
+ \expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
181
+
182
+ \def\PYZbs{\char`\\}
183
+ \def\PYZus{\char`\_}
184
+ \def\PYZob{\char`\{}
185
+ \def\PYZcb{\char`\}}
186
+ \def\PYZca{\char`\^}
187
+ \def\PYZam{\char`\&}
188
+ \def\PYZlt{\char`\<}
189
+ \def\PYZgt{\char`\>}
190
+ \def\PYZsh{\char`\#}
191
+ \def\PYZpc{\char`\%}
192
+ \def\PYZdl{\char`\$}
193
+ \def\PYZhy{\char`\-}
194
+ \def\PYZsq{\char`\'}
195
+ \def\PYZdq{\char`\"}
196
+ \def\PYZti{\char`\~}
197
+ % for compatibility with earlier versions
198
+ \def\PYZat{@}
199
+ \def\PYZlb{[}
200
+ \def\PYZrb{]}
201
+ \makeatother
202
+
203
+
204
+
205
+
206
+
207
+
208
+ % Prevent overflowing lines due to hard-to-break entities
209
+ \sloppy
210
+ % Setup hyperref package
211
+ \hypersetup{
212
+ breaklinks=true, % so long urls are correctly broken across lines
213
+ colorlinks=true,
214
+ urlcolor=blue,
215
+ linkcolor=darkorange,
216
+ citecolor=darkgreen,
217
+ }
218
+ % Slightly bigger margins than the latex defaults
219
+
220
+ \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
221
+
222
+
223
+ \newcommand{\highlighta}[1]{{\sethlcolor{yellow} \textcolor{red}{\hl{#1}}}}
224
+ \newcommand{\highlightb}[1]{{\sethlcolor{red} \textcolor{yellow}{\hl{#1}}}}
225
+ \newcommand{\highlightc}[1]{{\sethlcolor{green} \textcolor{yellow}{\hl{#1}}}}
226
+ \newenvironment{highlightA}{\begin{mdframed}[hidealllines=true,backgroundcolor=yellow!20]}{\end{mdframed}}
227
+ \newenvironment{highlightB}{\begin{mdframed}[hidealllines=true,backgroundcolor=red!20]}{\end{mdframed}}
228
+ \newenvironment{highlightC}{\begin{mdframed}[hidealllines=true,backgroundcolor=green!20]}{\end{mdframed}}
229
+
230
+
231
+ %\usepackage{foo}
232
+
233
+ \begin{document}
234
+
235
+
236
+ \maketitle
237
+
238
+
239
+
240
+
241
+ \section{First cell}\label{first-cell}
242
+
243
+ \highlighta{In the first cell, we highlight \emph{some words}
244
+ using the different schemes provided.}
245
+
246
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id
247
+ lacus mauris. Etiam in dictum mauris. \highlightb{Morbi pharetra,
248
+ \textbf{mauris a feugiat consequat}, est purus vulputate mauris, quis
249
+ feugiat leo metus eu risus. Sed non luctus arcu.} Donec eu ipsum
250
+ justo. Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar
251
+ blandit in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at
252
+ vestibulum congue, lacus ante faucibus dolor, quis varius elit felis id
253
+ ipsum. \highlightc{Vivamus at mi lorem.} Integer quam massa,
254
+ viverra et fermentum et, cursus faucibus nisl. Vestibulum sed est lacus.
255
+ Morbi sit amet laoreet odio.
256
+
257
+ \begin{highlightA}
258
+
259
+ \section{Second cell}\label{second-cell}
260
+
261
+ The second cell is completely highlighted.
262
+
263
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id
264
+ lacus mauris. Etiam in dictum mauris. Morbi pharetra, mauris a feugiat
265
+ consequat, \highlightb{est purus vulputate mauris,} quis
266
+ feugiat leo metus eu risus. Sed non luctus arcu. Donec eu ipsum justo.
267
+ Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar blandit
268
+ in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at vestibulum
269
+ congue, \highlightc{lacus ante faucibus dolor}, quis varius
270
+ elit felis id ipsum. Vivamus at mi lorem. Integer quam massa, viverra et
271
+ fermentum et, cursus faucibus nisl. Vestibulum sed est lacus. Morbi sit
272
+ amet laoreet odio. \end{highlightA}
273
+
274
+
275
+ % Add a bibliography block to the postdoc
276
+
277
+
278
+
279
+ \end{document}
.local/share/jupyter/nbextensions/hinterland/hinterland.js ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ define([
2
+ 'module',
3
+ 'jquery',
4
+ 'base/js/namespace',
5
+ 'base/js/keyboard',
6
+ 'notebook/js/cell',
7
+ 'notebook/js/codecell',
8
+ 'notebook/js/completer',
9
+ ], function (
10
+ module,
11
+ $,
12
+ Jupyter,
13
+ keyboard,
14
+ cell,
15
+ codecell,
16
+ completer
17
+ ) {
18
+ 'use strict';
19
+
20
+ var Cell = cell.Cell;
21
+ var CodeCell = codecell.CodeCell;
22
+ var Completer = completer.Completer;
23
+
24
+ var log_prefix = '[' + module.id + ']';
25
+
26
+ // default config (updated on nbextension load)
27
+ var config = {
28
+ enable_at_start: true,
29
+ exclude_regexp: ':',
30
+ include_regexp: '',
31
+ tooltip_regexp: '\\(',
32
+ hint_delay: 20,
33
+ hint_inside_comments: false,
34
+ };
35
+ // flag denoting whether hinting is enabled
36
+ var do_hinting;
37
+
38
+ // ignore most specially-named keys
39
+ var specials = [
40
+ keyboard.keycodes.enter,
41
+ keyboard.keycodes.esc,
42
+ keyboard.keycodes.backspace,
43
+ keyboard.keycodes.tab,
44
+ keyboard.keycodes.up,
45
+ keyboard.keycodes.down,
46
+ keyboard.keycodes.left,
47
+ keyboard.keycodes.right,
48
+ keyboard.keycodes.shift,
49
+ keyboard.keycodes.ctrl,
50
+ keyboard.keycodes.alt,
51
+ keyboard.keycodes.meta,
52
+ keyboard.keycodes.capslock,
53
+ keyboard.keycodes.space,
54
+ keyboard.keycodes.pageup,
55
+ keyboard.keycodes.pagedown,
56
+ keyboard.keycodes.end,
57
+ keyboard.keycodes.home,
58
+ keyboard.keycodes.insert,
59
+ keyboard.keycodes.delete,
60
+ keyboard.keycodes.numlock,
61
+ keyboard.keycodes.f1,
62
+ keyboard.keycodes.f2,
63
+ keyboard.keycodes.f3,
64
+ keyboard.keycodes.f4,
65
+ keyboard.keycodes.f5,
66
+ keyboard.keycodes.f6,
67
+ keyboard.keycodes.f7,
68
+ keyboard.keycodes.f8,
69
+ keyboard.keycodes.f9,
70
+ keyboard.keycodes.f10,
71
+ keyboard.keycodes.f11,
72
+ keyboard.keycodes.f12,
73
+ keyboard.keycodes.f13,
74
+ keyboard.keycodes.f14,
75
+ keyboard.keycodes.f15
76
+ ];
77
+
78
+ /**
79
+ * copied from base/js/keyboard, since it isn't exported
80
+ * Return `true` if the event only contains modifiers keys.
81
+ * false otherwise
82
+ **/
83
+ function only_modifier_event (event) {
84
+ var key = keyboard.inv_keycodes[event.which];
85
+ return (
86
+ (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) &&
87
+ (key === 'alt'|| key === 'ctrl'|| key === 'meta'|| key === 'shift')
88
+ );
89
+ }
90
+
91
+ function patch_cell_keyevent () {
92
+ console.log(log_prefix, 'patching Cell.prototype.handle_codemirror_keyevent');
93
+ var orig_handle_codemirror_keyevent = Cell.prototype.handle_codemirror_keyevent;
94
+ Cell.prototype.handle_codemirror_keyevent = function (editor, event) {
95
+ if (do_hinting && (this instanceof CodeCell) && !only_modifier_event(event)) {
96
+ // Tab completion.
97
+ this.tooltip.remove_and_cancel_tooltip();
98
+ // don't attempt completion when selecting, or when using multicursor
99
+ if ( !editor.somethingSelected() &&
100
+ editor.getSelections().length <= 1 &&
101
+ !this.completer.visible &&
102
+ specials.indexOf(event.keyCode) == -1) {
103
+ var cell = this;
104
+ // set a timeout to try to ensure that CodeMirror inserts
105
+ // the new key *before* the completion request happens
106
+ setTimeout(function () {
107
+ var cur = editor.getCursor();
108
+ var pre_cursor = editor.getRange({
109
+ line: cur.line,
110
+ ch: cur.ch - 1
111
+ }, cur);
112
+ if ( pre_cursor !== '' &&
113
+ (config.hint_inside_comments || editor.getTokenAt(cur).type !== "comment") &&
114
+ (config.include_regexp.test(pre_cursor) || config.tooltip_regexp.test(pre_cursor)) &&
115
+ !config.exclude_regexp.test(pre_cursor) ) {
116
+ if (config.tooltip_regexp.test(pre_cursor)) {
117
+ cell.tooltip.request(cell);
118
+ }
119
+ else {
120
+ cell.completer.startCompletion();
121
+ cell.completer.autopick = false;
122
+ }
123
+ }
124
+ }, config.hint_delay);
125
+ }
126
+ }
127
+ return orig_handle_codemirror_keyevent.apply(this, arguments);
128
+ };
129
+ }
130
+
131
+ function set_hinterland_state (new_state) {
132
+ do_hinting = new_state;
133
+ $('.hinterland-toggle > .fa')
134
+ .toggleClass('fa-check', do_hinting);
135
+ console.log(log_prefix, 'continuous hinting', do_hinting ? 'on' : 'off');
136
+ }
137
+
138
+ function toggle_hinterland () {
139
+ set_hinterland_state(!do_hinting);
140
+ }
141
+
142
+ function add_menu_item () {
143
+ if ($('#help_menu').find('.hinterland_toggle').length > 0) {
144
+ return;
145
+ }
146
+ var menu_item = $('<li/>')
147
+ .insertAfter('#keyboard_shortcuts');
148
+ var menu_link = $('<a/>')
149
+ .text('Continuous hints')
150
+ .addClass('hinterland-toggle')
151
+ .attr('title', 'Provide continuous code hints')
152
+ .on('click', toggle_hinterland)
153
+ .appendTo(menu_item);
154
+ $('<i/>')
155
+ .addClass('fa menu-icon pull-right')
156
+ .prependTo(menu_link);
157
+ }
158
+
159
+ function load_notebook_extension () {
160
+
161
+ Jupyter.notebook.config.loaded.then(function on_success () {
162
+ $.extend(true, config, Jupyter.notebook.config.data.hinterland);
163
+ // special defaults:
164
+ // default include is taken from Completer, rather than the blank
165
+ if (config.include_regexp === '') {
166
+ config.include_regexp = Completer.reinvoke_re;
167
+ }
168
+ // now turn regexps loaded from config (which will be strings) into
169
+ // actual RegExp objects.
170
+ var regexp_names = ['exclude_regexp', 'include_regexp', 'tooltip_regexp'];
171
+ for (var ii=0; ii < regexp_names.length; ii++) {
172
+ if (config[regexp_names[ii]] === '') {
173
+ continue;
174
+ }
175
+ try {
176
+ config[regexp_names[ii]] = new RegExp(config[regexp_names[ii]]);
177
+ }
178
+ catch (err) {
179
+ console.warn(log_prefix, 'error parsing', regexp_names[ii] + ':', err);
180
+ }
181
+ }
182
+ }, function on_error (err) {
183
+ console.warn(log_prefix, 'error loading config:', err);
184
+ }).then(function on_success () {
185
+ patch_cell_keyevent();
186
+ add_menu_item();
187
+ set_hinterland_state(config.enable_at_start);
188
+ });
189
+ }
190
+
191
+ return {
192
+ load_ipython_extension : load_notebook_extension
193
+ };
194
+ });
.local/share/jupyter/nbextensions/keyboard_shortcut_editor/readme_add_new_select_action.png ADDED
.local/share/jupyter/nbextensions/keyboard_shortcut_editor/readme_shortcut_editor_blank.png ADDED
.local/share/jupyter/nbextensions/livemdpreview/livemdpreview.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Type: Jupyter Notebook Extension
2
+ Compatibility: 4.x, 5.x
3
+ Name: Live Markdown Preview
4
+ Main: livemdpreview.js
5
+ Description: |
6
+ Live-preview the rendered output of markdown cells while editing their source.
7
+ Parameters:
8
+
9
+ - name: livemdpreview.show_side_by_side
10
+ description: |
11
+ Show the input & output of markdown cells side-by-side while editing them.
12
+ Otherwise, the output appears immediately below the input while editing
13
+ input_type: checkbox
14
+ default: false
15
+
16
+ - name: livemdpreview.timeout
17
+ description: |
18
+ Minimum time in ms between editing the markdown source & its output being
19
+ updated. This throttles the rate at which consecutive renderings will take
20
+ place.
21
+ input_type: number
22
+ default: 500
23
+ min: 10
24
+ step: 10
.local/share/jupyter/nbextensions/move_selected_cells/move_selected_cells.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Type: IPython Notebook Extension
2
+ Name: Move selected cells
3
+ Description: Move selected cell*s* using keybaord shortcuts Alt-up and Alt-down
4
+ Link: README.md
5
+ Main: main.js
6
+ Compatibility: 4.x, 5.x
.local/share/jupyter/nbextensions/navigation-hotkeys/main.js ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // add custom shortcuts
2
+
3
+ define([
4
+ 'base/js/namespace',
5
+ 'jquery'
6
+ ], function(Jupyter, $) {
7
+ "use strict";
8
+
9
+ // define default values for config parameters
10
+ var params = {
11
+ toggle_enable_edit_shortcuts : true,
12
+ toggle_enable_command_shortcuts : true,
13
+ toggle_enable_esc_shortcut : true,
14
+ toggle_enable_enter_shortcuts : true,
15
+ };
16
+
17
+ // updates default params with any specified in the server's config
18
+ var update_params = function() {
19
+ var config = Jupyter.notebook.config;
20
+ for (var key in params){
21
+ if (config.data.hasOwnProperty(key) ){
22
+ params[key] = config.data[key];
23
+ }
24
+ }
25
+ };
26
+
27
+ var add_command_shortcuts = {
28
+ 'home' : {
29
+ help : 'Go to top',
30
+ help_index : 'ga',
31
+ handler : function() {
32
+ Jupyter.notebook.select(0);
33
+ Jupyter.notebook.scroll_to_top();
34
+ return false;
35
+ }
36
+ },
37
+
38
+ 'end' : {
39
+ help : 'Go to bottom',
40
+ help_index : 'ga',
41
+ handler : function() {
42
+ var ncells = Jupyter.notebook.ncells();
43
+ Jupyter.notebook.select(ncells-1);
44
+ Jupyter.notebook.scroll_to_bottom();
45
+ return false;
46
+ }
47
+ },
48
+
49
+ 'pageup' : {
50
+ help : 'Move cells page up',
51
+ help_index : 'gu',
52
+ handler : function() {
53
+ var wh = 0.6 * $(window).height();
54
+ var cell = Jupyter.notebook.get_selected_cell();
55
+ var h = 0;
56
+ /* loop until we have enough cells to span the size of the notebook window (= one page) */
57
+ do {
58
+ h += cell.element.height();
59
+ Jupyter.notebook.select_prev();
60
+ cell = Jupyter.notebook.get_selected_cell();
61
+ } while ( h < wh );
62
+ var cp = cell.element.position();
63
+ var sp = $('body').scrollTop();
64
+ if ( cp.top < sp) {
65
+ Jupyter.notebook.scroll_to_cell(Jupyter.notebook.get_selected_index(), 0);
66
+ }
67
+ cell.focus_cell();
68
+ return false;
69
+ }
70
+ },
71
+
72
+ 'pagedown' : {
73
+ help : 'Move cells page down',
74
+ help_index : 'gd',
75
+ handler : function() {
76
+
77
+ /* jump to bottom if we are already in the last cell */
78
+ var ncells = Jupyter.notebook.ncells();
79
+ if ( Jupyter.notebook.get_selected_index()+1 == ncells) {
80
+ Jupyter.notebook.scroll_to_bottom();
81
+ return false;
82
+ }
83
+
84
+ var wh = 0.6*$(window).height();
85
+ var cell = Jupyter.notebook.get_selected_cell();
86
+ var h = 0;
87
+
88
+ /* loop until we have enough cells to span the size of the notebook window (= one page) */
89
+ do {
90
+ h += cell.element.height();
91
+ Jupyter.notebook.select_next();
92
+ cell = Jupyter.notebook.get_selected_cell();
93
+ } while ( h < wh );
94
+ cell.focus_cell();
95
+ return false;
96
+ }
97
+ }
98
+
99
+ };
100
+
101
+ var add_edit_shortcuts = {
102
+ 'alt-subtract' : {
103
+ help : 'Merge cell with previous cell',
104
+ help_index : 'eb',
105
+ handler : function() {
106
+ var i = Jupyter.notebook.get_selected_index();
107
+ if (i > 0) {
108
+ var l = Jupyter.notebook.get_cell(i-1).code_mirror.lineCount();
109
+ Jupyter.notebook.merge_cell_above();
110
+ Jupyter.notebook.get_selected_cell().code_mirror.setCursor(l,0);
111
+ }
112
+ }
113
+ },
114
+ 'alt-n' : {
115
+ help : 'Toggle line numbers',
116
+ help_index : 'xy',
117
+ handler : function() {
118
+ var cell = Jupyter.notebook.get_selected_cell();
119
+ cell.toggle_line_numbers();
120
+ return false;
121
+ }
122
+ },
123
+ 'pagedown' : {
124
+ help : 'Page down',
125
+ help_index : 'xy',
126
+ handler : function() {
127
+
128
+ var ic = Jupyter.notebook.get_selected_index();
129
+ var cells = Jupyter.notebook.get_cells();
130
+ var i, h=0;
131
+ for (i=0; i < ic; i ++) {
132
+ h += cells[i].element.height();
133
+ }
134
+ var cur = cells[ic].code_mirror.getCursor();
135
+ h += cells[ic].code_mirror.defaultTextHeight() * cur.line;
136
+ Jupyter.notebook.element.animate({scrollTop:h}, 0);
137
+ return false;
138
+ }
139
+ },
140
+ 'pageup' : {
141
+ help : 'Page up',
142
+ help_index : 'xy',
143
+ handler : function() {
144
+
145
+ var ic = Jupyter.notebook.get_selected_index();
146
+ var cells = Jupyter.notebook.get_cells();
147
+ var i, h=0;
148
+ for (i=0; i < ic; i ++) {
149
+ h += cells[i].element.height();
150
+ }
151
+ var cur =cells[ic].code_mirror.getCursor();
152
+ h += cells[ic].code_mirror.defaultTextHeight() * cur.line;
153
+ Jupyter.notebook.element.animate({scrollTop:h}, 0);
154
+ return false;
155
+ }
156
+ },
157
+ 'ctrl-y' : {
158
+ help : 'Toggle markdown/code',
159
+ handler : function() {
160
+ var cell = Jupyter.notebook.get_selected_cell();
161
+ var cur = cell.code_mirror.getCursor();
162
+ if (cell.cell_type == 'code') {
163
+ Jupyter.notebook.command_mode();
164
+ Jupyter.notebook.to_markdown();
165
+ Jupyter.notebook.edit_mode();
166
+ cell = Jupyter.notebook.get_selected_cell();
167
+ cell.code_mirror.setCursor(cur);
168
+ } else if (cell.cell_type == 'markdown') {
169
+ Jupyter.notebook.command_mode();
170
+ Jupyter.notebook.to_code();
171
+ Jupyter.notebook.edit_mode();
172
+ cell = Jupyter.notebook.get_selected_cell();
173
+ cell.code_mirror.setCursor(cur);
174
+ }
175
+ return false;
176
+ }
177
+ }
178
+ };
179
+
180
+ var add_edit_enter_shortcuts = {
181
+ 'shift-enter' : {
182
+ help : 'Run cell and select next in edit mode',
183
+ help_index : 'bb',
184
+ handler : function() {
185
+ Jupyter.notebook.execute_cell_and_select_below();
186
+ var rendered = Jupyter.notebook.get_selected_cell().rendered;
187
+ var ccell = Jupyter.notebook.get_selected_cell().cell_type;
188
+ if (rendered === false || ccell === 'code') Jupyter.notebook.edit_mode();
189
+ return false;
190
+ }
191
+ },
192
+ 'ctrl-enter' : {
193
+ help : 'Run selected cell stay in edit mode',
194
+ help_index : 'bb',
195
+ handler : function() {
196
+ var cell = Jupyter.notebook.get_selected_cell();
197
+ var mode = cell.mode;
198
+ cell.execute();
199
+ if (mode === "edit") Jupyter.notebook.edit_mode();
200
+ return false;
201
+ }
202
+ }
203
+ };
204
+
205
+ var initialize = function() {
206
+ // Update default parameters
207
+ update_params();
208
+
209
+ var action;
210
+ var prefix = 'navigation_hotkeys';
211
+ var action_name;
212
+ var action_name_spaces;
213
+ var action_full_name;
214
+ var all_commands_combined = [add_command_shortcuts, add_edit_enter_shortcuts, add_edit_shortcuts];
215
+
216
+
217
+ // register all commands if one of the keybindings is not loaded so commands still available
218
+ for (let i = 0; i < all_commands_combined.length; i++){
219
+ for (var key in all_commands_combined[i]){
220
+ // check if the property/key is defined in the object itself, not in parent
221
+ if (all_commands_combined[i].hasOwnProperty(key)) {
222
+ action = all_commands_combined[i][key];
223
+ action_name_spaces = all_commands_combined[i][key]['help'];
224
+ action_name = action_name_spaces.replace(/ /g,"-").toLowerCase();
225
+ action_full_name = Jupyter.keyboard_manager.actions.register(action, action_name, prefix);
226
+ };
227
+ };
228
+ };
229
+
230
+ if (params.toggle_enable_command_shortcuts) {
231
+ for (var key in add_command_shortcuts) {
232
+ // check if the property/key is defined in the object itself, not in parent
233
+ if (add_command_shortcuts.hasOwnProperty(key)) {
234
+ action = add_command_shortcuts[key];
235
+ action_name_spaces = add_command_shortcuts[key]['help'];
236
+ action_name = action_name_spaces.replace(/ /g,"-").toLowerCase();
237
+ action_full_name = prefix + ":" + action_name;
238
+ Jupyter.keyboard_manager.command_shortcuts.add_shortcut(
239
+ key, action_full_name);
240
+ }
241
+ };
242
+ if (params.toggle_enable_esc_shortcut) {
243
+ Jupyter.keyboard_manager.command_shortcuts.add_shortcut(
244
+ 'Esc','jupyter-notebook:enter-edit-mode');
245
+ }
246
+ };
247
+
248
+ if (params.toggle_enable_edit_shortcuts) {
249
+ for (var key in add_edit_shortcuts) {
250
+ // check if the property/key is defined in the object itself, not in parent
251
+ if (add_edit_shortcuts.hasOwnProperty(key)) {
252
+ action = add_edit_shortcuts[key];
253
+ action_name_spaces = add_edit_shortcuts[key]['help'];
254
+ action_name = action_name_spaces.replace(/ /g,"-").toLowerCase();
255
+ action_full_name = prefix + ":" + action_name;
256
+ Jupyter.keyboard_manager.edit_shortcuts.add_shortcut(key, action_full_name);
257
+ }
258
+ };
259
+ if (params.toggle_enable_enter_shortcuts) {
260
+ for (var key in add_edit_enter_shortcuts) {
261
+ // check if the property/key is defined in the object itself, not in parent
262
+ if (add_edit_enter_shortcuts.hasOwnProperty(key)) {
263
+ action = add_edit_enter_shortcuts[key];
264
+ action_name_spaces = add_edit_enter_shortcuts[key]['help'];
265
+ action_name = action_name_spaces.replace(/ /g,"-").toLowerCase();
266
+ action_full_name = prefix + ":" + action_name;
267
+ Jupyter.keyboard_manager.edit_shortcuts.add_shortcut(
268
+ key, action_full_name);
269
+ }
270
+ };
271
+ };
272
+ Jupyter.keyboard_manager.edit_shortcuts.add_shortcut(
273
+ 'alt-add','jupyter-notebook:split-cell-at-cursor');
274
+ };
275
+
276
+ };
277
+
278
+ var load_ipython_extension = function() {
279
+ return Jupyter.notebook.config.loaded.then(initialize);
280
+ };
281
+
282
+ var extension = {
283
+ load_ipython_extension : load_ipython_extension
284
+ };
285
+ return extension;
286
+ });
.local/share/jupyter/nbextensions/nbTranslate/languages.js ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ *
3
+ * Generated from https://translate.google.com
4
+ *
5
+ * The languages that Google Translate supports (as of 5/15/16) alongside with their ISO 639-1 codes
6
+ * See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
7
+ */
8
+
9
+ var langs = {
10
+ 'auto': 'Automatic',
11
+ 'af': 'Afrikaans',
12
+ 'sq': 'Albanian',
13
+ 'ar': 'Arabic',
14
+ 'hy': 'Armenian',
15
+ 'az': 'Azerbaijani',
16
+ 'eu': 'Basque',
17
+ 'be': 'Belarusian',
18
+ 'bn': 'Bengali',
19
+ 'bs': 'Bosnian',
20
+ 'bg': 'Bulgarian',
21
+ 'ca': 'Catalan',
22
+ 'ceb': 'Cebuano',
23
+ 'ny': 'Chichewa',
24
+ 'zh-cn': 'Chinese Simplified',
25
+ 'zh-tw': 'Chinese Traditional',
26
+ 'co': 'Corsican',
27
+ 'hr': 'Croatian',
28
+ 'cs': 'Czech',
29
+ 'da': 'Danish',
30
+ 'nl': 'Dutch',
31
+ 'en': 'English',
32
+ 'eo': 'Esperanto',
33
+ 'et': 'Estonian',
34
+ 'tl': 'Filipino',
35
+ 'fi': 'Finnish',
36
+ 'fr': 'French',
37
+ 'fy': 'Frisian',
38
+ 'gl': 'Galician',
39
+ 'ka': 'Georgian',
40
+ 'de': 'German',
41
+ 'el': 'Greek',
42
+ 'gu': 'Gujarati',
43
+ 'ht': 'Haitian Creole',
44
+ 'ha': 'Hausa',
45
+ 'haw': 'Hawaiian',
46
+ 'iw': 'Hebrew',
47
+ 'hi': 'Hindi',
48
+ 'hmn': 'Hmong',
49
+ 'hu': 'Hungarian',
50
+ 'is': 'Icelandic',
51
+ 'ig': 'Igbo',
52
+ 'id': 'Indonesian',
53
+ 'ga': 'Irish',
54
+ 'it': 'Italian',
55
+ 'ja': 'Japanese',
56
+ 'jw': 'Javanese',
57
+ 'kn': 'Kannada',
58
+ 'kk': 'Kazakh',
59
+ 'km': 'Khmer',
60
+ 'ko': 'Korean',
61
+ 'ku': 'Kurdish (Kurmanji)',
62
+ 'ky': 'Kyrgyz',
63
+ 'lo': 'Lao',
64
+ 'la': 'Latin',
65
+ 'lv': 'Latvian',
66
+ 'lt': 'Lithuanian',
67
+ 'lb': 'Luxembourgish',
68
+ 'mk': 'Macedonian',
69
+ 'mg': 'Malagasy',
70
+ 'ms': 'Malay',
71
+ 'ml': 'Malayalam',
72
+ 'mt': 'Maltese',
73
+ 'mi': 'Maori',
74
+ 'mr': 'Marathi',
75
+ 'mn': 'Mongolian',
76
+ 'my': 'Myanmar (Burmese)',
77
+ 'ne': 'Nepali',
78
+ 'no': 'Norwegian',
79
+ 'ps': 'Pashto',
80
+ 'fa': 'Persian',
81
+ 'pl': 'Polish',
82
+ 'pt': 'Portuguese',
83
+ 'ma': 'Punjabi',
84
+ 'ro': 'Romanian',
85
+ 'ru': 'Russian',
86
+ 'sm': 'Samoan',
87
+ 'gd': 'Scots Gaelic',
88
+ 'sr': 'Serbian',
89
+ 'st': 'Sesotho',
90
+ 'sn': 'Shona',
91
+ 'sd': 'Sindhi',
92
+ 'si': 'Sinhala',
93
+ 'sk': 'Slovak',
94
+ 'sl': 'Slovenian',
95
+ 'so': 'Somali',
96
+ 'es': 'Spanish',
97
+ 'su': 'Sudanese',
98
+ 'sw': 'Swahili',
99
+ 'sv': 'Swedish',
100
+ 'tg': 'Tajik',
101
+ 'ta': 'Tamil',
102
+ 'te': 'Telugu',
103
+ 'th': 'Thai',
104
+ 'tr': 'Turkish',
105
+ 'uk': 'Ukrainian',
106
+ 'ur': 'Urdu',
107
+ 'uz': 'Uzbek',
108
+ 'vi': 'Vietnamese',
109
+ 'cy': 'Welsh',
110
+ 'xh': 'Xhosa',
111
+ 'yi': 'Yiddish',
112
+ 'yo': 'Yoruba',
113
+ 'zu': 'Zulu'
114
+ };
.local/share/jupyter/nbextensions/nbTranslate/mutils.js ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Maths utilitary functions,
2
+ // adapted from latex_envs, see github.com/jfbercher/jupyter_latex_envs
3
+
4
+ /****************************************************************************************************************
5
+ * Series of elementary functions for manipulating nested environments
6
+ * needed to do that because standard regular expressions are not well suited for recursive things
7
+ ****************************************************************************************************************/
8
+ var OPENINGENV = '#!<',
9
+ OPENINGENVre = new RegExp(OPENINGENV, 'g');
10
+ var CLOSINGENV = '#!>',
11
+ CLOSINGENVre = new RegExp(CLOSINGENV, 'g');
12
+
13
+ function envSearch(text, env_open, env_close) {
14
+ var reg = new RegExp(env_open + '[\\S\\s]*?' + env_close, 'gm');
15
+ var start = text.match(reg);
16
+ var env_open_re = new RegExp(env_open);
17
+ var env_close_re = new RegExp(env_close);
18
+ var retval;
19
+ var r = "";
20
+ if (typeof(start[0]) != 'undefined' && start[0] != null) {
21
+ var r = start[0].substr(1)
22
+ }
23
+ var out = env_open_re.test(r) //test if there exists an opening env at level +1
24
+ //of the same kind inside
25
+
26
+ if (out) { //in such case: replace the new opening at level +1 and the closing at level
27
+ var rnew = r.replace(env_close_re, CLOSINGENV).replace(env_open_re, OPENINGENV)
28
+ .replace(/\$\$/g,"!@$!@$") //last replace is because "$$" in the replacement string does not work
29
+ var text = text.replace(r, rnew).replace(/!@\$/g,"$");
30
+ if (env_open_re.test(rnew)) { // if it remains nested envs, call the function again
31
+ retval = envSearch(text, env_open, env_close);
32
+ if (retval !== undefined) {
33
+ text = retval;
34
+ }
35
+ }
36
+ return text
37
+ }
38
+ return text
39
+ }
40
+
41
+ function nestedEnvSearch(text, env_open, env_close) {
42
+ var regtest = new RegExp(env_open + '[\\S\\s]*?' + env_close);
43
+ var inmatches = text.match(regtest);
44
+ if (inmatches != null) {
45
+ for (i = 0; i < inmatches.length; i++)
46
+ inmatches[i] = inmatches[i].replace(/\*/g, '\\*')
47
+ var n = 0;
48
+ env_open = env_open.replace(/\([\\\+\S ]*?\)/g, function() {
49
+ return inmatches[++n]
50
+ })
51
+ env_close = env_close.replace(/\\\d/g, function(x) {
52
+ return inmatches[parseInt(x.substr(1))]
53
+ })
54
+ var output = envSearch(text, env_open, env_close)
55
+ var matches = output.match(env_open + '([\\S\\s]*?)' + env_close);
56
+ matches[0] = matches[0].replace(OPENINGENVre, env_open.replace('\\\\', '\\'))
57
+ .replace(CLOSINGENVre, env_close.replace('\\\\', '\\'))
58
+ matches[1] = matches[1].replace(OPENINGENVre, env_open.replace('\\\\', '\\'))
59
+ .replace(CLOSINGENVre, env_close.replace('\\\\', '\\'))
60
+ var result = [matches[0], inmatches[1], matches[1]]
61
+ for (i = 0; i < result.length; i++)
62
+ result[i] = result[i].replace(/\\\*\}/g, '*}')
63
+ return result;
64
+ } else return [];
65
+ }
66
+
67
+
68
+ function envReplaceApply(text, matches, replacement) {
69
+ var output;
70
+ if (matches.length != 0) {
71
+ if (replacement instanceof Function) {
72
+ output = text.replace(matches[0],
73
+ replacement(matches[0], matches[1], matches[2])
74
+ .replace(/\$\$/g,"!@$!@$")).replace(/!@\$/g,"$")
75
+ //last line because "$$" in the replacement string does not work
76
+ } else if (typeof replacement == "string") {
77
+ output = text.replace(matches[0], replacement)
78
+ }
79
+ return output
80
+ } else {
81
+ return text;
82
+ }
83
+ }
84
+
85
+ function nestedEnvReplace(text, env_open, env_close, replacement, flags) {
86
+ var list_of_matches = [];
87
+ var count = 200; //protection
88
+ var matches = nestedEnvSearch(text, env_open, env_close);
89
+ if (flags == undefined) {
90
+ return envReplaceApply(text, matches, replacement)
91
+ } else if (flags.indexOf('g') !== -1) {
92
+ var tmp_text = text; // tmp text
93
+ while (count-- > 0 & matches.length != 0) {
94
+ list_of_matches.push(matches[0]);
95
+ tmp_text = tmp_text.replace(matches[0], ""); //suppress from tmp_text
96
+ text = envReplaceApply(text, matches, replacement);
97
+ matches = nestedEnvSearch(tmp_text, env_open, env_close);
98
+ }
99
+ return text;
100
+ } else {
101
+ return text;
102
+ }
103
+ }
104
+
105
+ var textEnvs = {'theorem':'theorem', 'lemma':'lemma', 'remark':'remark',
106
+ 'example':'example', 'exercise':'exercise', 'corollary':'corollary',
107
+ 'proposition':'proposition', 'definition':'definition','problem':'problem',
108
+ 'proof':'proof', 'property':'property', 'itemize':'itemize', 'enumerate':'enumerate'}
109
+
110
+ var textCmds = {'textbf':'textbf', 'textit':'textit', 'underline':'underline',
111
+ 'texttt':'texttt', 'textem':'textem', 'emph':'emph'}
112
+ //label and ref not added because their content shall not be translated
113
+
114
+ var OPENmath = 'mathid'//'\u003cmathid',
115
+ OPENmathRe = new RegExp(OPENmath, 'g');
116
+ var CLOSEmath = ''//'\u003e',
117
+ CLOSEmathRe = new RegExp(CLOSEmath, 'g');
118
+
119
+ function removeMaths(text){
120
+ var math=[];
121
+ function replacement(m0,m1,m2) {
122
+ if (m1 in textEnvs){
123
+ math.push('\\begin{'+m1+'}'); var id_beg = math.length;
124
+ math.push('\\end{'+m1+'}'); var id_end = math.length;
125
+ m2 = nestedEnvReplace(m2, '\\\\begin{(\\w+\\\*?)}', '\\\\end{\\1}', replacement, 'g')
126
+ return OPENmath + id_beg + CLOSEmath + m2 + OPENmath + id_end + CLOSEmath;
127
+ }
128
+ else if (m1 in textCmds){
129
+ math.push('\\' + m1 + '{')
130
+ math.push('}')
131
+ return OPENmath + String(math.length - 1) + CLOSEmath + m2 + OPENmath + math.length + CLOSEmath;
132
+ }
133
+ else {
134
+ math.push(m0)
135
+ return OPENmath + math.length + CLOSEmath;
136
+ }
137
+ }
138
+ text = nestedEnvReplace(text, '\\\\begin{(\\w+\\\*?)}', '\\\\end{\\1}', replacement, 'g')
139
+ text = text.replace(/\\\[([\S\s]*?)\\\]/gm,replacement)
140
+ text = text.replace(/\\\(([\S\s]*?)\\\)/gm,replacement)
141
+ text = text.replace(/\$\$([\S\s]*?)\$\$/gm,replacement)
142
+ text = text.replace(/\$([\S\s]*?)\$/gm,replacement)
143
+ text = text.replace(/\\item/gm,replacement)
144
+ text = text.replace(/\\([\S]*?){([\S\s]*?)}/gm,replacement) //textcmd
145
+ return [math, text]
146
+ }
147
+
148
+ function restoreMaths(math_and_text) {
149
+ var math = math_and_text[0];
150
+ var text = math_and_text[1];
151
+ var newtext;
152
+ var OPENmathUnicode = escape(OPENmath).replace(/%u([A-F0-9]{4})|%([A-F0-9]{2})/g, function(_, u, x) { return "\\\\u" + (u || '00' + x).toLowerCase() });
153
+ var CLOSEmathUnicode = escape(CLOSEmath).replace(/%u([A-F0-9]{4})|%([A-F0-9]{2})/g, function(_, u, x) { return "\\\\u" + (u || '00' + x).toLowerCase() });
154
+ var mathDetectRe = new RegExp(OPENmathUnicode+'\\s*?(\\d+)\\s*?'+CLOSEmathUnicode, 'gim');
155
+ var cont = true;
156
+ while (cont) {
157
+ var newtext = text.replace(mathDetectRe, function(wholeMatch, n) {
158
+ return math[n - 1];
159
+ });
160
+ /*var newtext = newtext.replace(/\\u003cmathiid\s*?(\d+)\s*?\\u003e/gim, function(wholeMatch, n) {
161
+ return math[n - 1];
162
+ }); */
163
+ cont = text !== newtext; //recurse in text (possible nesting -- just one level)
164
+ text=newtext;
165
+ }
166
+ return text;
167
+ }
168
+
169
+ var OPENhtml = 'htmlid'
170
+ OPENhtmlRe = new RegExp(OPENhtml, 'g');
171
+ var CLOSEhtml = ''//'\u003e',
172
+ CLOSEhtmlRe = new RegExp(CLOSEhtml, 'g');
173
+
174
+ function removeHtml(text) {
175
+ var html = [];
176
+ function replacement(m0, m1) {
177
+ html.push(m0)
178
+ return OPENhtml + html.length + CLOSEhtml;
179
+
180
+ }
181
+ text = text.replace(/<(\S[\S\s]*?)\S>/gm, replacement)
182
+ return [html, text]
183
+ }
184
+
185
+
186
+ function restoreHtml(html_and_text) {
187
+ var html = html_and_text[0];
188
+ var text = html_and_text[1];
189
+ var newtext;
190
+ var OPENhtmlUnicode = escape(OPENhtml).replace(/%u([A-F0-9]{4})|%([A-F0-9]{2})/g, function(_, u, x) {
191
+ return "\\\\u" + (u || '00' + x).toLowerCase() });
192
+ var CLOSEhtmlUnicode = escape(CLOSEhtml).replace(/%u([A-F0-9]{4})|%([A-F0-9]{2})/g, function(_, u, x) {
193
+ return "\\\\u" + (u || '00' + x).toLowerCase() });
194
+ var htmlDetectRe = new RegExp(OPENhtmlUnicode + '\\s*?(\\d+)\\s*?' + CLOSEhtmlUnicode, 'gim');
195
+ text = text.replace(htmlDetectRe, function(wholeMatch, n) {
196
+ return html[n - 1];
197
+ });
198
+
199
+ return text;
200
+ }
201
+
.local/share/jupyter/nbextensions/python-markdown/main.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ .notebook-trusted {
3
+ color: #555555;
4
+ }
.local/share/jupyter/nbextensions/python-markdown/python-markdown.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Type: IPython Notebook Extension
2
+ Name: Python Markdown
3
+ Description: Allows embedding Python-code in markdown cells
4
+ Link: readme.md
5
+ Icon: python-markdown.png
6
+ Main: main.js
7
+ Preprocessor: pymdpreprocessor.py
8
+ Compatibility: 4.x, 5.x
.local/share/jupyter/nbextensions/rubberband/main.js ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Select cells with a rubberband-selection using the mouse
2
+ // shift + mouse drag -> select only cells currently touched by rubberband
3
+ // alt+shift + mouse drag -> select all cells that were touched by rubberband
4
+
5
+ define([
6
+ 'base/js/namespace',
7
+ 'jquery',
8
+ 'base/js/events',
9
+ 'base/js/keyboard',
10
+ 'require'
11
+ ], function(IPython, $, events, keyboard, requirejs) {
12
+ "use strict";
13
+
14
+ var scrollRange = 50; /* range on top and bottom where autoscroll starts */
15
+
16
+ var keycodes = keyboard.keycodes;
17
+
18
+ var startX, startY;
19
+ var offsetY;
20
+ var isDragging = false;
21
+ var isRubberBandEnabled = false;
22
+ var isAddSelection = false;
23
+ var isScrolling = false;
24
+ var headerHeight;
25
+
26
+ /*
27
+ * Test if a cell touched by a certain area
28
+ *
29
+ * @method isCellWithin
30
+ * @param cell
31
+ * @param left
32
+ * @param top
33
+ * @param width
34
+ * @param height
35
+ *
36
+ */
37
+ var isCellWithin = function(cell,left,top,width,height){
38
+ var cellpos = cell.element.position();
39
+ var cellh = cell.element.height();
40
+ var cellw = cell.element.width();
41
+ if (cellpos.top === 0)
42
+ return false; // not visible
43
+ return ((cellpos.top+cellh) > top-offsetY && cellpos.top < top-offsetY+height
44
+ && cellpos.left+cellw > left && cellpos.left < left+width);
45
+ };
46
+
47
+ /**
48
+ * load css file and append to document
49
+ *
50
+ * @method load_css
51
+ * @param name {String} filenaame of CSS file
52
+ *
53
+ */
54
+ var load_css = function (name) {
55
+ var link = document.createElement("link");
56
+ link.type = "text/css";
57
+ link.rel = "stylesheet";
58
+ link.href = requirejs.toUrl(name);
59
+ document.getElementsByTagName("head")[0].appendChild(link);
60
+ };
61
+
62
+
63
+ /**
64
+ * Clear existing selection
65
+ *
66
+ * @method clearSelection
67
+ *
68
+ */
69
+ var clearSelection = function() {
70
+ var ncells = IPython.notebook.ncells();
71
+ var cells = IPython.notebook.get_cells();
72
+
73
+ for(var i=0; i < ncells; i++){
74
+ cells[i].unselect();
75
+ }
76
+ };
77
+
78
+
79
+
80
+ function load_ipython_extension() {
81
+ /*
82
+ * Capture shift key - shift+mouse button will start rubberband selection
83
+ *
84
+ */
85
+ $(document).keydown(function(event){
86
+ if(event.keyCode === keycodes.shift && IPython.notebook.mode === "command"){
87
+ isRubberBandEnabled = true
88
+ }
89
+ if(event.keyCode === keycodes.alt){
90
+ isAddSelection = true
91
+ }
92
+ });
93
+
94
+ $(document).keyup(function(event){
95
+ if(event.keyCode === keycodes.shift){
96
+ isRubberBandEnabled = false
97
+ }
98
+ if(event.keyCode === keycodes.alt){
99
+ isAddSelection = false
100
+ }
101
+ });
102
+
103
+ /*
104
+ * Start rubberband selection action
105
+ *
106
+ */
107
+ $(document).mousedown(function(event){
108
+ offsetY = $('#notebook').offset().top;
109
+ headerHeight = $('#header').height();
110
+ if(isRubberBandEnabled) {
111
+ startX = event.pageX;
112
+ startY = event.pageY;
113
+ isDragging = true;
114
+ $("#dragmask").css(
115
+ {
116
+ 'left' : startX,
117
+ 'top' : startY,
118
+ 'width' : 0,
119
+ 'height' : 0
120
+ }
121
+
122
+ ).show();
123
+ // prevent default behaviour of text selection
124
+ return false;
125
+ } else {
126
+ if (event.pageY-offsetY > 0) {
127
+ /* clear selection */
128
+ var ncells = IPython.notebook.ncells();
129
+ var cells = IPython.notebook.get_cells();
130
+ var selected_idx = IPython.notebook.get_selected_index();
131
+ for(var i=0; i < ncells; i++){
132
+ if (i != selected_idx) cells[i].unselect();
133
+ }
134
+ }
135
+ }
136
+
137
+ });
138
+ /*
139
+ * Rubberband dragging operation - select cells touched by rubberband
140
+ *
141
+ */
142
+ $(document).mousemove(function(event){
143
+ offsetY = $('#notebook').offset().top;
144
+
145
+ if(isDragging === true){
146
+ var left, top, width, height;
147
+ if(event.pageX>startX){
148
+ left = startX;
149
+ width = event.pageX - startX;
150
+ }
151
+ else {
152
+ left = event.pageX;
153
+ width = startX - event.pageX;
154
+ }
155
+ if(event.pageY>startY){
156
+ top = startY;
157
+ height = event.pageY - startY;
158
+ }
159
+ else {
160
+ top = event.pageY;
161
+ height = startY - event.pageY;
162
+ }
163
+
164
+ var ncells = IPython.notebook.ncells();
165
+ var cells = IPython.notebook.get_cells();
166
+ var elheight = IPython.notebook.scroll_manager.element.height();
167
+ var Yfromtop = event.clientY - headerHeight;
168
+ var scrollpos = IPython.notebook.scroll_manager.element.scrollTop();
169
+ var scrolltime = 200;
170
+ if (Yfromtop < scrollRange && isScrolling === false) {
171
+ isScrolling = true;
172
+ IPython.notebook.scroll_manager.element.animate({scrollTop:scrollpos - 0.3*elheight}, scrolltime,"linear", function() { isScrolling = false })
173
+ }
174
+
175
+ if ( Yfromtop > elheight-scrollRange && isScrolling === false) {
176
+ isScrolling = true;
177
+ IPython.notebook.scroll_manager.element.animate({scrollTop: scrollpos + 0.3*elheight}, scrolltime,"linear", function() { isScrolling = false })
178
+ }
179
+
180
+ var selected_cells = IPython.notebook.get_selected_cells_indices()
181
+ var first = true;
182
+ for (var i=0; i<ncells; i++) {
183
+ var _cell = cells[i];
184
+ if (isCellWithin(_cell,left,top,width,height) === true) {
185
+ if (selected_cells.includes(i) == true) first = false;
186
+ if (first === true) {
187
+ first = false;
188
+ IPython.notebook.select(i);
189
+ } else {
190
+ if (!selected_cells.includes(i)) {
191
+ IPython.notebook.select(i, false);
192
+ };
193
+ };
194
+ } else {
195
+ if (selected_cells.includes(i)) {
196
+ var index = IPython.notebook.get_selected_index();
197
+ if (isAddSelection === false) {
198
+ var delta = 0;
199
+ if (index > i) delta = 1;
200
+ if (index < i) delta = -1;
201
+ IPython.notebook.select(i+delta, false);
202
+ };
203
+ }
204
+ }
205
+ }
206
+ $("#dragmask").css(
207
+ {
208
+ 'left' : left,
209
+ 'top' : top,
210
+ 'width' : width,
211
+ 'height' : height
212
+ }
213
+ )
214
+ }
215
+ });
216
+
217
+ /*
218
+ * End rubberband dragging operation
219
+ *
220
+ */
221
+ $(document).mouseup(function(event){
222
+ if(isDragging){
223
+ isDragging = false;
224
+ $("#dragmask").hide();
225
+ }
226
+ });
227
+ load_css('./main.css');
228
+ var rubberband_div = $('<div id="dragmask" class="highlight-drag"></div>');
229
+ $("#header").append(rubberband_div);
230
+ }
231
+
232
+ /* expose functions to other extensions */
233
+ var rubberband = {
234
+ load_ipython_extension : load_ipython_extension,
235
+ };
236
+ return rubberband;
237
+ });
.local/share/jupyter/nbextensions/ruler/readme.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Ruler
2
+ =====
3
+
4
+ This extension enables the Ruler CodeMirror feature
5
+
6
+
7
+ Configuration
8
+ -------------
9
+
10
+ You can set the number of characters in the notebook extensions configration page or use the ConfigManager:
11
+
12
+ ```Python
13
+ from IPython.html.services.config import ConfigManager
14
+ ip = get_ipython()
15
+ cm = ConfigManager(parent=ip)
16
+ cm.update('notebook', {"ruler_column": [80]})
17
+ ```
18
+
19
+
20
+ #### CSS patch ####
21
+
22
+ Notebook versions from 4.3.0 through 5.1.0dev show up a bug in their CodeMirror
23
+ CSS padding which causes the ruler to be misplaced (see
24
+ [jupyter/notebook#2869](https://github.com/jupyter/notebook/issues/2869)
25
+ for details).
26
+ This nbextension introduces a css patch to attempt to correct this, but if it
27
+ causes problems for you, you can disable it by setting the `ruler_do_css_patch`
28
+ config key to `false`.
29
+
30
+
31
+ #### Multiple Rulers ####
32
+
33
+ To specify multiple rulers, set the `ruler_column` to a list of values, for example
34
+
35
+ ```Python
36
+ cm.update('notebook', {"ruler_column": [10, 20, 30, 40, 50, 60, 70, 80]})
37
+ ```
38
+
39
+ A separate color and style can be specified for each ruler.
40
+
41
+ ```Python
42
+ cm.update('notebook', {"color": ["#000000", "#111111", "#222222", "#333333", "#444444",
43
+ "#555555", "#666666", "#777777", "#888888", "#999999"]})
44
+ ```
45
+
46
+ Creating a repeating pattern for either color or style is as simple as giving a list shorter than the total number of rulers
47
+
48
+ ```Python
49
+ cm.update('notebook', {"ruler_column": [10, 20, 30, 40, 50, 60, 70, 80]})
50
+ cm.update('notebook', {"color": ["#FF0000", "#00FF00", "#0000FF"]})
51
+ cm.update('notebook', {"style": ["dashed", "dotted"]})
52
+ ```
53
+
54
+ will result in `red, green, blue, red, green, blue, red, green, blue, red` and alternating `dashed, dotted`
55
+
56
+ See [here](https://www.w3schools.com/cssref/pr_border-left_style.asp) for other line styles.
.local/share/jupyter/nbextensions/runtools/demo.gif ADDED
.local/share/jupyter/nbextensions/runtools/gutter.css ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .CodeMirror-cellstate {
2
+ width: 0.5em;
3
+ }
.local/share/jupyter/nbextensions/runtools/icon.png ADDED
.local/share/jupyter/nbextensions/runtools/main.css ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .icon-run-from:before{content:"\f10c\f04b"}
2
+ .icon-run-to:before{content:"\f04b\f10c"}
3
+ .icon-run-all:before{content:"\f04b\f01e"}
4
+ .icon-run-all-forced:before{content:"\f04b\f12a"}
5
+ .icon-run-marked:before{content:"\f04b\f08d"}
6
+
7
+ .icon-mark-all:before{content:"\f111"}
8
+ .icon-mark-none:before{content:"\f10c"}
9
+ .icon-mark-toggle:before{content:"\f08d"}
10
+
11
+ .icon-hide-input:before{content:"\f039\f068"}
12
+ .icon-hide-output:before{content:"\f02f\f068"}
13
+ .icon-show-input:before{content:"\f039\f067"}
14
+ .icon-show-output:before{content:"\f02f\f067"}
15
+
16
+ #runtools-wrapper {
17
+ position: absolute;
18
+ width:340px;
19
+ top: 100px;
20
+ right: 0px;
21
+ float: right;
22
+ opacity: 1;
23
+ z-index: 100;
24
+ font-size: 12px;
25
+ font-weight: bold;
26
+ background-color: lightgrey;
27
+ }