diff --git a/.cache/pip/http-v2/8/1/3/c/c/813cc7096c25ba43edba14a4ab40832db33af638c43e975795995aec.body b/.cache/pip/http-v2/8/1/3/c/c/813cc7096c25ba43edba14a4ab40832db33af638c43e975795995aec.body new file mode 100644 index 0000000000000000000000000000000000000000..2f88de74fe81d1c14f7b6264f282604d2a34e27c Binary files /dev/null and b/.cache/pip/http-v2/8/1/3/c/c/813cc7096c25ba43edba14a4ab40832db33af638c43e975795995aec.body differ diff --git a/.cache/pip/http-v2/8/5/e/f/e/85efe0b09056afaed0a9932320bb2a590a03afe4bc35e3fffc1e85cd.body b/.cache/pip/http-v2/8/5/e/f/e/85efe0b09056afaed0a9932320bb2a590a03afe4bc35e3fffc1e85cd.body new file mode 100644 index 0000000000000000000000000000000000000000..5b7a279b833e11ea977794e2d89d3295e23a1c93 Binary files /dev/null and b/.cache/pip/http-v2/8/5/e/f/e/85efe0b09056afaed0a9932320bb2a590a03afe4bc35e3fffc1e85cd.body differ diff --git a/.cache/pip/http-v2/8/f/4/1/0/8f410bbfc5d1848453018f07fdeb351a0d0ae8a3bcdc5a16f937935c.body b/.cache/pip/http-v2/8/f/4/1/0/8f410bbfc5d1848453018f07fdeb351a0d0ae8a3bcdc5a16f937935c.body new file mode 100644 index 0000000000000000000000000000000000000000..14fa25044476386ac4ab23ced715ba27775a8f44 Binary files /dev/null and b/.cache/pip/http-v2/8/f/4/1/0/8f410bbfc5d1848453018f07fdeb351a0d0ae8a3bcdc5a16f937935c.body differ diff --git a/.cache/pip/http-v2/c/2/0/9/b/c209b6730b4a3a67d7d68f436a023e57f848dcba7c8db3fd04a54862 b/.cache/pip/http-v2/c/2/0/9/b/c209b6730b4a3a67d7d68f436a023e57f848dcba7c8db3fd04a54862 new file mode 100644 index 0000000000000000000000000000000000000000..7f397309670ff25721cf98aa9a2adbc136c72501 Binary files /dev/null and b/.cache/pip/http-v2/c/2/0/9/b/c209b6730b4a3a67d7d68f436a023e57f848dcba7c8db3fd04a54862 differ diff --git a/.cache/pip/http-v2/c/5/4/0/3/c5403a101bbaf526810b4c472004bc3b03b96b7c8118e06c7a081e63.body b/.cache/pip/http-v2/c/5/4/0/3/c5403a101bbaf526810b4c472004bc3b03b96b7c8118e06c7a081e63.body new file mode 100644 index 0000000000000000000000000000000000000000..6c5aa965a5cf81aa1a858ac575b2c1ab0cf86f54 Binary files /dev/null and b/.cache/pip/http-v2/c/5/4/0/3/c5403a101bbaf526810b4c472004bc3b03b96b7c8118e06c7a081e63.body differ diff --git a/.cache/pip/http-v2/f/0/4/f/6/f04f619fe804fd38ac24d3bad7c02b3e6461727bd3a1ce45e316d44a b/.cache/pip/http-v2/f/0/4/f/6/f04f619fe804fd38ac24d3bad7c02b3e6461727bd3a1ce45e316d44a new file mode 100644 index 0000000000000000000000000000000000000000..92d7e83496e1db88abd83281fc5fb4181d0e3134 Binary files /dev/null and b/.cache/pip/http-v2/f/0/4/f/6/f04f619fe804fd38ac24d3bad7c02b3e6461727bd3a1ce45e316d44a differ diff --git a/.cache/pip/http-v2/f/0/4/f/6/f04f619fe804fd38ac24d3bad7c02b3e6461727bd3a1ce45e316d44a.body b/.cache/pip/http-v2/f/0/4/f/6/f04f619fe804fd38ac24d3bad7c02b3e6461727bd3a1ce45e316d44a.body new file mode 100644 index 0000000000000000000000000000000000000000..89666817ec55a553c8894e6284d8632463d79c62 Binary files /dev/null and b/.cache/pip/http-v2/f/0/4/f/6/f04f619fe804fd38ac24d3bad7c02b3e6461727bd3a1ce45e316d44a.body differ diff --git a/.cache/pip/http-v2/f/3/c/4/d/f3c4dedd1435641845fe96a7938402191795947fd69de9d823bd65e1.body b/.cache/pip/http-v2/f/3/c/4/d/f3c4dedd1435641845fe96a7938402191795947fd69de9d823bd65e1.body new file mode 100644 index 0000000000000000000000000000000000000000..d6b0103e7b4a180d05d9febda38651204942309c Binary files /dev/null and b/.cache/pip/http-v2/f/3/c/4/d/f3c4dedd1435641845fe96a7938402191795947fd69de9d823bd65e1.body differ diff --git a/.local/share/jupyter/nbextensions/highlight_selected_word/main.js b/.local/share/jupyter/nbextensions/highlight_selected_word/main.js new file mode 100644 index 0000000000000000000000000000000000000000..f290546e844450ae00211fe38fe4ca8cdafaf139 --- /dev/null +++ b/.local/share/jupyter/nbextensions/highlight_selected_word/main.js @@ -0,0 +1,419 @@ +/** + * Enable highlighting of matching words in cells' CodeMirror editors. + * + * This extension was adapted from the CodeMirror addon + * codemirror/addon/search/match-highlighter.js + */ + +define([ + 'require', + 'jquery', + 'base/js/namespace', + 'notebook/js/cell', + 'notebook/js/codecell', + 'codemirror/lib/codemirror', + // The mark-selection addon is need to ensure that the highlighting styles + // are *not* applied to the actual selection, as otherwise it can become + // difficult to see which is selected vs just highlighted. + 'codemirror/addon/selection/mark-selection' +], function ( + requirejs, + $, + Jupyter, + cell, + codecell, + CodeMirror +) { + 'use strict'; + + var Cell = cell.Cell; + var CodeCell = codecell.CodeCell; + + var mod_name = 'highlight_selected_word'; + var log_prefix = '[' + mod_name + ']'; + var menu_toggle_class = 'highlight_selected_word_toggle'; + + // Parameters (potentially) stored in server config. + // This object gets updated on config load. + var params = { + highlight_across_all_cells: true, + enable_on_load : true, + code_cells_only: false, + delay: 100, + words_only: false, + highlight_only_whole_words: true, + min_chars: 2, + show_token: '[\\w$]', + highlight_color: '#90EE90', + highlight_color_blurred: '#BBFFBB', + highlight_style: 'matchhighlight', + trim: true, + use_toggle_hotkey: false, + toggle_hotkey: 'alt-h', + outlines_only: false, + outline_width: 2, + only_cells_in_scroll: true, + scroll_min_delay: 100, + hide_selections_in_unfocussed: false, + }; + + // these are set on registering the action(s) + var action_names = { + toggle: '', + }; + + /** + * the codemirror matchHighlighter has a separate state object for each cm + * instance, but since our state is global over all cells' editors, we can + * use a single object for simplicity, and don't need to store options + * inside the state, since we have closure-level access to the params + * object above. + */ + var globalState = { + active: false, + timeout: null, // only want one timeout + scrollTimeout: null, + overlay: null, // one overlay suffices, as all cells use the same one + }; + + // define a CodeMirror option for highlighting matches in all cells + CodeMirror.defineOption("highlightSelectionMatchesInJupyterCells", false, function (cm, val, old) { + if (old && old != CodeMirror.Init) { + globalState.active = false; + // remove from all relevant, this can fail gracefully if not present + get_relevant_cells().forEach(function (cell, idx, array) { + cell.code_mirror.removeOverlay(mod_name); + }); + globalState.overlay = null; + clearTimeout(globalState.timeout); + globalState.timeout = null; + cm.off("cursorActivity", callbackCursorActivity); + cm.off("focus", callbackOnFocus); + } + if (val) { + if (cm.hasFocus()) { + globalState.active = true; + highlightMatchesInAllRelevantCells(cm); + } + else { + cm.on("focus", callbackOnFocus); + } + cm.on("cursorActivity", callbackCursorActivity); + } + }); + + /** + * The functions callbackCursorActivity, callbackOnFocus and + * scheduleHighlight are taken without major modification from cm's + * match-highlighter. + * The main difference is using our global state rather than + * match-highlighter's per-cm state, and a different highlighting function + * is scheduled. + */ + function callbackCursorActivity (cm) { + if (globalState.active || cm.hasFocus()) { + scheduleHighlight(cm); + } + } + + function callbackOnFocus (cm) { + // unlike cm match-highlighter, we *do* want to schedule a highight on + // focussing the editor + globalState.active = true; + scheduleHighlight(cm); + } + + function scheduleHighlight (cm) { + clearTimeout(globalState.timeout); + globalState.timeout = setTimeout(function () { highlightMatchesInAllRelevantCells(cm); }, params.delay); + } + + /** + * Adapted from cm match-highlighter's highlightMatches, but adapted to + * use our global state and parameters, plus work either for only the + * current editor, or multiple cells' editors. + */ + function highlightMatchesInAllRelevantCells (cm) { + var newOverlay = null; + + var re = params.show_token === true ? /[\w$]/ : params.show_token; + var from = cm.getCursor('from'); + if (!cm.somethingSelected() && params.show_token) { + var line = cm.getLine(from.line), start = from.ch, end = start; + while (start && re.test(line.charAt(start - 1))) { + --start; + } + while (end < line.length && re.test(line.charAt(end))) { + ++end; + } + if (start < end) { + newOverlay = makeOverlay(line.slice(start, end), re, params.highlight_style); + } + } + else { + var to = cm.getCursor("to"); + if (from.line == to.line) { + if (!params.words_only || isWord(cm, from, to)) { + var selection = cm.getRange(from, to); + if (params.trim) { + selection = selection.replace(/^\s+|\s+$/g, ""); + } + if (selection.length >= params.min_chars) { + var hasBoundary = params.highlight_only_whole_words ? (re instanceof RegExp ? re : /[\w$]/) : false; + newOverlay = makeOverlay(selection, hasBoundary, params.highlight_style); + } + } + } + } + + var siterect = document.getElementById('site').getBoundingClientRect(); + var viewtop = siterect.top, viewbot = siterect.bottom; + var cells = params.highlight_across_all_cells ? get_relevant_cells() : [ + $(cm.getWrapperElement()).closest('.cell').data('cell') + ]; + cells.forEach(function (cell, idx, array) { + // cm.operation to delay updating DOM until all work is done + cell.code_mirror.operation(function () { + cell.code_mirror.removeOverlay(mod_name); + if (newOverlay && is_in_view(cell.element[0], viewtop, viewbot)) { + cell.code_mirror.addOverlay(newOverlay); + } + }); + }); + } + + /** + * isWord, boundariesAround and makeOverlay come pretty much directly from + * Codemirror/addon/search/matchHighlighter + * since they don't use state or config values. + */ + function isWord (cm, from, to) { + var str = cm.getRange(from, to); + if (str.match(/^\w+$/) !== null) { + var pos, chr; + if (from.ch > 0) { + pos = {line: from.line, ch: from.ch - 1}; + chr = cm.getRange(pos, from); + if (chr.match(/\W/) === null) { + return false; + } + } + if (to.ch < cm.getLine(from.line).length) { + pos = {line: to.line, ch: to.ch + 1}; + chr = cm.getRange(to, pos); + if (chr.match(/\W/) === null) { + return false; + } + } + return true; + } + return false; + } + function boundariesAround (stream, re) { + return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) && + (stream.pos == stream.string.length || !re.test(stream.string.charAt(stream.pos))); + } + function makeOverlay (query, hasBoundary, style) { + return { + name: mod_name, + token: function (stream) { + if (stream.match(query) && + (!hasBoundary || boundariesAround(stream, hasBoundary))) { + return style; + } + stream.next(); + if (!stream.skipTo(query.charAt(0))) { + stream.skipToEnd(); + } + } + }; + } + + /** + * Returns true if part of elem is visible between viewtop & viewbot + */ + var is_in_view = function (elem, viewtop, viewbot) { + var rect = elem.getBoundingClientRect(); + // hidden elements show height 0 + return (rect.top < viewbot) && (rect.bottom > viewtop) && rect.height; + } + + /** + * Return an array of cells to which match highlighting is relevant, + * dependent on the code_cells_only parameter + */ + function get_relevant_cells () { + var cells = Jupyter.notebook.get_cells(); + return params.code_cells_only ? cells.filter(function (c) { return (c instanceof CodeCell); }) : cells; + } + + function add_menu_item () { + if ($('#view_menu').find('.' + menu_toggle_class).length < 1) { + var menu_item = $('
  • ') + .appendTo('#view_menu'); + var menu_link = $('') + .text('Highlight selected word') + .addClass(menu_toggle_class) + .attr({ + title: 'Highlight all instances of the selected word in the current editor', + href: '#', + }) + .on('click', function () { toggle_highlight_selected(); }) + .appendTo(menu_item); + $('') + .addClass('fa menu-icon pull-right') + .css({'margin-top': '-2px', 'margin-right': '-16px'}) + .prependTo(menu_link); + } + } + + var throttled_highlight = (function () { + var last, throttle_timeout; + return function throttled_highlight (cm) { + var now = Number(new Date()); + var do_it = function () { + last = Number(new Date()); + highlightMatchesInAllRelevantCells(cm); + }; + var remaining = last + params.scroll_min_delay - now; + if (last && remaining > 0) { + clearTimeout(throttle_timeout); + throttle_timeout = setTimeout(do_it, remaining); + } + else { + last = undefined; // so we will do it first time next streak + do_it(); + } + } + })(); + + function scroll_handler (evt) { + if (globalState.active && Jupyter.notebook.mode === 'edit' && globalState.overlay) { + // add overlay to cells now in view which don't already have it. + // Don't bother removing from those no longer in view, as it would just + // cause more work for the browser, without any benefit + var siterect = document.getElementById('site').getBoundingClientRect(); + get_relevant_cells().forEach(function (cell) { + var cm = cell.code_mirror; + if (is_in_view(cell.element, siterect.top, siterect.bot)) { + var need_it = !cm.state.overlays.some(function(ovr) { + return ovr.modeSpec.name === mod_name; }); + if (need_it) cm.addOverlay(globalState.overlay); + } + }); + } + } + + function toggle_highlight_selected (set_on) { + set_on = (set_on !== undefined) ? set_on : !params.enable_on_load; + // update config to make changes persistent + if (set_on !== params.enable_on_load) { + params.enable_on_load = set_on; + Jupyter.notebook.config.update({highlight_selected_word: {enable_on_load: set_on}}); + } + + // Change defaults for new cells: + var cm_conf = (params.code_cells_only ? CodeCell : Cell).options_default.cm_config; + cm_conf.highlightSelectionMatchesInJupyterCells = cm_conf.styleSelectedText = set_on; + + // And change any existing cells: + get_relevant_cells().forEach(function (cell, idx, array) { + cell.code_mirror.setOption('highlightSelectionMatchesInJupyterCells', set_on); + cell.code_mirror.setOption('styleSelectedText', set_on); + }); + // update menu class + $('.' + menu_toggle_class + ' > .fa').toggleClass('fa-check', set_on); + // bind/unbind scroll handler + $('#site')[ + (params.only_cells_in_scroll && params.scroll_min_delay > 0) ? 'on' : 'off' + ]('scroll', scroll_handler); + console.log(log_prefix, 'toggled', set_on ? 'on' : 'off'); + return set_on; + } + + function register_new_actions () { + action_names.toggle = Jupyter.keyboard_manager.actions.register({ + handler : function (env) { toggle_highlight_selected(); }, + help : "Toggle highlighting of selected word", + icon : 'fa-language', + help_index: 'c1' + }, 'toggle', mod_name); + } + + function bind_hotkeys () { + if (params.use_toggle_hotkey && params.toggle_hotkey) { + Jupyter.keyboard_manager.command_shortcuts.add_shortcut(params.toggle_hotkey, action_names.toggle); + Jupyter.keyboard_manager.edit_shortcuts.add_shortcut(params.toggle_hotkey, action_names.toggle); + } + } + + function insert_css () { + var css = [// in unselected cells, matches have blurred color + // in selected cells, we keep CodeMirror highlight for the actual selection to avoid confusion + '.edit_mode .unselected .CodeMirror .cm-matchhighlight {', + ' background-color: ' + params.highlight_color_blurred + ';', + '}', + + // in active cell, matches which are not the current selection have focussed color + '.edit_mode .CodeMirror.CodeMirror-focused :not(.CodeMirror-selectedtext).cm-matchhighlight {', + ' background-color: ' + params.highlight_color + ';', + '}', + + // in all cells, outline matches have blurred color + '.edit_mode .CodeMirror .cm-matchhighlight-outline {', + ' outline-style: solid;', + ' outline-width: ' + params.outline_width + 'px;', + ' outline-color: ' + params.highlight_color_blurred + ';', + '}', + + // in active cell, outline matches have focussed color + '.edit_mode .CodeMirror.CodeMirror-focused .cm-matchhighlight-outline {', + ' outline-color: ' + params.highlight_color + ';', + '}' + ].join('\n'); + + if (params.hide_selections_in_unfocussed) { + css += [ + // in unselected cells, selections which are not matches should have no background + '.unselected .CodeMirror :not(.cm-matchhighlight).CodeMirror-selected,', + '.unselected .CodeMirror :not(.cm-matchhighlight).CodeMirror-selectedtext {', + ' background: initial;', + '}', + ].join('\n'); + } + + $(' + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +
    +

    The highlighter extension:

      +
    • Firstable, the extension provides several toolbar buttons for highlighting a selected text within a markdown cell. Three different `color schemes' are provided, which can be easily customized in the \textit{stylesheet} highlighter.css. The last button enables to remove all highlightings in the current cell.
    • +
    • This works both when the cell is rendered and when the cell is in edit mode;
    • +
    • In both modes, it is possible to highlight formatted portions of text (In rendered mode, since the selected text loose its formatting, an heuristic is applied to find the best alignment with the actual text)
    • +
    • When no text is selected, the whole cell is highlighted;
    • +
    • The extension also provides two keyboard shortcuts (Alt-G and Alt-H) which fire the highlighting of the selected text.
    • +
    • Highlights can be preserved when exporting to html or to LaTeX -- details are provided in export_highlights
    • +
    +

    +

    Installation:

    The extension can be installed with the nice UI available on jupyter_contrib_nbextensions website, which also allows to enable/disable the extension.

    +

    You may also install the extension from the original repo: issue

    +
    jupyter nbextension install https://rawgit.com/jfbercher/small_nbextensions/master/highlighter.zip  --user
    +
    +

    at the command line.

    +

    Testing:

    Use a code cell with

    +
    %%javascript
    +require("base/js/utils").load_extensions("highlighter/highlighter")
    +
    +

    Automatic load

    You may also automatically load the extension for any notebook via

    +
    jupyter nbextension enable highlighter/highlighter
    +
    + +
    +
    +
    +
    +
    +
    In [2]:
    +
    +
    +
    %%javascript
    +require("base/js/utils").load_extensions("highlighter/highlighter")
    +
    + +
    +
    +
    + +
    +
    + + +
    + + +
    + +
    + +
    + +
    +
    + +
    +
    +
    + + diff --git a/.local/share/jupyter/nbextensions/highlighter/export_highlights.ipynb b/.local/share/jupyter/nbextensions/highlighter/export_highlights.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..05ee5a16e5925d0cfb7324387c53c9af98e0ca34 --- /dev/null +++ b/.local/share/jupyter/nbextensions/highlighter/export_highlights.ipynb @@ -0,0 +1,194 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Exporting the notebook\n", + "\n", + "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:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Short version\n", + "- Html export:\n", + "```bash\n", + " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_html_cfg.py \n", + "```\n", + "- LaTeX export:\n", + "```bash\n", + " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_latex_cfg.py \n", + "```\n", + "where JUPYTER_DATA_DIR can be found from the output of\n", + "```bash\n", + " jupyter --paths\n", + "```\n", + "eg `~/.local/share/jupyter` in my case. Seems to be `c:\\users\\NAME\\AppData\\Roaming\\jupyter` under Windows. \n", + "\n", + "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). " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Html export\n", + "This is quite easy. Actually, highlight formatting embedded in markdown cells is preserved while converting with the standard\n", + "```bash\n", + "jupyter nbconvert file.ipynb\n", + "```\n", + "\n", + "However, the css file is missing and must be added. Here we have several possibilities\n", + "\n", + "- 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 `` 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", + "- 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", + " - 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", + "```bash\n", + " jupyter nbconvert file.ipynb --template highlighter\n", + "```\n", + "\n", + "- 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, it seems that the *full path* to the config file has to be provided. This file resides in the extensions subdirectory of the jupyter_data_dir. The path can be found by looking at the output of\n", + "```bash\n", + " jupyter --paths\n", + "```\n", + "Then the command to issue for converting the notebook to html is\n", + "```bash\n", + " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_html_cfg.py \n", + "```\n", + "\n", + "For instance\n", + "```bash\n", + "jupyter nbconvert tst_highlights.ipynb --config ~/.local/share/jupyter/extensions/highlight_html_cfg.py \n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## LaTeX export\n", + "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", + "\n", + "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", + "\n", + "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", + "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", + "\n", + "Finally, a config file fixes the different options for the conversion. Then the command to issue is simply \n", + "```bash\n", + " jupyter nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_latex_cfg.py \n", + "```\n", + "e.g. \n", + "```bash\n", + "jupyter nbconvert tst_highlights.ipynb --config ~/.local/share/jupyter/extensions/highlight_latex_cfg.py \n", + "```\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Configuring paths\n", + "\n", + "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, 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", + "```bash\n", + "python3 set_paths.py\n", + "```\n", + "Additionaly, you may also have to execute `mv_paths.py` if you installed from the original repo via `jupyter nbextension install ..`\n", + "```bash\n", + "python3 mv_paths.py\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example for embedding the css within the notebook before conversion" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from IPython.core.display import display, HTML\n", + "from jupyter_core.paths import jupyter_config_dir, jupyter_data_dir\n", + "import os\n", + "csspath=os.path.join(jupyter_data_dir(),'nbextensions',\n", + " 'highlighter','highlighter.css')\n", + "HTML('')" + ] + } + ], + "metadata": { + "interactive_sols": { + "cbx_id": 1 + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.4.3+" + }, + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/.local/share/jupyter/nbextensions/highlighter/export_highlights.pdf b/.local/share/jupyter/nbextensions/highlighter/export_highlights.pdf new file mode 100644 index 0000000000000000000000000000000000000000..eea7a587ebf850882667d301a6dc8744b3851f65 Binary files /dev/null and b/.local/share/jupyter/nbextensions/highlighter/export_highlights.pdf differ diff --git a/.local/share/jupyter/nbextensions/highlighter/highlighter.css b/.local/share/jupyter/nbextensions/highlighter/highlighter.css new file mode 100644 index 0000000000000000000000000000000000000000..089d21a267d503ad2c5874160f0336b792097bdb --- /dev/null +++ b/.local/share/jupyter/nbextensions/highlighter/highlighter.css @@ -0,0 +1,98 @@ +.mark { + background-color: #f2ee97; + color: black; + display: inline; +} + +.burk { + background-color: #ff9292; + color: #f9f9f9; + display: inline; +} + +.girk { + background-color: #afe5ad; + color: black; + display: inline; +} + +.birk { + background-color: #83b8f4; + color: #fff; + display: inline; +} + +.pirk { + background-color: #ecb3d2; + color: #000; + display: inline; +} + +/**/ + +button.mark { + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 297 297' style='enable-background:new 0 0 297 297;' xml:space='preserve'%3E%3Cg%3E%3Cg id='XMLID_48_'%3E%3Cg%3E%3Cpath style='fill:%23fff;' d='M63.648,169.162l71.18,71.19l-61.09,12.21c-0.93,0.19-1.78,0.65-2.45,1.32l-9.74,9.74 l-21.17-21.18l9.74-9.73c0.66-0.67,1.12-1.53,1.31-2.45L63.648,169.162z'/%3E%3Cpath style='fill:%23000;' d='M230.278,81.592c2.81,2.81,2.81,7.38,0,10.19l-73.19,73.2c-2.81,2.81-7.38,2.81-10.19,0 l-7.62-7.62c-2.81-2.81-2.81-7.38,0-10.19l73.19-73.2c1.36-1.36,3.17-2.11,5.1-2.11c1.92,0,3.73,0.75,5.09,2.11L230.278,81.592z' /%3E%3Cpolygon style='fill:%23f2ee97;' points='53.918,271.242 45.428,279.732 13.668,269.152 32.748,250.072 '/%3E%3Cpath style='fill:%23f2ee97;' d='M283.918,54.022c4.41,4.41,4.71,11.58,0.68,16.34l-140.34,165.86l-76.48-76.49l165.85-140.34 c4.76-4.02,11.94-3.73,16.34,0.68L283.918,54.022z M241.968,86.682c0-4.3-1.64-8.6-4.91-11.87l-7.61-7.62 c-3.18-3.17-7.39-4.92-11.88-4.92s-8.71,1.75-11.88,4.92l-73.19,73.2c-3.17,3.17-4.92,7.39-4.92,11.87 c0,4.49,1.75,8.71,4.92,11.88l7.62,7.62c3.27,3.27,7.57,4.91,11.87,4.91c4.3,0,8.61-1.64,11.88-4.91l73.19-73.2 C240.328,95.282,241.968,90.982,241.968,86.682z'/%3E%3Cpath d='M290.698,47.242c7.91,7.9,8.44,20.78,1.22,29.31c0,0-143.78,169.92-143.83,169.95c-0.66,0.74-1.55,1.28-2.59,1.49 l-68.46,13.69l-26.92,26.93c-0.92,0.91-2.14,1.4-3.4,1.4c-0.5,0-1.01-0.08-1.51-0.24l-41.93-13.98 c-1.58-0.53-2.77-1.83-3.15-3.45c-0.38-1.61,0.1-3.31,1.28-4.49l40.9-40.9l13.69-68.45c0.22-1.09,0.79-1.99,1.57-2.67 c0.01-0.01,169.87-143.76,169.87-143.76c8.53-7.22,21.41-6.69,29.31,1.22L290.698,47.242z M284.598,70.362 c4.03-4.76,3.73-11.93-0.68-16.34l-33.95-33.95c-4.4-4.41-11.58-4.7-16.34-0.68l-165.85,140.34l76.48,76.49L284.598,70.362z M134.828,240.352l-71.18-71.19l-12.22,61.1c-0.19,0.92-0.65,1.78-1.31,2.45l-9.74,9.73l21.17,21.18l9.74-9.74 c0.67-0.67,1.52-1.13,2.45-1.32L134.828,240.352z M45.428,279.732l8.49-8.49l-21.17-21.17l-19.08,19.08L45.428,279.732z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; +} + +button.highlighter-btn { + height: 24px; + width: 29px; + background-size: 21px; + background-position: center; + border: none; +} + +button.burk { + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 297 297' style='enable-background:new 0 0 297 297;' xml:space='preserve'%3E%3Cg%3E%3Cg id='XMLID_48_'%3E%3Cg%3E%3Cpath style='fill:%23fff;' d='M63.648,169.162l71.18,71.19l-61.09,12.21c-0.93,0.19-1.78,0.65-2.45,1.32l-9.74,9.74 l-21.17-21.18l9.74-9.73c0.66-0.67,1.12-1.53,1.31-2.45L63.648,169.162z'/%3E%3Cpath style='fill:%23000;' d='M230.278,81.592c2.81,2.81,2.81,7.38,0,10.19l-73.19,73.2c-2.81,2.81-7.38,2.81-10.19,0 l-7.62-7.62c-2.81-2.81-2.81-7.38,0-10.19l73.19-73.2c1.36-1.36,3.17-2.11,5.1-2.11c1.92,0,3.73,0.75,5.09,2.11L230.278,81.592z' /%3E%3Cpolygon style='fill:%23ff9292;' points='53.918,271.242 45.428,279.732 13.668,269.152 32.748,250.072 '/%3E%3Cpath style='fill:%23ff9292;' d='M283.918,54.022c4.41,4.41,4.71,11.58,0.68,16.34l-140.34,165.86l-76.48-76.49l165.85-140.34 c4.76-4.02,11.94-3.73,16.34,0.68L283.918,54.022z M241.968,86.682c0-4.3-1.64-8.6-4.91-11.87l-7.61-7.62 c-3.18-3.17-7.39-4.92-11.88-4.92s-8.71,1.75-11.88,4.92l-73.19,73.2c-3.17,3.17-4.92,7.39-4.92,11.87 c0,4.49,1.75,8.71,4.92,11.88l7.62,7.62c3.27,3.27,7.57,4.91,11.87,4.91c4.3,0,8.61-1.64,11.88-4.91l73.19-73.2 C240.328,95.282,241.968,90.982,241.968,86.682z'/%3E%3Cpath d='M290.698,47.242c7.91,7.9,8.44,20.78,1.22,29.31c0,0-143.78,169.92-143.83,169.95c-0.66,0.74-1.55,1.28-2.59,1.49 l-68.46,13.69l-26.92,26.93c-0.92,0.91-2.14,1.4-3.4,1.4c-0.5,0-1.01-0.08-1.51-0.24l-41.93-13.98 c-1.58-0.53-2.77-1.83-3.15-3.45c-0.38-1.61,0.1-3.31,1.28-4.49l40.9-40.9l13.69-68.45c0.22-1.09,0.79-1.99,1.57-2.67 c0.01-0.01,169.87-143.76,169.87-143.76c8.53-7.22,21.41-6.69,29.31,1.22L290.698,47.242z M284.598,70.362 c4.03-4.76,3.73-11.93-0.68-16.34l-33.95-33.95c-4.4-4.41-11.58-4.7-16.34-0.68l-165.85,140.34l76.48,76.49L284.598,70.362z M134.828,240.352l-71.18-71.19l-12.22,61.1c-0.19,0.92-0.65,1.78-1.31,2.45l-9.74,9.73l21.17,21.18l9.74-9.74 c0.67-0.67,1.52-1.13,2.45-1.32L134.828,240.352z M45.428,279.732l8.49-8.49l-21.17-21.17l-19.08,19.08L45.428,279.732z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; +} + +button.girk { + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 297 297' style='enable-background:new 0 0 297 297;' xml:space='preserve'%3E%3Cg%3E%3Cg id='XMLID_48_'%3E%3Cg%3E%3Cpath style='fill:%23fff;' d='M63.648,169.162l71.18,71.19l-61.09,12.21c-0.93,0.19-1.78,0.65-2.45,1.32l-9.74,9.74 l-21.17-21.18l9.74-9.73c0.66-0.67,1.12-1.53,1.31-2.45L63.648,169.162z'/%3E%3Cpath style='fill:%23000;' d='M230.278,81.592c2.81,2.81,2.81,7.38,0,10.19l-73.19,73.2c-2.81,2.81-7.38,2.81-10.19,0 l-7.62-7.62c-2.81-2.81-2.81-7.38,0-10.19l73.19-73.2c1.36-1.36,3.17-2.11,5.1-2.11c1.92,0,3.73,0.75,5.09,2.11L230.278,81.592z' /%3E%3Cpolygon style='fill:%23afe5ad;' points='53.918,271.242 45.428,279.732 13.668,269.152 32.748,250.072 '/%3E%3Cpath style='fill:%23afe5ad;' d='M283.918,54.022c4.41,4.41,4.71,11.58,0.68,16.34l-140.34,165.86l-76.48-76.49l165.85-140.34 c4.76-4.02,11.94-3.73,16.34,0.68L283.918,54.022z M241.968,86.682c0-4.3-1.64-8.6-4.91-11.87l-7.61-7.62 c-3.18-3.17-7.39-4.92-11.88-4.92s-8.71,1.75-11.88,4.92l-73.19,73.2c-3.17,3.17-4.92,7.39-4.92,11.87 c0,4.49,1.75,8.71,4.92,11.88l7.62,7.62c3.27,3.27,7.57,4.91,11.87,4.91c4.3,0,8.61-1.64,11.88-4.91l73.19-73.2 C240.328,95.282,241.968,90.982,241.968,86.682z'/%3E%3Cpath d='M290.698,47.242c7.91,7.9,8.44,20.78,1.22,29.31c0,0-143.78,169.92-143.83,169.95c-0.66,0.74-1.55,1.28-2.59,1.49 l-68.46,13.69l-26.92,26.93c-0.92,0.91-2.14,1.4-3.4,1.4c-0.5,0-1.01-0.08-1.51-0.24l-41.93-13.98 c-1.58-0.53-2.77-1.83-3.15-3.45c-0.38-1.61,0.1-3.31,1.28-4.49l40.9-40.9l13.69-68.45c0.22-1.09,0.79-1.99,1.57-2.67 c0.01-0.01,169.87-143.76,169.87-143.76c8.53-7.22,21.41-6.69,29.31,1.22L290.698,47.242z M284.598,70.362 c4.03-4.76,3.73-11.93-0.68-16.34l-33.95-33.95c-4.4-4.41-11.58-4.7-16.34-0.68l-165.85,140.34l76.48,76.49L284.598,70.362z M134.828,240.352l-71.18-71.19l-12.22,61.1c-0.19,0.92-0.65,1.78-1.31,2.45l-9.74,9.73l21.17,21.18l9.74-9.74 c0.67-0.67,1.52-1.13,2.45-1.32L134.828,240.352z M45.428,279.732l8.49-8.49l-21.17-21.17l-19.08,19.08L45.428,279.732z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; +} + +button.birk { + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 297 297' style='enable-background:new 0 0 297 297;' xml:space='preserve'%3E%3Cg%3E%3Cg id='XMLID_48_'%3E%3Cg%3E%3Cpath style='fill:%23fff;' d='M63.648,169.162l71.18,71.19l-61.09,12.21c-0.93,0.19-1.78,0.65-2.45,1.32l-9.74,9.74 l-21.17-21.18l9.74-9.73c0.66-0.67,1.12-1.53,1.31-2.45L63.648,169.162z'/%3E%3Cpath style='fill:%23000;' d='M230.278,81.592c2.81,2.81,2.81,7.38,0,10.19l-73.19,73.2c-2.81,2.81-7.38,2.81-10.19,0 l-7.62-7.62c-2.81-2.81-2.81-7.38,0-10.19l73.19-73.2c1.36-1.36,3.17-2.11,5.1-2.11c1.92,0,3.73,0.75,5.09,2.11L230.278,81.592z' /%3E%3Cpolygon style='fill:%2383b8f4;' points='53.918,271.242 45.428,279.732 13.668,269.152 32.748,250.072 '/%3E%3Cpath style='fill:%2383b8f4;' d='M283.918,54.022c4.41,4.41,4.71,11.58,0.68,16.34l-140.34,165.86l-76.48-76.49l165.85-140.34 c4.76-4.02,11.94-3.73,16.34,0.68L283.918,54.022z M241.968,86.682c0-4.3-1.64-8.6-4.91-11.87l-7.61-7.62 c-3.18-3.17-7.39-4.92-11.88-4.92s-8.71,1.75-11.88,4.92l-73.19,73.2c-3.17,3.17-4.92,7.39-4.92,11.87 c0,4.49,1.75,8.71,4.92,11.88l7.62,7.62c3.27,3.27,7.57,4.91,11.87,4.91c4.3,0,8.61-1.64,11.88-4.91l73.19-73.2 C240.328,95.282,241.968,90.982,241.968,86.682z'/%3E%3Cpath d='M290.698,47.242c7.91,7.9,8.44,20.78,1.22,29.31c0,0-143.78,169.92-143.83,169.95c-0.66,0.74-1.55,1.28-2.59,1.49 l-68.46,13.69l-26.92,26.93c-0.92,0.91-2.14,1.4-3.4,1.4c-0.5,0-1.01-0.08-1.51-0.24l-41.93-13.98 c-1.58-0.53-2.77-1.83-3.15-3.45c-0.38-1.61,0.1-3.31,1.28-4.49l40.9-40.9l13.69-68.45c0.22-1.09,0.79-1.99,1.57-2.67 c0.01-0.01,169.87-143.76,169.87-143.76c8.53-7.22,21.41-6.69,29.31,1.22L290.698,47.242z M284.598,70.362 c4.03-4.76,3.73-11.93-0.68-16.34l-33.95-33.95c-4.4-4.41-11.58-4.7-16.34-0.68l-165.85,140.34l76.48,76.49L284.598,70.362z M134.828,240.352l-71.18-71.19l-12.22,61.1c-0.19,0.92-0.65,1.78-1.31,2.45l-9.74,9.73l21.17,21.18l9.74-9.74 c0.67-0.67,1.52-1.13,2.45-1.32L134.828,240.352z M45.428,279.732l8.49-8.49l-21.17-21.17l-19.08,19.08L45.428,279.732z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; +} + +button.pirk { + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 297 297' style='enable-background:new 0 0 297 297;' xml:space='preserve'%3E%3Cg%3E%3Cg id='XMLID_48_'%3E%3Cg%3E%3Cpath style='fill:%23fff;' d='M63.648,169.162l71.18,71.19l-61.09,12.21c-0.93,0.19-1.78,0.65-2.45,1.32l-9.74,9.74 l-21.17-21.18l9.74-9.73c0.66-0.67,1.12-1.53,1.31-2.45L63.648,169.162z'/%3E%3Cpath style='fill:%23000;' d='M230.278,81.592c2.81,2.81,2.81,7.38,0,10.19l-73.19,73.2c-2.81,2.81-7.38,2.81-10.19,0 l-7.62-7.62c-2.81-2.81-2.81-7.38,0-10.19l73.19-73.2c1.36-1.36,3.17-2.11,5.1-2.11c1.92,0,3.73,0.75,5.09,2.11L230.278,81.592z' /%3E%3Cpolygon style='fill:%23ecb3d2;' points='53.918,271.242 45.428,279.732 13.668,269.152 32.748,250.072 '/%3E%3Cpath style='fill:%23ecb3d2;' d='M283.918,54.022c4.41,4.41,4.71,11.58,0.68,16.34l-140.34,165.86l-76.48-76.49l165.85-140.34 c4.76-4.02,11.94-3.73,16.34,0.68L283.918,54.022z M241.968,86.682c0-4.3-1.64-8.6-4.91-11.87l-7.61-7.62 c-3.18-3.17-7.39-4.92-11.88-4.92s-8.71,1.75-11.88,4.92l-73.19,73.2c-3.17,3.17-4.92,7.39-4.92,11.87 c0,4.49,1.75,8.71,4.92,11.88l7.62,7.62c3.27,3.27,7.57,4.91,11.87,4.91c4.3,0,8.61-1.64,11.88-4.91l73.19-73.2 C240.328,95.282,241.968,90.982,241.968,86.682z'/%3E%3Cpath d='M290.698,47.242c7.91,7.9,8.44,20.78,1.22,29.31c0,0-143.78,169.92-143.83,169.95c-0.66,0.74-1.55,1.28-2.59,1.49 l-68.46,13.69l-26.92,26.93c-0.92,0.91-2.14,1.4-3.4,1.4c-0.5,0-1.01-0.08-1.51-0.24l-41.93-13.98 c-1.58-0.53-2.77-1.83-3.15-3.45c-0.38-1.61,0.1-3.31,1.28-4.49l40.9-40.9l13.69-68.45c0.22-1.09,0.79-1.99,1.57-2.67 c0.01-0.01,169.87-143.76,169.87-143.76c8.53-7.22,21.41-6.69,29.31,1.22L290.698,47.242z M284.598,70.362 c4.03-4.76,3.73-11.93-0.68-16.34l-33.95-33.95c-4.4-4.41-11.58-4.7-16.34-0.68l-165.85,140.34l76.48,76.49L284.598,70.362z M134.828,240.352l-71.18-71.19l-12.22,61.1c-0.19,0.92-0.65,1.78-1.31,2.45l-9.74,9.73l21.17,21.18l9.74-9.74 c0.67-0.67,1.52-1.13,2.45-1.32L134.828,240.352z M45.428,279.732l8.49-8.49l-21.17-21.17l-19.08,19.08L45.428,279.732z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; +} + +i#menu-hgl, i.highlighter-close { + padding-left: 20px; +} + +#higlighter_menu.btn:focus, #higlighter_menu.btn:active:focus, #higlighter_menu.btn.active:focus, #higlighter_menu.btn.focus, #higlighter_menu.btn:active.focus, #higlighter_menu.btn.active.focus :focus { + outline: 0 !important; +} + +#higlighter_menu { + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512.001 512.001' style='enable-background:new 0 0 512.001 512.001;' xml:space='preserve'%3E%3Cpolygon style='fill:%23FFABCD;' points='387.375,480.658 383.919,157.034 503.991,157.034 500.535,480.658 '/%3E%3Cpolygon style='fill:%23FF6BA6;' points='382.637,161.05 419.416,90.494 468.484,90.494 505.272,161.05 '/%3E%3Cpolygon style='fill:%23FFABCD;' points='418.626,94.51 418.626,43.148 469.274,30.795 469.274,94.51 '/%3E%3Cg%3E%3Cpolygon style='fill:%23FBDF97;' points='230.672,94.51 230.672,43.148 281.33,30.795 281.33,94.51 '/%3E%3Cpolygon style='fill:%23FBDF97;' points='199.422,480.658 195.965,157.034 316.036,157.034 312.58,480.658 '/%3E%3C/g%3E%3Cpolygon style='fill:%23FBC640;' points='194.683,161.05 231.462,90.494 280.539,90.494 317.318,161.05 '/%3E%3Cg%3E%3Cpolygon style='fill:%2344C973;' points='11.466,480.658 8.011,157.034 128.083,157.034 124.626,480.658 '/%3E%3Cpolygon style='fill:%2344C973;' points='42.728,94.51 42.728,43.148 93.375,30.795 93.375,94.51 '/%3E%3C/g%3E%3Cpolygon style='fill:%23248A48;' points='6.729,161.05 43.518,90.494 92.585,90.494 129.364,161.05 '/%3E%3Cpath d='M443.734,375.969c-12.919,0-12.941,20.078,0,20.078C456.653,396.048,456.675,375.969,443.734,375.969z'/%3E%3Cpath d='M13.453,488.689H122.64c5.502,0,9.98-4.43,10.039-9.932l3.413-319.608c0.004-0.354-0.012-0.705-0.044-1.05 c-0.001-0.014-0.004-0.027-0.006-0.041c-0.037-0.382-0.1-0.758-0.18-1.127c-0.02-0.093-0.045-0.185-0.068-0.277 c-0.074-0.305-0.163-0.604-0.264-0.898c-0.031-0.09-0.061-0.181-0.095-0.27c-0.138-0.361-0.289-0.715-0.466-1.055 c-0.005-0.01-0.008-0.02-0.013-0.029l-0.008-0.015c-0.01-0.02-0.021-0.04-0.031-0.06l-33.51-64.284V33.351 c0-3.081-1.416-5.992-3.838-7.895c-2.423-1.903-5.584-2.588-8.58-1.858L42.357,34.972c-4.497,1.097-7.66,5.125-7.66,9.753v45.316 L1.176,154.325c-0.011,0.02-0.021,0.04-0.031,0.06l-0.008,0.015c-0.005,0.009-0.008,0.019-0.012,0.028 c-0.177,0.34-0.328,0.694-0.466,1.055c-0.034,0.09-0.064,0.181-0.096,0.272c-0.101,0.293-0.19,0.592-0.264,0.898 c-0.023,0.092-0.048,0.184-0.068,0.277c-0.079,0.369-0.143,0.744-0.18,1.126c-0.001,0.014-0.005,0.028-0.006,0.042 c-0.032,0.345-0.048,0.697-0.044,1.051l3.413,319.608C3.473,484.259,7.951,488.689,13.453,488.689z M23.386,468.611l-3.198-299.53 h95.719l-3.198,299.53H23.386z M54.775,52.61l26.554-6.476v36.329H54.775V52.61z M50.823,102.541h34.456l24.22,46.461H26.596 L50.823,102.541z'/%3E%3Cpath d='M68.046,215.121c-5.545,0-10.039,4.495-10.039,10.039v160.366c0,5.545,4.495,10.039,10.039,10.039 s10.039-4.495,10.039-10.039V225.16C78.086,219.615,73.591,215.121,68.046,215.121z'/%3E%3Cpath d='M188.518,155.756c-0.102,0.293-0.19,0.592-0.264,0.898c-0.023,0.092-0.048,0.184-0.068,0.277 c-0.079,0.369-0.143,0.744-0.18,1.127c-0.001,0.014-0.005,0.027-0.006,0.041c-0.032,0.345-0.048,0.696-0.044,1.05l3.413,319.608 c0.059,5.501,4.537,9.932,10.039,9.932h109.187c5.502,0,9.98-4.43,10.039-9.932l3.413-319.608c0.004-0.354-0.012-0.705-0.044-1.05 c-0.001-0.014-0.004-0.027-0.006-0.041c-0.037-0.382-0.1-0.758-0.18-1.127c-0.02-0.093-0.045-0.185-0.068-0.277 c-0.074-0.305-0.163-0.604-0.264-0.898c-0.031-0.09-0.061-0.181-0.095-0.27c-0.138-0.361-0.289-0.715-0.466-1.055 c-0.005-0.01-0.008-0.02-0.013-0.029l-0.008-0.015c-0.01-0.02-0.021-0.04-0.031-0.06l-33.511-64.284V33.351 c0-3.081-1.415-5.991-3.838-7.895c-2.422-1.903-5.585-2.588-8.579-1.858l-46.642,11.374c-4.497,1.096-7.661,5.125-7.661,9.753 v45.317l-33.509,64.283c-0.011,0.02-0.021,0.04-0.031,0.06l-0.008,0.015c-0.005,0.009-0.008,0.02-0.013,0.029 c-0.177,0.34-0.328,0.694-0.466,1.055C188.579,155.575,188.549,155.665,188.518,155.756z M211.34,468.611l-3.198-299.53h95.719 l-3.199,299.53H211.34z M242.719,52.61l26.564-6.478v36.331h-26.564L242.719,52.61L242.719,52.61z M238.768,102.541h34.466 l24.22,46.461H214.55L238.768,102.541z'/%3E%3Cpath d='M256.001,215.121c-5.545,0-10.039,4.495-10.039,10.039v160.366c0,5.545,4.495,10.039,10.039,10.039 c5.545,0,10.039-4.495,10.039-10.039V225.16C266.04,219.615,261.545,215.121,256.001,215.121z'/%3E%3Cpath d='M508.587,478.758l3.413-319.608c0.004-0.355-0.012-0.706-0.044-1.051c-0.001-0.014-0.005-0.028-0.006-0.042 c-0.037-0.382-0.1-0.758-0.18-1.126c-0.02-0.092-0.045-0.185-0.068-0.277c-0.074-0.305-0.163-0.604-0.264-0.898 c-0.031-0.091-0.062-0.182-0.096-0.272c-0.138-0.361-0.289-0.715-0.466-1.055c-0.005-0.009-0.008-0.019-0.012-0.028l-0.008-0.015 c-0.01-0.02-0.02-0.04-0.031-0.06l-33.52-64.283v-56.69c0-3.081-1.416-5.992-3.838-7.895c-2.423-1.903-5.585-2.588-8.579-1.858 l-46.632,11.374c-4.497,1.097-7.66,5.125-7.66,9.753v45.317l-33.51,64.283c-0.011,0.02-0.021,0.04-0.031,0.06l-0.008,0.015 c-0.005,0.009-0.008,0.02-0.013,0.029c-0.177,0.34-0.328,0.694-0.466,1.055c-0.034,0.089-0.064,0.18-0.095,0.27 c-0.102,0.293-0.19,0.592-0.264,0.898c-0.023,0.092-0.048,0.184-0.068,0.277c-0.079,0.369-0.143,0.744-0.18,1.127 c-0.001,0.014-0.005,0.027-0.006,0.041c-0.032,0.345-0.048,0.696-0.044,1.05l3.413,319.608c0.059,5.501,4.537,9.932,10.039,9.932 h109.186C504.051,488.689,508.528,484.259,508.587,478.758z M430.673,52.61l26.554-6.476v36.329h-26.554V52.61z M426.723,102.541 h34.456l24.227,46.461h-82.902L426.723,102.541z M399.293,468.611l-3.198-299.53h95.719l-3.199,299.53H399.293z'/%3E%3Cpath d='M443.955,215.121c-5.545,0-10.039,4.495-10.039,10.039v128.221c0,5.545,4.495,10.039,10.039,10.039 s10.039-4.495,10.039-10.039V225.16C453.994,219.615,449.5,215.121,443.955,215.121z'/%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; + background-position-x: 6px; + padding-right: 2px !important; + background-size: 18px; + background-position-y: center; +} + +.toolbar .btn-group { + margin-top: 3px !important; +} + +div#hgl { + padding-top: 2px; +} + +#remove_highlights { + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 297 297' style='enable-background:new 0 0 297 297;' xml:space='preserve'%3E%3Cg%3E%3Cg id='XMLID_48_'%3E%3Cg%3E%3Cpath style='fill:%23fff;' d='M63.648,169.162l71.18,71.19l-61.09,12.21c-0.93,0.19-1.78,0.65-2.45,1.32l-9.74,9.74 l-21.17-21.18l9.74-9.73c0.66-0.67,1.12-1.53,1.31-2.45L63.648,169.162z'/%3E%3Cpath style='fill:%23000;' d='M230.278,81.592c2.81,2.81,2.81,7.38,0,10.19l-73.19,73.2c-2.81,2.81-7.38,2.81-10.19,0 l-7.62-7.62c-2.81-2.81-2.81-7.38,0-10.19l73.19-73.2c1.36-1.36,3.17-2.11,5.1-2.11c1.92,0,3.73,0.75,5.09,2.11L230.278,81.592z' /%3E%3Cpolygon style='fill:%23fff;' points='53.918,271.242 45.428,279.732 13.668,269.152 32.748,250.072 '/%3E%3Cpath style='fill:%23fff;' d='M283.918,54.022c4.41,4.41,4.71,11.58,0.68,16.34l-140.34,165.86l-76.48-76.49l165.85-140.34 c4.76-4.02,11.94-3.73,16.34,0.68L283.918,54.022z M241.968,86.682c0-4.3-1.64-8.6-4.91-11.87l-7.61-7.62 c-3.18-3.17-7.39-4.92-11.88-4.92s-8.71,1.75-11.88,4.92l-73.19,73.2c-3.17,3.17-4.92,7.39-4.92,11.87 c0,4.49,1.75,8.71,4.92,11.88l7.62,7.62c3.27,3.27,7.57,4.91,11.87,4.91c4.3,0,8.61-1.64,11.88-4.91l73.19-73.2 C240.328,95.282,241.968,90.982,241.968,86.682z'/%3E%3Cpath d='M290.698,47.242c7.91,7.9,8.44,20.78,1.22,29.31c0,0-143.78,169.92-143.83,169.95c-0.66,0.74-1.55,1.28-2.59,1.49 l-68.46,13.69l-26.92,26.93c-0.92,0.91-2.14,1.4-3.4,1.4c-0.5,0-1.01-0.08-1.51-0.24l-41.93-13.98 c-1.58-0.53-2.77-1.83-3.15-3.45c-0.38-1.61,0.1-3.31,1.28-4.49l40.9-40.9l13.69-68.45c0.22-1.09,0.79-1.99,1.57-2.67 c0.01-0.01,169.87-143.76,169.87-143.76c8.53-7.22,21.41-6.69,29.31,1.22L290.698,47.242z M284.598,70.362 c4.03-4.76,3.73-11.93-0.68-16.34l-33.95-33.95c-4.4-4.41-11.58-4.7-16.34-0.68l-165.85,140.34l76.48,76.49L284.598,70.362z M134.828,240.352l-71.18-71.19l-12.22,61.1c-0.19,0.92-0.65,1.78-1.31,2.45l-9.74,9.73l21.17,21.18l9.74-9.74 c0.67-0.67,1.52-1.13,2.45-1.32L134.828,240.352z M45.428,279.732l8.49-8.49l-21.17-21.17l-19.08,19.08L45.428,279.732z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; + background-position-x: 6px; + padding-right: 2px !important; + background-size: 18px; + background-position-y: center; +} \ No newline at end of file diff --git a/.local/share/jupyter/nbextensions/highlighter/highlighter.yaml b/.local/share/jupyter/nbextensions/highlighter/highlighter.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fdd56310dd6b6d692af154c09260af9fd853e6c8 --- /dev/null +++ b/.local/share/jupyter/nbextensions/highlighter/highlighter.yaml @@ -0,0 +1,7 @@ +Type: IPython Notebook Extension +Name: highlighter +Description: Enable to highlight select text in a markdown cell +Link: readme.md +Icon: icon.png +Main: highlighter.js +Compatibility: 3.x, 4.x, 5.x diff --git a/.local/share/jupyter/nbextensions/highlighter/tst_highlights.html b/.local/share/jupyter/nbextensions/highlighter/tst_highlights.html new file mode 100644 index 0000000000000000000000000000000000000000..c354a71caf32400b0c28eff0139b208fcc25e154 --- /dev/null +++ b/.local/share/jupyter/nbextensions/highlighter/tst_highlights.html @@ -0,0 +1,218 @@ + + + +tst_highlights + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +
    +

    First cell

    In the first cell, we highlight some words using the different schemes provided.

    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id lacus mauris. Etiam in dictum mauris. Morbi pharetra, mauris a feugiat consequat, est purus vulputate mauris, quis feugiat leo metus eu risus. Sed non luctus arcu. Donec eu ipsum justo. Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar blandit in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at vestibulum congue, lacus ante faucibus dolor, quis varius elit felis id ipsum. Vivamus at mi lorem. Integer quam massa, viverra et fermentum et, cursus faucibus nisl. Vestibulum sed est lacus. Morbi sit amet laoreet odio.

    + +
    +
    +
    +
    +
    +
    +
    +
    +

    +

    Second cell

    The second cell is completely highlighted.

    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id lacus mauris. Etiam in dictum mauris. Morbi pharetra, mauris a feugiat consequat, est purus vulputate mauris, quis feugiat leo metus eu risus. Sed non luctus arcu. Donec eu ipsum justo. Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar blandit in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at vestibulum congue, lacus ante faucibus dolor, quis varius elit felis id ipsum. Vivamus at mi lorem. Integer quam massa, viverra et fermentum et, cursus faucibus nisl. Vestibulum sed est lacus. Morbi sit amet laoreet odio.

    + +
    +
    +
    +
    +
    + + diff --git a/.local/share/jupyter/nbextensions/highlighter/tst_highlights.ipynb b/.local/share/jupyter/nbextensions/highlighter/tst_highlights.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..92394413443945d088b506a0b92f1f8c308a907c --- /dev/null +++ b/.local/share/jupyter/nbextensions/highlighter/tst_highlights.ipynb @@ -0,0 +1,53 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# First cell\n", + "\n", + "In the first cell, we highlight *some words* using the different schemes provided. \n", + "\n", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id lacus mauris. Etiam in dictum mauris. Morbi pharetra, **mauris a feugiat consequat**, est purus vulputate mauris, quis feugiat leo metus eu risus. Sed non luctus arcu. Donec eu ipsum justo. Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar blandit in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at vestibulum congue, lacus ante faucibus dolor, quis varius elit felis id ipsum. Vivamus at mi lorem. Integer quam massa, viverra et fermentum et, cursus faucibus nisl. Vestibulum sed est lacus. Morbi sit amet laoreet odio.\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "
    \n", + "# Second cell\n", + "\n", + "The second cell is completely highlighted. \n", + "\n", + "\n", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id lacus mauris. Etiam in dictum mauris. Morbi pharetra, mauris a feugiat consequat, est purus vulputate mauris, quis feugiat leo metus eu risus. Sed non luctus arcu. Donec eu ipsum justo. Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar blandit in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at vestibulum congue, lacus ante faucibus dolor, quis varius elit felis id ipsum. Vivamus at mi lorem. Integer quam massa, viverra et fermentum et, cursus faucibus nisl. Vestibulum sed est lacus. Morbi sit amet laoreet odio.
    " + ] + } + ], + "metadata": { + "interactive_sols": { + "cbx_id": 1 + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.4.3+" + }, + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/.local/share/jupyter/nbextensions/highlighter/tst_highlights.tex b/.local/share/jupyter/nbextensions/highlighter/tst_highlights.tex new file mode 100644 index 0000000000000000000000000000000000000000..ec4cbc3d17f707f40b7462fc4488a0562cc4e000 --- /dev/null +++ b/.local/share/jupyter/nbextensions/highlighter/tst_highlights.tex @@ -0,0 +1,279 @@ + +% Default to the notebook output style + + +% Inherit from the specified cell style. + + + + + + +\documentclass{article} + + + + + \usepackage{graphicx} % Used to insert images + \usepackage{adjustbox} % Used to constrain images to a maximum size + \usepackage{color} % Allow colors to be defined + \usepackage{enumerate} % Needed for markdown enumerations to work + \usepackage{geometry} % Used to adjust the document margins + \usepackage{amsmath} % Equations + \usepackage{amssymb} % Equations + \usepackage{eurosym} % defines \euro + \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support + \usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document + \usepackage{fancyvrb} % verbatim replacement that allows latex + \usepackage{grffile} % extends the file name processing of package graphics + % to support a larger range + % The hyperref package gives us a pdf with properly built + % internal navigation ('pdf bookmarks' for the table of contents, + % internal cross-reference links, web links for URLs, etc.) + \usepackage{hyperref} + \usepackage{longtable} % longtable support required by pandoc >1.10 + \usepackage{booktabs} % table support for pandoc > 1.12.2 + +\usepackage{color} +\usepackage{soul} +\usepackage[framemethod=tikz]{mdframed} + + + + + \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} + \definecolor{darkorange}{rgb}{.71,0.21,0.01} + \definecolor{darkgreen}{rgb}{.12,.54,.11} + \definecolor{myteal}{rgb}{.26, .44, .56} + \definecolor{gray}{gray}{0.45} + \definecolor{lightgray}{gray}{.95} + \definecolor{mediumgray}{gray}{.8} + \definecolor{inputbackground}{rgb}{.95, .95, .85} + \definecolor{outputbackground}{rgb}{.95, .95, .95} + \definecolor{traceback}{rgb}{1, .95, .95} + % ansi colors + \definecolor{red}{rgb}{.6,0,0} + \definecolor{green}{rgb}{0,.65,0} + \definecolor{brown}{rgb}{0.6,0.6,0} + \definecolor{blue}{rgb}{0,.145,.698} + \definecolor{purple}{rgb}{.698,.145,.698} + \definecolor{cyan}{rgb}{0,.698,.698} + \definecolor{lightgray}{gray}{0.5} + + % bright ansi colors + \definecolor{darkgray}{gray}{0.25} + \definecolor{lightred}{rgb}{1.0,0.39,0.28} + \definecolor{lightgreen}{rgb}{0.48,0.99,0.0} + \definecolor{lightblue}{rgb}{0.53,0.81,0.92} + \definecolor{lightpurple}{rgb}{0.87,0.63,0.87} + \definecolor{lightcyan}{rgb}{0.5,1.0,0.83} + + % commands and environments needed by pandoc snippets + % extracted from the output of `pandoc -s` + \providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} + % Add ',fontsize=\small' for more characters per line + \newenvironment{Shaded}{}{} + \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} + \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} + \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} + \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} + \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} + \newcommand{\RegionMarkerTok}[1]{{#1}} + \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\NormalTok}[1]{{#1}} + + % Define a nice break command that doesn't care if a line doesn't already + % exist. + \def\br{\hspace*{\fill} \\* } + % Math Jax compatability definitions + \def\gt{>} + \def\lt{<} + % Document parameters + \title{tst\_highlights} + + +\author{} + + + + % Pygments definitions + +\makeatletter +\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax% + \let\PY@ul=\relax \let\PY@tc=\relax% + \let\PY@bc=\relax \let\PY@ff=\relax} +\def\PY@tok#1{\csname PY@tok@#1\endcsname} +\def\PY@toks#1+{\ifx\relax#1\empty\else% + \PY@tok{#1}\expandafter\PY@toks\fi} +\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{% + \PY@it{\PY@bf{\PY@ff{#1}}}}}}} +\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}} + +\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}} +\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}} +\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit} +\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}} +\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}} +\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf} +\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}} +\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}} +\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}} +\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}}} +\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}} +\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}} +\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}} +\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}} +\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} + +\def\PYZbs{\char`\\} +\def\PYZus{\char`\_} +\def\PYZob{\char`\{} +\def\PYZcb{\char`\}} +\def\PYZca{\char`\^} +\def\PYZam{\char`\&} +\def\PYZlt{\char`\<} +\def\PYZgt{\char`\>} +\def\PYZsh{\char`\#} +\def\PYZpc{\char`\%} +\def\PYZdl{\char`\$} +\def\PYZhy{\char`\-} +\def\PYZsq{\char`\'} +\def\PYZdq{\char`\"} +\def\PYZti{\char`\~} +% for compatibility with earlier versions +\def\PYZat{@} +\def\PYZlb{[} +\def\PYZrb{]} +\makeatother + + + + + + + % Prevent overflowing lines due to hard-to-break entities + \sloppy + % Setup hyperref package + \hypersetup{ + breaklinks=true, % so long urls are correctly broken across lines + colorlinks=true, + urlcolor=blue, + linkcolor=darkorange, + citecolor=darkgreen, + } + % Slightly bigger margins than the latex defaults + + \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} + + + \newcommand{\highlighta}[1]{{\sethlcolor{yellow} \textcolor{red}{\hl{#1}}}} + \newcommand{\highlightb}[1]{{\sethlcolor{red} \textcolor{yellow}{\hl{#1}}}} + \newcommand{\highlightc}[1]{{\sethlcolor{green} \textcolor{yellow}{\hl{#1}}}} + \newenvironment{highlightA}{\begin{mdframed}[hidealllines=true,backgroundcolor=yellow!20]}{\end{mdframed}} + \newenvironment{highlightB}{\begin{mdframed}[hidealllines=true,backgroundcolor=red!20]}{\end{mdframed}} + \newenvironment{highlightC}{\begin{mdframed}[hidealllines=true,backgroundcolor=green!20]}{\end{mdframed}} + + +%\usepackage{foo} + + \begin{document} + + + \maketitle + + + + + \section{First cell}\label{first-cell} + +\highlighta{In the first cell, we highlight \emph{some words} +using the different schemes provided.} + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id +lacus mauris. Etiam in dictum mauris. \highlightb{Morbi pharetra, +\textbf{mauris a feugiat consequat}, est purus vulputate mauris, quis +feugiat leo metus eu risus. Sed non luctus arcu.} Donec eu ipsum +justo. Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar +blandit in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at +vestibulum congue, lacus ante faucibus dolor, quis varius elit felis id +ipsum. \highlightc{Vivamus at mi lorem.} Integer quam massa, +viverra et fermentum et, cursus faucibus nisl. Vestibulum sed est lacus. +Morbi sit amet laoreet odio. + + \begin{highlightA} + +\section{Second cell}\label{second-cell} + +The second cell is completely highlighted. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id +lacus mauris. Etiam in dictum mauris. Morbi pharetra, mauris a feugiat +consequat, \highlightb{est purus vulputate mauris,} quis +feugiat leo metus eu risus. Sed non luctus arcu. Donec eu ipsum justo. +Praesent sit amet euismod orci. Nam eu turpis quis enim pulvinar blandit +in eu justo. Vivamus nec libero ipsum. Nunc tempus, mi at vestibulum +congue, \highlightc{lacus ante faucibus dolor}, quis varius +elit felis id ipsum. Vivamus at mi lorem. Integer quam massa, viverra et +fermentum et, cursus faucibus nisl. Vestibulum sed est lacus. Morbi sit +amet laoreet odio. \end{highlightA} + + + % Add a bibliography block to the postdoc + + + + \end{document} diff --git a/.local/share/jupyter/nbextensions/hinterland/README.md b/.local/share/jupyter/nbextensions/hinterland/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5a33c75daaaa1f96dfd15e54289928f7400f4c9d --- /dev/null +++ b/.local/share/jupyter/nbextensions/hinterland/README.md @@ -0,0 +1,49 @@ +Hinterland +========== + +Enable code autocompletion menu for every keypress in a code cell, instead of +only calling it with tab. + +The nbextension adds an item to the help menu to turn auto-hinting on and off, +and offers some options for configuration: + + +Options +------- + +* `hinterland.hint_delay`: + delay in milliseconds between keypress & hint request. This is used to help + ensure that the character from the keypress is added to the CodeMirror editor + *before* the hint request checks the character preceding the cursor against + the regexes below. + +* `hinterland.enable_at_start`: + Whether to enable hinterland's continuous hinting when notebook is first + opened, or if false, only when selected from the help-menu item. + +* `hinterland.hint_inside_comments`: + Whether to request hints while typing code comments. Defaults to false. + +* `hinterland.exclude_regexp`: + A regular expression tested against the character before the cursor, which, + if a match occurs, prevents autocompletion from being triggered. This is + useful, for example, to prevent triggering autocomplete on a colon, which is + included by the default Completer.reinvoke pattern. If blank, no test is + performed. Note that the regex will be created without any flags, making it + case sensitive. + +* `hinterland.include_regexp`: + A regular expression tested against the character before the cursor, which + must match in order for autocompletion to be triggered. If left blank, the + value of the notebook's `Completer.reinvoke_re` parameter is used, which can + be modified by kernels, but defaults to `/[%0-9a-z._/\\:~-]/i`. Note that + although the `Completer.reinvoke_re` default is case insensitive by virtue of + its `/i` flag, any regex specified by the user will be created without any + flags, making it case sensitive. + +* `hinterland.tooltip_regexp`: + A regular expression tested against the character before the cursor, which if + it matches, causes a tooltip to be triggered, instead of regular + autocompletion. For python, this is useful for example for function calls, so + the default regex matches opening parentheses. Note that the regex will be + created without any flags, making it case sensitive. diff --git a/.local/share/jupyter/nbextensions/hinterland/hinterland.yaml b/.local/share/jupyter/nbextensions/hinterland/hinterland.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5e60c900e46481d72ef4a1766f396fc76dddd173 --- /dev/null +++ b/.local/share/jupyter/nbextensions/hinterland/hinterland.yaml @@ -0,0 +1,73 @@ +Type: Jupyter Notebook Extension +Main: hinterland.js +Name: Hinterland +Link: README.md +Description: | + Enable code autocompletion menu for every keypress in a code cell, instead of + only enabling it with tab +Compatibility: 4.x, 5.x +Parameters: +- name: hinterland.hint_delay + description: | + delay in milliseconds between keypress & hint request. This is used to help + ensure that the character from the keypress is added to the CodeMirror + editor *before* the hint request checks the character preceding the cursor + against the regexes below. + input_type: number + min: 1 + step: 1 + default: 20 +- name: hinterland.enable_at_start + description: | + Enable hinterland's continuous hinting when notebook is first opened, or + if false, only when selected from the help-menu item. + input_type: checkbox + default: true +- name: hinterland.hint_inside_comments + description: | + Whether to request hints while typing code comments. + input_type: checkbox + default: false +- name: hinterland.exclude_regexp + description: | + exclude_regexp: + A regular expression tested against the character before the cursor, which, + if a match occurs, prevents autocompletion from being triggered. + This is useful, for example, to prevent triggering autocomplete on a colon, + which is included by the default Completer.reinvoke pattern. + If blank, no test is performed. + Note that the regex will be created without any flags, making it case + sensitive. + input_type: text + # note that the YAML single-quoted string allows us to use the \ character + # without escaping it, similar to python's raw string syntax + default: ':' +- name: hinterland.include_regexp + description: | + include_regexp: + A regular expression tested against the character before the cursor, which + must match in order for autocompletion to be triggered. + If left blank, the value of the notebook's Completer.reinvoke_re parameter + is used, which can be modified by kernels, but defaults to + /[%0-9a-z._/\\:~-]/i. + Note that although the Completer.reinvoke_re default is case insensitive by + virtue of its /i flag, any regex specified by the user will be created + without any flags, making it case sensitive. + input_type: text + # note that the YAML single-quoted string allows us to use the \ character + # without escaping it, similar to python's raw string syntax + default: '' +- name: hinterland.tooltip_regexp + description: | + tooltip_regexp: + A regular expression tested against the character before the cursor, which + if it matches, causes a tooltip to be triggered, instead of regular + autocompletion. + For python, this is useful for example for function calls, so the default + regex matches opening parentheses. + Note that the regex will be created without any flags, making it case + sensitive. + input_type: text + # note that the YAML single-quoted string allows us to use the \ character + # without escaping it, similar to python's raw string syntax + default: '\(' diff --git a/.local/share/jupyter/nbextensions/init_cell/README.md b/.local/share/jupyter/nbextensions/init_cell/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d5b184f22742516397307b4d8cad408f5617d2f2 --- /dev/null +++ b/.local/share/jupyter/nbextensions/init_cell/README.md @@ -0,0 +1,44 @@ +init_cell +========= + +Add a cell toolbar selector to mark cells as 'initialization' cells . +Such initialization cells are run: + + * on clicking the provided button in the main toolbar + ![main toolabr button](icon.png) + * by default, on kernel ready notification for trusted notebooks. + This is configurable (see options section). + In untrusted notebooks, a warning is displayed if the cells would otherwise + have been run. + + +Options +------- + +This nbextension provides option configurable using the +[jupyter_nbextensions_configurator](https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator). + +Once the extension is enabled, turn on the cell toolbar within your Notebook using +the "View > Cell Toolbar > Initialization Cell" menu +![Cell Toobar Menu](cell_toolbar_menu.png) + + +The running of initialization cells on kernel ready notification can be +frustrating if your kernel is attached to multiple frontends, or is persistent +between frontend reloads (e.g. reloading the notebook browser page without +killing the kernel). +As such, the option `init_cell.run_on_kernel_ready` in the notebook config +section controls whether this behaviour occurs. +The server's config value can also be overridden on a per-notebook basis by +setting `notebook.metadata.init_cell.run_on_kernel_ready`. + + +Internals +--------- + +Cells are marked as initialization cells in their metadata, as + + cell.metadata.init_cell = true + +The running of initialization cells on kernel ready is bound to the Jupyter +event `kernel_ready.Kernel`. diff --git a/.local/share/jupyter/nbextensions/init_cell/cell_toolbar_menu.png b/.local/share/jupyter/nbextensions/init_cell/cell_toolbar_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..0a2d2ad19f331d6c2a69971354780b84f11335cf Binary files /dev/null and b/.local/share/jupyter/nbextensions/init_cell/cell_toolbar_menu.png differ diff --git a/.local/share/jupyter/nbextensions/init_cell/icon.png b/.local/share/jupyter/nbextensions/init_cell/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8e3ffdbb6b908019c55a3115f1546e998d731da8 Binary files /dev/null and b/.local/share/jupyter/nbextensions/init_cell/icon.png differ diff --git a/.local/share/jupyter/nbextensions/init_cell/init_cell.yaml b/.local/share/jupyter/nbextensions/init_cell/init_cell.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9409a0d4b29ef19faf33d37bb3a63c9355e52156 --- /dev/null +++ b/.local/share/jupyter/nbextensions/init_cell/init_cell.yaml @@ -0,0 +1,17 @@ +Type: Jupyter Notebook Extension +Compatibility: 3.x, 4.x, 5.x +Name: Initialization cells +Main: main.js +Icon: icon.png +Link: README.md +Description: | + Add a cell toolbar selector to mark cells as 'initialization' cells. Such + initialization cells can be run by on clicking the provided button in the + main toolbar, or configurably, run automatically on notebook load. +Parameters: +- name: init_cell.run_on_kernel_ready + description: | + Run input cells whenever a kernel_ready.Kernel event is fired. See readme + for further details. + input_type: checkbox + default: true diff --git a/.local/share/jupyter/nbextensions/init_cell/main.js b/.local/share/jupyter/nbextensions/init_cell/main.js new file mode 100644 index 0000000000000000000000000000000000000000..a971bd8a80c16d8354e7b4efb4c54ef9a209db44 --- /dev/null +++ b/.local/share/jupyter/nbextensions/init_cell/main.js @@ -0,0 +1,157 @@ +define([ + 'jquery', + 'base/js/dialog', + 'base/js/events', + 'base/js/namespace', + 'notebook/js/celltoolbar', + 'notebook/js/codecell', +], function ( + $, + dialog, + events, + Jupyter, + celltoolbar, + codecell +) { + "use strict"; + + var CellToolbar = celltoolbar.CellToolbar; + + var mod_name = 'init_cell'; + var log_prefix = '[' + mod_name + ']'; + var options = { // updated from server's config & nb metadata + run_on_kernel_ready: true, + }; + + var toolbar_preset_name = 'Initialization Cell'; + var init_cell_ui_callback = CellToolbar.utils.checkbox_ui_generator( + toolbar_preset_name, + function setter (cell, value) { + if (value) { + cell.metadata.init_cell = true; + } + else { + delete cell.metadata.init_cell; + } + }, + function getter (cell) { + // if init_cell is undefined, it'll be interpreted as false anyway + return cell.metadata.init_cell; + } + ); + + function count_init_cells () { + console.log(log_prefix, 'counting initialization cells'); + var num = 0; + var cells = Jupyter.notebook.get_cells(); + for (var ii = 0; ii < cells.length; ii++) { + var cell = cells[ii]; + if ((cell instanceof codecell.CodeCell) && cell.metadata.init_cell === true ) { + num++; + } + } + console.log(log_prefix, 'found ' + num + ' initialization cell' + (num !== 1 ? 's' : '')); + return num + } + + function run_init_cells () { + console.log(log_prefix, 'running all initialization cells'); + var num = 0; + var cells = Jupyter.notebook.get_cells(); + for (var ii = 0; ii < cells.length; ii++) { + var cell = cells[ii]; + if ((cell instanceof codecell.CodeCell) && cell.metadata.init_cell === true ) { + cell.execute(); + num++; + } + } + console.log(log_prefix, 'finished running ' + num + ' initialization cell' + (num !== 1 ? 's' : '')); + } + + var load_ipython_extension = function() { + // register action + var prefix = 'auto'; + var action_name = 'run-initialization-cells'; + var action = { + icon: 'fa-calculator', + help: 'Run all initialization cells', + help_index : 'zz', + handler : run_init_cells + }; + var action_full_name = Jupyter.notebook.keyboard_manager.actions.register(action, action_name, prefix); + + // add toolbar button + Jupyter.toolbar.add_buttons_group([action_full_name]); + + // setup things to run on loading config/notebook + Jupyter.notebook.config.loaded + .then(function update_options_from_config () { + $.extend(true, options, Jupyter.notebook.config.data[mod_name]); + }, function (reason) { + console.warn(log_prefix, 'error loading config:', reason); + }) + .then(function () { + if (Jupyter.notebook._fully_loaded) { + callback_notebook_loaded(); + } + events.on('notebook_loaded.Notebook', callback_notebook_loaded); + }).catch(function (reason) { + console.error(log_prefix, 'unhandled error:', reason); + }); + }; + + function callback_notebook_loaded () { + // update from metadata + var md_opts = Jupyter.notebook.metadata[mod_name]; + if (md_opts !== undefined) { + console.log(log_prefix, 'updating options from notebook metadata:', md_opts); + $.extend(true, options, md_opts); + } + + // register celltoolbar presets if they haven't been already + if (CellToolbar.list_presets().indexOf(toolbar_preset_name) < 0) { + // Register a callback to create a UI element for a cell toolbar. + CellToolbar.register_callback('init_cell.is_init_cell', init_cell_ui_callback, 'code'); + // Register a preset of UI elements forming a cell toolbar. + CellToolbar.register_preset(toolbar_preset_name, ['init_cell.is_init_cell'], Jupyter.notebook); + } + + if (options.run_on_kernel_ready) { + var num = count_init_cells(); + + if (num) { + if (Jupyter.notebook.trusted) { + run_init_cells_asap() + } + else { + dialog.modal({ + title : 'Untrusted notebook with initialization code', + body : num + ' initialization code cell' + (num !== 1 ? 's' : '') + ' was found but not run since this notebook is untrusted.', + buttons: { + 'Trust notebook': { + 'class' : 'btn-danger', + 'click' : () => Jupyter.notebook.trust_notebook() + }, + 'Do nothing': {'class' : 'btn-primary'} + }, + notebook: Jupyter.notebook, + keyboard_manager: Jupyter.keyboard_manager, + }); + } + } + } + } + + function run_init_cells_asap () { + if (Jupyter.notebook && Jupyter.notebook.kernel && Jupyter.notebook.kernel.info_reply.status === 'ok') { + // kernel is already ready + run_init_cells(); + } + // whenever a (new) kernel becomes ready, run all initialization cells + events.on('kernel_ready.Kernel', run_init_cells); + } + + return { + load_ipython_extension : load_ipython_extension + }; +}); diff --git a/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/keyboard_shortcut_editor.yaml b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/keyboard_shortcut_editor.yaml new file mode 100644 index 0000000000000000000000000000000000000000..587b58940bbfdfb53cd2a0c6d23871b79a7175fc --- /dev/null +++ b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/keyboard_shortcut_editor.yaml @@ -0,0 +1,12 @@ +Type: IPython Notebook Extension +Compatibility: 4.x, 5.x +Name: Keyboard shortcut editor +Main: main.js +Icon: icon.png +Link: README.md +Description: Edit or remove Jupyter keyboard shortcuts, or add you own new ones +Parameters: +- name: kse_show_rebinds + description: "Show shortcut editing controls in the shortcuts dialog. If this is false, shortcuts can't be edited directly from the notebook, but any existing edits are still applied. Useful essentially just to make the shortcuts dialog a bit cleaner" + input_type: checkbox + default: true diff --git a/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/kse_components.js b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/kse_components.js new file mode 100644 index 0000000000000000000000000000000000000000..30bb116e815be265098579ea428260b2d05acf03 --- /dev/null +++ b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/kse_components.js @@ -0,0 +1,364 @@ +define([ + 'bootstrap', // for modals + 'jquery', + 'base/js/dialog', + 'base/js/utils', + 'base/js/keyboard', + 'notebook/js/quickhelp', + './quickhelp_shim' +], function( + bs, + $, + dialog, + utils, + keyboard, + quickhelp, + quickhelp_shim +){ + "use strict"; + + function only_modifier_event (event) { + // adapted from base/js/keyboard + /** + * Return `true` if the event only contains modifiers keys, false + * otherwise + */ + var key = keyboard.inv_keycodes[event.which]; + return ((event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) && + (key === 'alt'|| key === 'ctrl'|| key === 'meta'|| key === 'shift')); + } + + function editor_build () { + var editor = $('#kse-editor'); + if (editor.length > 0) { + return editor; + } + + editor = $('
    ') + .addClass('kse-editor') + .attr('id', 'kse-editor') + .data({ + 'kse_sequence': [], + 'kse_info': {}, + 'kse_mode': 'command', + 'kse_undefined_key': false + }); + + var form = $('
    ') + .addClass('form') + .appendTo(editor); + + $('
    ') + .addClass('form-group') + .appendTo(form); + + var form_group = $('
    ') + .addClass('form-group has-feedback') + .appendTo(form); + + var input_group = $('
    ') + .addClass('input-group') + .addClass('kse-input-group') + .appendTo(form_group); + + // reset button + var btn = $('') + .addClass('btn btn-default') + .addClass('kse-input-group-reset') + .attr({ + 'title': 'Restart', + 'type': 'button' + }) + .append( + $('') + .addClass('fa fa-repeat') + ) + .on('click', function () { + editor.data({ + 'kse_sequence': [], + 'kse_undefined_key': false + }); + editor_update_input_group(editor); + $(this).blur(); + textcontrol.focus(); + }); + $('
    ') + .addClass('input-group-btn') + .append(btn) + .appendTo(input_group); + + // pretty-displayed shortcut + $('
    ') + .addClass('input-group-addon') + .addClass('kse-input-group-pretty') + .addClass('kse-editor-to') + .appendTo(input_group); + + var textcontrol = $('') + .addClass('form-control') + .addClass('kse-input-group-input') + .attr({ + 'type': 'text', + 'placeholder': 'click here to edit the shortcut' + }) + .on('keydown', editor_handle_shortcut_keydown) + .on('focus', function (evt) { + $(this).attr('placeholder', 'press keys to add to the shortcut'); + }) + .on('blur', function (evt) { + $(this).attr('placeholder', 'click here to edit the shortcut'); + }) + .appendTo(input_group); + + // feedback icon + var form_fdbck = $('') + .addClass('fa fa-lg'); + $('') + .addClass('form-control-feedback') + .append(form_fdbck) + .appendTo(form_group); + + // help for input group + $('') + .addClass('help-block') + .appendTo(form_group); + + return editor; + } + + function editor_update_input_group (editor, seq) { + seq = seq || editor.data('kse_sequence'); + var shortcut = seq.join(','); + var mode = editor.data('kse_mode'); + var have_seq = seq.length > 0; + var valid = have_seq; + + // empty help block + var feedback = editor.find('.form-group.has-feedback:first'); + var help_block = feedback.find('.help-block'); + help_block.empty(); + + var ii; + var has_comma = false; + for (ii = 0; !has_comma && (ii < seq.length); ii++) { + has_comma = seq[ii].indexOf(',') >= 0; + } + + if (has_comma) { + valid = false; + // use HTML Unicode escape for a comma, to get it to look right in the pretty version + shortcut = $.map(seq, function (elem, idx) { + return elem.replace(',', ','); + }).join(','); + + $('

    ') + .html( + 'Unfortunately, Jupyter\'s handling of shortcuts containing ' + + 'commas (,) is fundamentally flawed, ' + + 'as the comma is used as the key-separator character ☹. ' + + 'Please try something else for your rebind!' + ) + .appendTo(help_block); + } + else if (have_seq) { + var conflicts = {}; + var tree; + + // get existing shortcuts + if (Jupyter.keyboard_manager !== undefined) { + var startkey = seq.slice(0, 1)[0]; + if (mode === 'command') { + tree = Jupyter.keyboard_manager.command_shortcuts.get_shortcut(startkey); + } + else { + tree = Jupyter.keyboard_manager.edit_shortcuts.get_shortcut(startkey); + // deal with codemirror shortcuts specially, since they're not included in kbm + for (var jj = 0; jj < quickhelp.cm_shortcuts.length; jj++) { + var cm_shrt = quickhelp.cm_shortcuts[jj]; + if (keyboard.normalize_shortcut(cm_shrt.shortcut) === startkey) { + tree = cm_shrt.help; + break; + } + } + } + } + + // check for conflicting shortcuts. + // Start at 1 because we got tree from startkey + for (ii = 1; (ii < seq.length) && (tree !== undefined); ii++) { + // check for exsiting definitions at current specificity + if (typeof(tree) === 'string') { + valid = false; + conflicts[seq.slice(0, ii).join(',')] = tree; + break; + } + tree = tree[seq[ii]]; + } + + // check whether any more-specific shortcuts were defined + if ((ii === seq.length) && (tree !== undefined)) { + valid = false; + var flatten_conflict_tree = function flatten_conflict_tree (obj, key) { + if (typeof(obj) === 'string') { + conflicts[key] = obj; + } + else for (var subkey in obj) { + if (obj.hasOwnProperty(subkey)) { + flatten_conflict_tree(obj[key], [key, subkey].join(',')); + } + } + }; + flatten_conflict_tree(tree, seq.join(',')); + } + + if (!valid) { + var plural = Object.keys(conflicts).length != 1; + $('

    ') + .append(quickhelp.humanize_sequence(seq.join(','))) + .append( + ' conflicts with the' + (plural ? ' following' : '') + + ' existing shortcut' + (plural ? 's' : '') + ':' + ) + .appendTo(help_block); + + for (var conflicting_shortcut in conflicts) { + if (conflicts.hasOwnProperty(conflicting_shortcut)) { + $('

    ') + .append(quickhelp.humanize_sequence(conflicting_shortcut)) + .append($('').text(conflicts[conflicting_shortcut])) + .appendTo(help_block); + } + } + } + } + + if (editor.data('kse_undefined_key')) { + var warning = $('') + .addClass('form-group has-feedback has-warning kse-undefined') + .append( + $('') + .addClass('help-block') + .append( + $('

    ').text('Unrecognised key! (code ' + editor.data('kse_undefined_key' ) + ')') + ) + ); + + var existing = editor.find('.kse-undefined'); + if (existing.length > 0) { + existing.replaceWith(warning); + } + else { + warning.insertAfter(feedback); + } + setTimeout(function () { + warning.remove(); + }, 2000); + } + + // disable reset button if no sequence + editor.find('.kse-input-group-reset') + .toggleClass('disabled', !have_seq); + + editor.find('.kse-input-group-pretty') + .html(shortcut ? quickhelp.humanize_sequence(shortcut) : '<new shortcut>'); + + feedback + .toggleClass('has-error', !valid && have_seq) + .toggleClass('has-success', valid && have_seq) + .find('.form-control-feedback .fa') + .toggleClass('fa-remove', !valid && have_seq) + .toggleClass('fa-check', valid && have_seq); + } + + function editor_handle_shortcut_keydown (evt) { + var elem = $(evt.delegateTarget); + if (!only_modifier_event(evt)) { + var shortcut = keyboard.normalize_shortcut(keyboard.event_to_shortcut(evt)); + var editor = elem.closest('#kse-editor'); + var seq = editor.data('kse_sequence'); + var has_undefined_key = (shortcut.toLowerCase().indexOf('undefined') !== -1); + editor.data('kse_undefined_key', has_undefined_key); + if (has_undefined_key) { + // deal with things like ~ appearing on apple alt-n, or ¨ on alt-u + editor.find('.kse-input-group-input').val(''); + editor.data('kse_undefined_key', evt.which || true); + } + else { + seq.push(shortcut); + } + editor_update_input_group(editor, seq); + } + } + + function modal_build (editor, modal_options) { + var modal = $('#kse-editor-modal'); + if (modal.length > 0) { + return modal; + } + + var default_modal_options = { + 'destroy': false, + 'show': false, + 'title': 'Edit keyboard shortcut', + 'body': editor, + 'buttons': { + 'OK': {'class': 'btn-primary'}, + 'Cancel': {} + }, + 'open': function (evt) { + $(this).find('.kse-input-group-input').focus(); + } + }; + if (Jupyter.notebook !== undefined) { + default_modal_options.notebook = Jupyter.notebook; + } + if (Jupyter.keyboard_manager !== undefined) { + default_modal_options.keyboard_manager= Jupyter.keyboard_manager; + } + modal_options = $.extend({}, default_modal_options, modal_options); + + modal = dialog.modal(modal_options); + + modal + .addClass('modal_stretch') + .attr('id', 'kse-editor-modal'); + + // Add a data-target attribute to ensure buttons only target the editor modal + modal.find('.close,.modal-footer button') + .attr('data-target', '#kse-editor-modal'); + + return modal; + } + + /** + * Pass it an option dictionary with any of the bootstrap or base/js/dialog + * modal options, plus the following optional properties: + * - description: html for the form group preceding the editor group, + * useful as a description + */ + function KSE_modal (modal_options) { + var editor = editor_build(); + editor.data({'kse_sequence': [], 'kse_undefined_key': false}); + editor_update_input_group(editor); + var modal = modal_build(editor, modal_options); + + editor.on('keydown', '.kse-input-group-input', function (evt) { + event.preventDefault(); + event.stopPropagation(); + return false; + }); + + if (modal_options.description) { + modal.find('.modal-body .form-group:first').html(modal_options.description); + } + + return modal; + } + + return { + editor_build : editor_build, + editor_update_input_group: editor_update_input_group, + modal_build : modal_build, + KSE_modal : KSE_modal + }; +}); diff --git a/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/main.css b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/main.css new file mode 100644 index 0000000000000000000000000000000000000000..22e7b9ccab8216727fa3f7929ce1e4d77eeee141 --- /dev/null +++ b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/main.css @@ -0,0 +1,40 @@ +.kse-dropdown { + margin-left: 0.5em; +} + +.kse-dropdown > .dropdown-menu { + min-width: 0; + top: 20px; +} + +.kse-input-group-pretty { + min-width: 20ex; +} + +.kse-modal-backdrop { + background-color: #fff; +} + +.kse-input-group-reset, +.kse-input-group-pretty { + border-right: none; +} + +.kse-input-group-pretty > kbd { + color: black; + font-weight: bold; +} + +.kse-editor .help-block > p { + margin-bottom: 10px; +} + +.kse-editor select { + display: inline-block; + width: auto; + margin: 0; +} + +.kse-links .fa { + margin-right: 2px; +} \ No newline at end of file diff --git a/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/main.js b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/main.js new file mode 100644 index 0000000000000000000000000000000000000000..736aa920ef057a60606bd8666ebd580bfdd68620 --- /dev/null +++ b/.local/share/jupyter/nbextensions/keyboard_shortcut_editor/main.js @@ -0,0 +1,778 @@ +define([ + 'jquery', + 'require', + 'base/js/namespace', + 'base/js/dialog', + 'base/js/events', + 'base/js/keyboard', + 'notebook/js/quickhelp', + './quickhelp_shim', + './kse_components', +], function ( + $, + requirejs, + Jupyter, + dialog, + events, + keyboard, + quickhelp, + qh_shim, + kse_comp +) { + "use strict"; + + var mod_name = 'keyboard_shortcut_editor'; + + // define default values for config parameters + var params = { + 'kse_show_rebinds': true, + // mode, action name, new combo + 'kse_rebinds': { + // command-mode rebindings + 'command': [ + // { // disable the default 'space' shortcut, which used to scroll the notebook down + // from: "space", + // action_name: "jupyter-notebook:scroll-notebook-down" + // }, + // { // create a new shortcut 't,t' to trust the notebook + // action_name: "jupyter-notebook:trust-notebook", + // to: "t,t" + // }, + // { // change the default save-notebook shortcut from 's' to 'shift-s' + // action_name: "jupyter-notebook:save-notebook", + // to: "shift-s", + // from: "s" + // } + ], + // edit-mode rebindings: + "edit": [ + // { // disable the default edit-mode binding which switches to command mode + // action_name: "jupyter-notebook:enter-command-mode", + // from: "ctrl-m" + // } + ] + } + }; + // function to update params with any specified in the server's config file + function update_params () { + var config = Jupyter.notebook.config; + for (var key in params) { + if (config.data.hasOwnProperty(key)) { + params[key] = config.data[key]; + } + } + } + + function add_css (url) { + $('') + .attr({ + 'rel': 'stylesheet', + 'type': 'text/css', + 'href': requirejs.toUrl(url) + }) + .appendTo($('head')); + } + + var kbm = Jupyter.keyboard_manager; + var deleted_shortcuts = { + 'command': new keyboard.ShortcutManager(undefined, kbm.command_shortcuts.events, kbm.actions, kbm.env), + 'edit': new keyboard.ShortcutManager(undefined, kbm.edit_shortcuts.events, kbm.actions, kbm.env) + }; + + var patched_quickhelp_prototype = false; + var patched_shortcut_manager_prototype = false; + + function patch_shortcut_manager_prototype () { + if (!patched_shortcut_manager_prototype) { + var orig_add_shortcut = keyboard.ShortcutManager.prototype.add_shortcut; + keyboard.ShortcutManager.prototype.add_shortcut = function add_shortcut (shortcut, data, suppress_help_update, called_by_rebinder) { + if (!called_by_rebinder) { + var this_mode; + if (this === kbm.edit_shortcuts) { + this_mode = 'edit'; + } + else if (this === kbm.command_shortcuts) { + this_mode = 'command'; + } + if (this_mode) { + var rebind_specs = params.kse_rebinds[this_mode]; + for (var ii = 0; ii < rebind_specs.length; ii++) { + var spec = rebind_specs[ii]; + if (spec.from === shortcut) { + if (!spec.to) { + return; + } + shortcut = spec.to; + } + } + } + } + return orig_add_shortcut.call(this, shortcut, data, suppress_help_update); + }; + console.log('[' + mod_name + '] patched ShortcutManager.prototype.add_shortcut'); + patched_shortcut_manager_prototype = true; + } + } + + function patch_quickhelp_prototype () { + if (!patched_quickhelp_prototype) { + var orig_build_command_help = quickhelp.QuickHelp.prototype.build_command_help; + quickhelp.QuickHelp.prototype.build_command_help = function () { + var div = orig_build_command_help.call(this); + return quickhelp_div_add_rebind_controls(div, 'command'); + }; + console.log('[' + mod_name + '] patched QuickHelp.prototype.build_command_help'); + + var orig_build_edit_help = quickhelp.QuickHelp.prototype.build_edit_help; + quickhelp.QuickHelp.prototype.build_edit_help = function (cm_shortcuts) { + var div = orig_build_edit_help.call(this, cm_shortcuts); + return quickhelp_div_add_rebind_controls(div, 'edit'); + }; + console.log('[' + mod_name + '] patched QuickHelp.prototype.build_edit_help'); + + patched_quickhelp_prototype = true; + } + } + + function load_jupyter_extension () { + add_css('./main.css'); + patch_shortcut_manager_prototype(); + patch_quickhelp_prototype(); + Jupyter.notebook.config.loaded.then(initialize); + } + + function get_mode_shortcuts (mode, deleted) { + if (deleted) { + return deleted_shortcuts[mode]; + } + else if (mode === 'command') { + return kbm.command_shortcuts; + } + else if (mode === 'edit') { + return kbm.edit_shortcuts; + } + return undefined; + } + + function rebind (mode, spec, suppress_help_update) { + var shortcuts = get_mode_shortcuts(mode); + if (spec.action_name === undefined) { + spec.action_name = shortcuts.get_shortcut(spec.from); + } + if (!shortcuts.actions.exists(spec.action_name)) { + console.warn( + '[' + mod_name + '] ' + + 'rebind specified for unrecognised action "' + + spec.action_name + '"' + + (spec.from ? ' from ' + spec.from : '') + + (spec.to ? ' to ' + spec.to : '') + ); + } + else { + console.log( + '[' + mod_name + '] ' + + (spec.from ? (spec.to ? 're' : 'un') : '') + 'bound ' + + spec.action_name + + (spec.from ? ' from ' + spec.from : '') + + (spec.to ? ' to ' + spec.to : '') + ); + + if (spec.from) { + if (!spec.to) { + deleted_shortcuts[mode].add_shortcut(spec.from, spec.action_name, true, true); + } + shortcuts.remove_shortcut(spec.from); + } + if (spec.to) { + return shortcuts.add_shortcut(spec.to, spec.action_name, suppress_help_update, true); + } + } + } + + function apply_config_rebinds () { + var modes = ['command', 'edit']; + for (var mm = 0; mm < modes.length; mm++) { + var mode = modes[mm]; + if (params.kse_rebinds.hasOwnProperty(mode)) { + var rebind_specs = params.kse_rebinds[mode]; + for (var ii = 0; ii < rebind_specs.length; ii++) { + rebind(mode, rebind_specs[ii], true); + } + } + } + events.trigger('rebuild.QuickHelp'); + } + + var initialize = function () { + update_params(); + apply_config_rebinds(); + var title = $('#keyboard_shortcuts').attr('title'); + $('#keyboard_shortcuts').attr('title', title + ' & controls to edit them'); + }; + + function reverse_spec (spec) { + var new_spec = {action_name: spec.action_name}; + if (spec.from) { + new_spec.to = spec.from; + } + if (spec.to) { + new_spec.from = spec.to; + } + return new_spec; + } + + function find_rebinding (rebinds, partial_spec, index_only) { + for (var ii = 0; ii < rebinds.length; ii++) { + if (((partial_spec.to === undefined) || + (partial_spec.to === rebinds[ii].to)) && + ((partial_spec.from === undefined) || + (partial_spec.from === rebinds[ii].from)) && + ((partial_spec.action_name === undefined) || + (partial_spec.action_name === rebinds[ii].action_name))) { + return index_only ? ii : rebinds[ii]; + } + } + return undefined; + } + + function register_rebinding (mode, spec) { + var rebinds = params.kse_rebinds[mode]; + rebinds.push($.extend({}, spec)); + // write our private copy to the config: + Jupyter.notebook.config.update(params); + console.log('[' + mod_name + '] rebinding added:', spec); + } + + function deregister_rebinding (mode, partial_spec) { + var rebinds = params.kse_rebinds[mode]; + var idx = find_rebinding(rebinds, partial_spec, true); + if (idx === undefined) { + console.warn('[' + mod_name + '] attempted to delete non-exsitent shortcut:', partial_spec); + return undefined; + } + var deleted = rebinds.splice(idx, 1)[0]; + // write our private copy to the config: + Jupyter.notebook.config.update(params); + console.log('[' + mod_name + '] rebinding removed:', deleted); + return deleted; + } + + function action_selector (default_pair) { + var select = $('') + .attr('id', 'permissions-select') + .attr('class', 'permissions-list form-control select-xs') + .append($('

    '); + $("#header").append(rubberband_div); + } + + /* expose functions to other extensions */ + var rubberband = { + load_ipython_extension : load_ipython_extension, + }; + return rubberband; +}); diff --git a/.local/share/jupyter/nbextensions/runtools/icon.png b/.local/share/jupyter/nbextensions/runtools/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1c44340568838ae33f0a563518f2e9a3ce421802 Binary files /dev/null and b/.local/share/jupyter/nbextensions/runtools/icon.png differ diff --git a/.local/share/jupyter/nbextensions/scratchpad/scratchpad.css b/.local/share/jupyter/nbextensions/scratchpad/scratchpad.css new file mode 100644 index 0000000000000000000000000000000000000000..be57a94fba8d1f6ee25ed6dc09263ed85210eda5 --- /dev/null +++ b/.local/share/jupyter/nbextensions/scratchpad/scratchpad.css @@ -0,0 +1,39 @@ +#nbextension-scratchpad { + position: absolute; + right: 0; + bottom: 0; + width: 50%; + background-color: #F8F5E1; + border-left: 1px solid #aaa; + border-top: 1px solid #aaa; + z-index: 105; +} + +#nbextension-scratchpad .cell-wrapper { + height: 100%; + overflow: auto; +} + +.scratchpad-btn { + float: right; + margin-right: 24px; + opacity: 0.2; + font-size: 24px; + z-index: 106; +} + +.scratchpad-btn:hover { + opacity: 1; +} + +.scratchpad-close { + display: none; + position: absolute; + float: right; + bottom: 8px; + right: 0; +} + +.scratchpad-open { + margin-top: -32px; +} diff --git a/.local/share/jupyter/nbextensions/skip-traceback/readme.md b/.local/share/jupyter/nbextensions/skip-traceback/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..a40f50c13ff7d71fb29ac9c559d4c399b7c96574 --- /dev/null +++ b/.local/share/jupyter/nbextensions/skip-traceback/readme.md @@ -0,0 +1,80 @@ +Skip traceback +============== + +This nbextension hides error tracebacks, displaying instead a summary of the +error name and type. Clicking the summary displays the whole traceback. + + +Example +------- + +With normal traceback: + +![](traceback.png) + +With nbextension enabled: + +![](skip-traceback.png) + + + +Using the (optional) toolbar button, you can show or hide all tracebacks in the +notebook at once. + + +Options +------- + +The nbextension provides a few options, the values of which are stored in the +notebook section of the nbconfig. The easiest way to configure these is using +the +[jupyter_nbextensions_configurator](https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator) +serverextension, but you can also configure them directly with a few lines of +python. + +The available options are: + +* `skip-traceback.animation_duration` - duration (in milliseconds) of the + show/hide traceback animations. Defaults to `100`. + +* `skip-traceback.button_icon` - a + [fontawesome](https://fontawesome.com/icons) + class name, used for the action and toolbar button. + Defaults to `fa-warning`. + +* `skip-traceback.show_copy_buttons` - add buttons to headings to copy the + full traceback to the clipboard. Defaults to `true`. + +* `skip-traceback.use_toolbar_button` - add a button to the toolbar which can + be used to toggle on or off the contracted display of all cells' tracebacks. + Defaults to `false`. + +* `skip-traceback.enable` - enable collapsing the tracebacks on loading the + nbextension. Defaults to `true` + + +For example, to set the animation time to half a second, and enable adding the +toolbar button, we can use the following python snippet: + +```python +from notebook.services.config import ConfigManager +cm = ConfigManager() +cm.update("notebook", {"skip-traceback": { + "animation_duration": 500, + "use_toolbar_button": True, +}}) +``` + + +Internals +--------- + +This extensions works by overriding the `OutputArea.prototype.append_error` +function to add a header above the error text, which can be used to show or +hide the traceback. + +On loading the extension, only outputs added to cells after the `append_error` +method has been patched are initially affected. In order to apply the collapse +to pre-existing outputs, the nbextension loops through existing uncollapsed +tracebacks, storing them to json, clearing them, then restoring them from the +saved json. diff --git a/.local/share/jupyter/nbextensions/skip-traceback/skip-traceback.yaml b/.local/share/jupyter/nbextensions/skip-traceback/skip-traceback.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e117a1a212dd0b781ab500ff7489d3c68f5c0b25 --- /dev/null +++ b/.local/share/jupyter/nbextensions/skip-traceback/skip-traceback.yaml @@ -0,0 +1,45 @@ +Type: Jupyter Notebook Extension +Name: Skip-Traceback +Description: | + Hide error tracebacks, displaying instead a summary of the error name and + type. Clicking the summary displays the whole traceback. +Link: readme.md +Icon: icon.png +Main: main.js +Compatibility: 4.x +Parameters: + + - name: skip-traceback.animation_duration + description: | + duration (in milliseconds) of the show/hide traceback animations + input_type: number + min: 0 + step: 10 + default: 100 + + - name: skip-traceback.button_icon + description: | + a fontawesome (https://fontawesome.com/icons) class name, used for the + action and toolbar button. + input_type: text + default: fa-warning + + - name: skip-traceback.show_copy_buttons + description: | + Add buttons to headings to copy the full traceback to the clipboard + input_type: checkbox + default: true + + - name: skip-traceback.enable + description: | + enable collapsing tracebacks on loading the nbextension + input_type: checkbox + default: true + + - name: skip-traceback.use_toolbar_button + description: | + add a button to the toolbar which can be used to toggle on or off the + contracted display of all cells' tracebacks at once. + input_type: checkbox + default: false + diff --git a/.local/share/jupyter/nbextensions/snippets/snippets.json b/.local/share/jupyter/nbextensions/snippets/snippets.json new file mode 100644 index 0000000000000000000000000000000000000000..5913adbcfae7a201c771429e426ba2ec7449679e --- /dev/null +++ b/.local/share/jupyter/nbextensions/snippets/snippets.json @@ -0,0 +1,14 @@ +{ + "snippets" : [ + { + "name" : "example", + "code" : [ + "# This is an example snippet!", + "# To create your own, add a new snippet block to the", + "# snippets.json file in your jupyter nbextensions directory:", + "# /nbextensions/snippets/snippets.json", + "import this" + ] + } + ] +} diff --git a/.local/share/jupyter/nbextensions/snippets_menu/screenshot2.png b/.local/share/jupyter/nbextensions/snippets_menu/screenshot2.png new file mode 100644 index 0000000000000000000000000000000000000000..63291f28557bf6840145ac091aafab94476730fb Binary files /dev/null and b/.local/share/jupyter/nbextensions/snippets_menu/screenshot2.png differ diff --git a/.local/share/jupyter/nbextensions/snippets_menu/snippets_submenu_markdown.js b/.local/share/jupyter/nbextensions/snippets_menu/snippets_submenu_markdown.js new file mode 100644 index 0000000000000000000000000000000000000000..163483fe858250389a25c800e54526646ad6c0cd --- /dev/null +++ b/.local/share/jupyter/nbextensions/snippets_menu/snippets_submenu_markdown.js @@ -0,0 +1,110 @@ +define({ + 'name' : 'Markdown', + 'sub-menu' : [ + { + 'name' : 'Documentation', + 'external-link' : 'https://help.github.com/articles/github-flavored-markdown/', + }, + '---', + + { + 'name' : 'Insert itemized list', + 'snippet' : [ + '* One', + ' - Sublist', + ' - This', + ' - Sublist', + ' - That', + ' - The other thing', + '* Two', + ' - Sublist', + '* Three', + ' - Sublist', + ], + }, + + { + 'name' : 'Insert enumerated list', + 'snippet' : [ + '1. Here we go', + ' 1. Sublist', + ' 2. Sublist', + '2. There we go', + '3. Now this', + ], + }, + + { + 'name' : 'Insert table', + 'snippet' : [ + '', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + '
    Header 1Header 2
    row 1, cell 1row 1, cell 2
    row 2, cell 1row 2, cell 2
    ', + ], + }, + + { + 'name' : 'Insert local image', + 'snippet' : [ + '', + ], + }, + + { + 'name' : 'Insert local video', + 'snippet' : [ + '