Package: jupyterlab-gridwidth
jupyterlab-gridwidthJupyterLab extension totag cells so that they use a fraction of the widthcan replace former 'split-cell' extension in the classic notebookIt was preferred not to re-use the term 'split', because in jupyterlabsplitalready means, well, to split a cell into 2 cells...RequirementsJupyterLab >= 4.0.0Usageas a replacement for for formersplit-cellYou can useeither press the<->button on the notebook toolbar and use the drop down list to perform cell width adjustment (shown in the demo gif above)or keyboardAlt+1, Alt+2(meaning you want to use 1 / 2 of the horizontal space)or typegridwidthin the Palette and pick 1/2or commandgridwidth:toggle-1-2that you can bind to a keyboard shortcut of your choiceyou can also apply width change to multiple cells which are selected (useshift + clickorshift + up/downto select)to convert your notebookssplitcell-to-gridwidthnotebook1..notebookNwill replace the oldcell_style: splitwith the newgridwidth-1-2tag in all
notebooks passed as argumentspalette commandsgridwidth:toggle-1-2and so ongridwidth:cancelto reset to full widthkeyboard shortcutsAlt+1, Alt+2and so on; these will toggle the corresponding tag, and
remove any other tag that might be presentAlt+0to reset to full widthavailable tags:gridwidth-1-2(50%)gridwidth-1-3(~33%)gridwidth-2-3(~66%)gridwidth-1-4gridwidth-2-4,gridwidth-3-4gridwidth-1-5gridwidth-2-5,gridwidth-3-5,gridwidth-4-5gridwidth-1-6gridwidth-2-6,gridwidth-3-6,gridwidth-4-6,gridwidth-5-6other controlssince this exclusively relies on the presence of the above tags, you can also
use jupyterlab's so called "Property Inspector" feature; of course in this case
you're in charge of dealing with duplicate tags...limitationsrendering is exclusively done in CSS; converting to a non-HTML format will ruin
this layouthowever we will try to provide a CSS file usable with jupyter-book to
preserve the layout in jb's HTML output (not yet available)InstallTo install the extension, execute:pipinstalljupyterlab-gridwidthUninstallTo remove the extension, execute:pipuninstalljupyterlab-gridwidthDevelopment installWARNINGfrom this point on, this is the boilerplate text that comes with
the extension cookie-cutter template; it is not guaranteed to be accurateNote: 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-gridwidth 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-gridwidthIn 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-gridwidthwithin
that folder.Packaging the extensionSeeRELEASE