Package: jupyterlab-courselevels
jupyterlab_courselevelsJupyterLab extension todisplay cells in colors based on their intended audience level; the color codes follows the logic of ski tracksgreen : basic - all students should know thatblue : intermediate - if you want to dig a little morered : advanced - for the geeksin addition some cells may show up with a surrounding frame, to emphasize the course structurethe extension also comes with convenience tools to manage admonitionsImportant limitationbecause of the way MyST markdown is rendered, colors and frames are correctly
rendered within Jupyter Lab, but they willnot render properly on code cells in
the jupyter-book outputFor this reason, colors and frames are no longer relevant on markdown cells,
and we use admonition insteadRequirementsJupyterLab >= 4.0.0InstallTo install the extension, execute:pipinstalljupyterlab_courselevelsUninstallTo remove the extension, execute:pipuninstalljupyterlab_courselevelsmisc commandscommandkeybindingcommentcourselevels:toggle-basicCtrl-\ Ctrl-Xcourselevels:toggle-intermediateCtrl-\ Ctrl-Ycourselevels:toggle-advancedCtrl-\ Ctrl-Zcourselevels:toggle-frameCtrl-\ Ctrl-Mcourselevels:toggle-licenceCtrl-\ Ctrl-Lcourselevels:metadata-clean-selectedAlt-Cmd-7clean metadata on selected cellscourselevels:metadata-clean-allCtrl-Alt-7clean metadata on all cellsas well as for adding/removing an admonition around a cellcommandkeybindingcourselevels:toggle-admonitionCtrl-\ Ctrl-Acourselevels:toggle-admonition-tipCtrl-\ Ctrl-Tcourselevels:toggle-admonition-noteCtrl-\ Ctrl-Ncourselevels:toggle-attentioncourselevels:toggle-cautioncourselevels:toggle-dangercourselevels:toggle-errorcourselevels:toggle-hintcourselevels:toggle-importantcourselevels:toggle-seealsocourselevels:toggle-warningpersistencethis is done by adding the following tags in each celllevel_basiclevel_intermediatelevel_advancedframed_cellrenderingwe rely on thejupyterlab-celltagsclassesextension, which will set classes
like e.g.cell-tag-level_basicsettingsby default, no button is displayed; you can set theshow_level_buttonsboolean
setting totrueto get the buttons to display in the toolbarDevelopmentDevelopment installNote: You will need NodeJS to build the extension package.Thejlpmcommand is JupyterLab's pinned version ofyarnthat is installed with JupyterLab. You may useyarnornpmin lieu ofjlpmbelow.# Clone the repo to your local environment# Change directory to the jupyterlab_courselevels directory# Install package in development modepipinstall-e"."# Link your development version of the extension with JupyterLabjupyterlabextensiondevelop.--overwrite# Rebuild extension Typescript source after making changesjlpmbuildYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.# Watch the source directory in one terminal, automatically rebuilding when neededjlpmwatch# Run JupyterLab in another terminaljupyterlabWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).By default, thejlpm buildcommand generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:jupyterlabbuild--minimize=FalseDevelopment uninstallpipuninstalljupyterlab_courselevelsIn development mode, you will also need to remove the symlink created byjupyter labextension developcommand. To find its location, you can runjupyter labextension listto figure out where thelabextensionsfolder is located. Then you can remove the symlink namedjupyterlab-courselevelswithin that folder.Packaging the extensionSeeRELEASE