From 9a5aa9c1160a02bb2bbdebdcfa9f513dd82c9836 Mon Sep 17 00:00:00 2001 From: Juergen Hasch Date: Wed, 21 Dec 2022 18:18:54 +0100 Subject: [PATCH 1/6] Update version compatibility for nbextensions --- .../nbextensions/addbefore/addbefore.yaml | 2 +- .../nbextensions/autosavetime/autosavetime.yaml | 2 +- .../nbextensions/autoscroll/autoscroll.yaml | 2 +- .../nbextensions/codefolding/codefolding.yaml | 2 +- .../nbextensions/comment-uncomment/comment-uncomment.yaml | 2 +- .../nbextensions/navigation-hotkeys/hotkeys.yaml | 2 +- .../nbextensions/notify/notify.yaml | 2 +- .../nbextensions/python-markdown/python-markdown.yaml | 2 +- src/jupyter_contrib_nbextensions/nbextensions/ruler/ruler.yaml | 2 +- .../nbextensions/runtools/runtools.yaml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/jupyter_contrib_nbextensions/nbextensions/addbefore/addbefore.yaml b/src/jupyter_contrib_nbextensions/nbextensions/addbefore/addbefore.yaml index 118298f23..e185c9f92 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/addbefore/addbefore.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/addbefore/addbefore.yaml @@ -4,4 +4,4 @@ Description: This extension enables the Add Cell before button (from iPython 1) Link: readme.md Icon: icon.png Main: main.js -Compatibility: 4.x +Compatibility: 4.x, 5.x, 6.x diff --git a/src/jupyter_contrib_nbextensions/nbextensions/autosavetime/autosavetime.yaml b/src/jupyter_contrib_nbextensions/nbextensions/autosavetime/autosavetime.yaml index 6616d565f..bfc476331 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/autosavetime/autosavetime.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/autosavetime/autosavetime.yaml @@ -1,5 +1,5 @@ Type: IPython Notebook Extension -Compatibility: 3.x, 4.x, 5.x +Compatibility: 3.x, 4.x, 5.x, 6.x Name: AutoSaveTime Main: main.js Icon: icon.png diff --git a/src/jupyter_contrib_nbextensions/nbextensions/autoscroll/autoscroll.yaml b/src/jupyter_contrib_nbextensions/nbextensions/autoscroll/autoscroll.yaml index 9d1f5845a..f4b921a4a 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/autoscroll/autoscroll.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/autoscroll/autoscroll.yaml @@ -1,5 +1,5 @@ Type: IPython Notebook Extension -Compatibility: 3.x, 4.x +Compatibility: 3.x, 4.x, 5.x Name: Autoscroll Main: main.js Icon: icon.png diff --git a/src/jupyter_contrib_nbextensions/nbextensions/codefolding/codefolding.yaml b/src/jupyter_contrib_nbextensions/nbextensions/codefolding/codefolding.yaml index 02c4fa063..6f3e6319e 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/codefolding/codefolding.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/codefolding/codefolding.yaml @@ -4,7 +4,7 @@ Description: This extension enables the CodeMirror feature to allow codefolding Link: readme.md Icon: icon.png Main: main.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: codefolding_hotkey description: Hotkey to fold/unfold code diff --git a/src/jupyter_contrib_nbextensions/nbextensions/comment-uncomment/comment-uncomment.yaml b/src/jupyter_contrib_nbextensions/nbextensions/comment-uncomment/comment-uncomment.yaml index 62bc0886f..4e74b3662 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/comment-uncomment/comment-uncomment.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/comment-uncomment/comment-uncomment.yaml @@ -1,5 +1,5 @@ Type: IPython Notebook Extension -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Name: Comment/Uncomment Hotkey Main: main.js Description: add new configurable hotkey binding to toggle comments diff --git a/src/jupyter_contrib_nbextensions/nbextensions/navigation-hotkeys/hotkeys.yaml b/src/jupyter_contrib_nbextensions/nbextensions/navigation-hotkeys/hotkeys.yaml index 91ce9ee05..44a4b0a5a 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/navigation-hotkeys/hotkeys.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/navigation-hotkeys/hotkeys.yaml @@ -4,7 +4,7 @@ Description: Additional hotkeys for easier navigation in the notebook Link: readme.md Icon: icon.png Main: main.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: toggle_enable_edit_shortcuts description: Enable all edit shortcuts diff --git a/src/jupyter_contrib_nbextensions/nbextensions/notify/notify.yaml b/src/jupyter_contrib_nbextensions/nbextensions/notify/notify.yaml index ed299a344..a24d03d15 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/notify/notify.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/notify/notify.yaml @@ -6,7 +6,7 @@ Description: > Link: readme.md Icon: notification.png Main: notify.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: notify.sticky description: Require interactions on notifications to dismiss them. (Chrome only) diff --git a/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown.yaml b/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown.yaml index 3e6663b97..1169eed0c 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown.yaml @@ -5,4 +5,4 @@ Link: readme.md Icon: python-markdown.png Main: main.js Preprocessor: pymdpreprocessor.py -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x diff --git a/src/jupyter_contrib_nbextensions/nbextensions/ruler/ruler.yaml b/src/jupyter_contrib_nbextensions/nbextensions/ruler/ruler.yaml index dee55c832..083a03de6 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/ruler/ruler.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/ruler/ruler.yaml @@ -4,7 +4,7 @@ Description: This extension enables the Ruler CodeMirror feature Link: readme.md Icon: icon.png Main: main.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: ruler_column diff --git a/src/jupyter_contrib_nbextensions/nbextensions/runtools/runtools.yaml b/src/jupyter_contrib_nbextensions/nbextensions/runtools/runtools.yaml index 995b80334..e5b28f8c9 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/runtools/runtools.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/runtools/runtools.yaml @@ -4,7 +4,7 @@ Description: Runtools provide a number of additional functions for working with Link: readme.md Icon: icon.png Main: main.js -Compatibility: 5.x +Compatibility: 5.x, 6.x Parameters: - name: runtools.run_cells_above description: run cells above From a542d08c7ef6a328ca3c26e7bb8850652b2b9afe Mon Sep 17 00:00:00 2001 From: Juergen Hasch Date: Wed, 21 Dec 2022 18:56:40 +0100 Subject: [PATCH 2/6] Update compatibility to version 6.x --- .../codemirror_mode_extensions.yaml | 3 +++ .../nbextensions/livemdpreview/livemdpreview.yml | 2 +- .../nbextensions/move_selected_cells/README.md | 2 +- .../nbextensions/move_selected_cells/main.js | 4 ++-- .../nbextensions/move_selected_cells/move_selected_cells.yaml | 2 +- .../nbextensions/printview/printview.yaml | 2 +- .../nbextensions/qtconsole/qtconsole.yaml | 2 +- .../nbextensions/rubberband/rubberband.yaml | 2 +- .../nbextensions/skip-traceback/skip-traceback.yaml | 2 +- .../nbextensions/toggle_all_line_numbers/main.yaml | 2 +- .../nbextensions/tree-filter/tree-filter.yaml | 2 +- 11 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml b/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml index 527864633..8b87fb752 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/codemirror_mode_extensions/codemirror_mode_extensions.yaml @@ -3,5 +3,8 @@ Name: CodeMirror mode extensions Description: | Extends some CodeMirror modes with extra features. Currently just adds support for comment/uncomment and folding for octave/MATLAB mode. + + ** Deprecated ** + Main: main.js Compatibility: 4.x diff --git a/src/jupyter_contrib_nbextensions/nbextensions/livemdpreview/livemdpreview.yml b/src/jupyter_contrib_nbextensions/nbextensions/livemdpreview/livemdpreview.yml index ed02488fe..cc8cf3713 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/livemdpreview/livemdpreview.yml +++ b/src/jupyter_contrib_nbextensions/nbextensions/livemdpreview/livemdpreview.yml @@ -1,5 +1,5 @@ Type: Jupyter Notebook Extension -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Name: Live Markdown Preview Main: livemdpreview.js Description: | diff --git a/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/README.md b/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/README.md index 0b5cafc60..f8a845251 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/README.md +++ b/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/README.md @@ -5,7 +5,7 @@ Note: Alternatively, it is now possible to use the `keyboard_shortcut_editor` to Initial version for Jupyter 4.0: a bit dirty because it would be better to act on DOM elements and write a correct move_cells() function. New version, updated to Jupyter 4.2+, now takes advantage of `Jupyter.notebook.move_selection_{down, up}` new functions - +*Deprecation warning*: Using deprecated API, might not work above notebook version 6.x. Keyboard shortcuts: *Alt-up* and *Alt-down* (works also with single cells!) diff --git a/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/main.js b/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/main.js index b041f3e00..52c97916d 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/main.js +++ b/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/main.js @@ -40,7 +40,7 @@ define([ help_index: 'ht', handler: function(event) { var ncells = Jupyter.notebook.ncells(); - var s = Jupyter.notebook.get_selected_indices(); + var s = Jupyter.notebook.get_selected_cells_indices(); //ensure cells indices are reverse sorted var ss = s.sort(function(x, y) { return x - y }).reverse(); @@ -58,7 +58,7 @@ define([ help: 'Move selected cells up', help_index: 'ht', handler: function(event) { - var s = Jupyter.notebook.get_selected_indices(); + var s = Jupyter.notebook.get_selected_cells_indices(); //ensure cells indices are sorted var ss = s.sort(function(x, y) { return x - y }); diff --git a/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/move_selected_cells.yaml b/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/move_selected_cells.yaml index fef69c150..c7b2256b1 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/move_selected_cells.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/move_selected_cells/move_selected_cells.yaml @@ -3,4 +3,4 @@ Name: Move selected cells Description: Move selected cell*s* using keybaord shortcuts Alt-up and Alt-down Link: README.md Main: main.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x diff --git a/src/jupyter_contrib_nbextensions/nbextensions/printview/printview.yaml b/src/jupyter_contrib_nbextensions/nbextensions/printview/printview.yaml index c347fa4ab..e67c679d3 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/printview/printview.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/printview/printview.yaml @@ -4,7 +4,7 @@ Description: Calls nbconvert and shows the generated output in a new browser tab Link: readme.md Icon: icon.png Main: main.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: printview_nbconvert_options description: nbconvert options diff --git a/src/jupyter_contrib_nbextensions/nbextensions/qtconsole/qtconsole.yaml b/src/jupyter_contrib_nbextensions/nbextensions/qtconsole/qtconsole.yaml index 102310d81..946a7bb2c 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/qtconsole/qtconsole.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/qtconsole/qtconsole.yaml @@ -3,4 +3,4 @@ Name: Launch QTConsole Link: README.md Description: Launch a QTConsole attached to the running kernel Main: qtconsole.js -Compatibility: 4.x +Compatibility: 4.x, 5.x, 6.x diff --git a/src/jupyter_contrib_nbextensions/nbextensions/rubberband/rubberband.yaml b/src/jupyter_contrib_nbextensions/nbextensions/rubberband/rubberband.yaml index fa643c51a..80cf45eca 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/rubberband/rubberband.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/rubberband/rubberband.yaml @@ -4,4 +4,4 @@ Description: The rubberband extension allows selecting multiple cells Link: readme.md Icon: icon.png Main: main.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x diff --git a/src/jupyter_contrib_nbextensions/nbextensions/skip-traceback/skip-traceback.yaml b/src/jupyter_contrib_nbextensions/nbextensions/skip-traceback/skip-traceback.yaml index e117a1a21..6daf7590a 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/skip-traceback/skip-traceback.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/skip-traceback/skip-traceback.yaml @@ -6,7 +6,7 @@ Description: | Link: readme.md Icon: icon.png Main: main.js -Compatibility: 4.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: skip-traceback.animation_duration diff --git a/src/jupyter_contrib_nbextensions/nbextensions/toggle_all_line_numbers/main.yaml b/src/jupyter_contrib_nbextensions/nbextensions/toggle_all_line_numbers/main.yaml index 48453deea..7fe079143 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/toggle_all_line_numbers/main.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/toggle_all_line_numbers/main.yaml @@ -4,7 +4,7 @@ Description: "Add a toolbar button and hotkey to toggle all cells' line numbers Icon: icon.png Link: readme.md Main: main.js -Compatibility: 3.x, 4.x, 5.x +Compatibility: 3.x, 4.x, 5.x, 6.x Parameters: - name: toggle_all_linenumbers_hotkey description: Hotkey combination to which to bind linenumber-toggling diff --git a/src/jupyter_contrib_nbextensions/nbextensions/tree-filter/tree-filter.yaml b/src/jupyter_contrib_nbextensions/nbextensions/tree-filter/tree-filter.yaml index ef75d16bc..4a3033f2d 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/tree-filter/tree-filter.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/tree-filter/tree-filter.yaml @@ -4,7 +4,7 @@ Description: An extension that allows you to filter by filename in the Jupyter n Link: readme.md Main: index.js Section: tree -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: filter_keyword input_type: string From 38c331ad6cb6359bf1ca405c34c81726d0b181b8 Mon Sep 17 00:00:00 2001 From: Juergen Hasch Date: Wed, 21 Dec 2022 19:01:15 +0100 Subject: [PATCH 3/6] Update nbextension version compatibility --- .../collapsible_headings/collapsible_headings.yaml | 2 +- .../nbextensions/toc2/main.js | 8 ++++---- .../nbextensions/toc2/toc2.js | 8 ++++++-- .../nbextensions/toc2/toc2.yaml | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings/collapsible_headings.yaml b/src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings/collapsible_headings.yaml index ff482c883..66f5f004e 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings/collapsible_headings.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings/collapsible_headings.yaml @@ -1,5 +1,5 @@ Type: Jupyter Notebook Extension -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Name: Collapsible Headings Main: main.js Description: "Allows notebook to have collapsible sections, separated by headings" diff --git a/src/jupyter_contrib_nbextensions/nbextensions/toc2/main.js b/src/jupyter_contrib_nbextensions/nbextensions/toc2/main.js index e44ba5443..cc6498a61 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/toc2/main.js +++ b/src/jupyter_contrib_nbextensions/nbextensions/toc2/main.js @@ -28,7 +28,7 @@ define([ // extra download as html with toc menu function addSaveAsWithToc() { - if (parseFloat(Jupyter.version.substr(0, 3)) >= 5.1) { + if (parseFloat(((typeof sys_info === 'undefined') ? Jupyter.version : sys_info.notebook_version).substr(0, 3)) >= 5.1) { if ($("#download_html_toc").length === 0) { /* Add an entry in the download menu */ var downloadEntry = $('
  • HTML with toc (.html)
  • ') @@ -39,13 +39,13 @@ define([ } } else { /* Add a "save a" menu entry for pre 5.1 versions (needs python kernel) */ - if (IPython.notebook.metadata.kernelspec.language == 'python') { - if ($('#save_html_with_toc').length == 0) { + if (IPython.notebook.metadata.kernelspec.language === 'python') { + if ($('#save_html_with_toc').length === 0) { $('#save_checkpoint').after("
  • ") $('#save_html_with_toc') .append($('').text('Save as HTML (with toc)').attr("href", "#")) .on('click', function (evt) { - if (IPython.notebook.metadata.kernelspec.language == 'python') { + if (IPython.notebook.metadata.kernelspec.language === 'python') { var code = "!jupyter nbconvert '" + IPython.notebook.notebook_name + "' --template toc2"; console.log('[toc2] running:', code); IPython.notebook.kernel.execute(code); diff --git a/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js b/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js index 719fd4cc3..36cbb6f03 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js +++ b/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js @@ -4,7 +4,7 @@ // This means that we're probably embedded in a page, so we need to make // our definition with a specific module name return define('nbextensions/toc2/toc2', deps, callback); -})(['jquery', 'require'], function($, requirejs) { +})(['jquery', 'underscore', 'require', 'jqueryui'], function($, _, requirejs) { "use strict"; var IPython; @@ -586,7 +586,11 @@ // excepting any header which contains an html tag with class 'tocSkip' // eg in ## title , // or the ToC cell. - all_headers = $('.text_cell_render').find('[id]:header:not(:has(.tocSkip))'); + if (liveNotebook) { + all_headers = $('.text_cell_render').find('[id]:header:not(:has(.tocSkip))'); + } else { + all_headers = $('.jp-RenderedMarkdown').find('[id]:header:not(:has(.tocSkip))'); + } var min_lvl = 1 + Number(Boolean(cfg.skip_h1_title)), lbl_ary = []; for (; min_lvl <= 6; min_lvl++) { diff --git a/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.yaml b/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.yaml index 83d5940bd..be6bd0365 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.yaml +++ b/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.yaml @@ -4,7 +4,7 @@ Description: The toc2 extension enables to collect all running headers and displ Link: README.md Icon: icon.png Main: main.js -Compatibility: 4.x, 5.x +Compatibility: 4.x, 5.x, 6.x Parameters: - name: toc2.number_sections description: Automatically number notebook's sections From 46a477a5c00222e434f9ba1db5b9fbbd5fcd0a16 Mon Sep 17 00:00:00 2001 From: Juergen Hasch Date: Wed, 21 Dec 2022 20:25:58 +0100 Subject: [PATCH 4/6] Update CDN links in toc2 template --- src/jupyter_contrib_nbextensions/templates/toc2.tpl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/jupyter_contrib_nbextensions/templates/toc2.tpl b/src/jupyter_contrib_nbextensions/templates/toc2.tpl index 7982f31c6..e651cd58f 100644 --- a/src/jupyter_contrib_nbextensions/templates/toc2.tpl +++ b/src/jupyter_contrib_nbextensions/templates/toc2.tpl @@ -4,15 +4,16 @@ {%- block header -%} {{ super() }} - + - - - + + + + - +