Jlab扩展,用于调整单元格宽度为全宽、半宽、1/3、2/3等。Gridwidth取代了经典笔记本中的前一个扩展'split-cell'。
项目描述
jupyterlab-gridwidth
JupyterLab扩展,用于
- 标记单元格,使它们使用宽度的分数
- 可以替换经典笔记本中的前一个扩展'split-cell'
由于在jupyterlab中“split”已经意味着将单元格拆分为两个单元格...,因此不希望重复使用该术语。
警告:jlab 4.2和windowingMode
从jlab 4.2开始,“notebook”扩展中的“windowingMode”设置默认为“full”
此设置启用优化的显示算法,该算法目前与“gridwidth”扩展不兼容
因此,作为短期解决方案,为了使用此扩展,您可以将“设置编辑器”中的此设置设置回“defer”,如下所示
:class: warning
Starting with 0.4.0, the extension will **silently change this setting for you**
Next releases will likely include a more user-friendly way to handle this
:align: center
:width: 600px
## Requirements
- JupyterLab >= 4.0.0
## Usage
### as a replacement for for former `split-cell`
You can use
- either 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 keyboard `Alt+1, Alt+2` (meaning you want to use 1 / 2 of the horizontal space)
- or type `gridwidth` in the Palette and pick 1/2
- or command `gridwidth:toggle-1-2`
- that you can bind to a keyboard shortcut of your choice
- you can also apply width change to multiple cells which are selected (use `shift + click` or `shift + up/down` to select)
### to convert your notebooks
```bash
splitcell-to-gridwidth notebook1 .. notebookN
将用新的gridwidth-1-2
标签替换所有作为参数传递的笔记本中的旧cell_style: split
调色板命令
gridwidth:toggle-1-2
等gridwidth:cancel
重置为全宽
键盘快捷键
Alt+1, Alt+2
等;这些将切换相应的标签,并删除可能存在的任何其他标签Alt+0
重置为全宽
可用标签
gridwidth-1-2
(50%)gridwidth-1-3
(~33%)gridwidth-2-3
(~66%)gridwidth-1-4
gridwidth-2-4
,gridwidth-3-4
gridwidth-1-5
gridwidth-2-5
,gridwidth-3-5
,gridwidth-4-5
gridwidth-1-6
gridwidth-2-6
,gridwidth-3-6
,gridwidth-4-6
,gridwidth-5-6
其他控件
由于这完全依赖于上述标签的存在,您也可以使用jupyterlab的所谓“属性检查器”功能;当然在这种情况下,您需要负责处理重复的标签...
限制
渲染仅使用CSS完成;转换为非HTML格式将破坏此布局
然而,我们将尝试提供一个适用于jupyter-book的CSS文件,以在jb的HTML输出中保留布局(尚不可用)
安装
要安装扩展,执行
pip install jupyterlab-gridwidth
卸载
要删除扩展,执行
pip uninstall jupyterlab-gridwidth
开发安装
警告从现在开始,这是随扩展cookie-cutter模板一起提供的模板文本;它不一定准确
注意:您需要NodeJS来构建扩展包。
jlpm
命令是JupyterLab附带的yarn版本,它是与JupyterLab一起安装的。您可以使用下面的yarn
或npm
代替jlpm
。
# Clone the repo to your local environment
# Change directory to the jupyterlab-gridwidth directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build
您可以在不同的终端中同时监视源目录并运行JupyterLab,以监视扩展源的变化并自动重新构建扩展。
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
在运行监视命令时,每次保存的更改都将立即在本地上生成并可在运行的JupyterLab中使用。刷新JupyterLab以在浏览器中加载更改(您可能需要等待几秒钟以重新构建扩展)。
默认情况下,jlpm build
命令为该扩展生成源映射,以便使用浏览器开发者工具进行调试。要为JupyterLab核心扩展也生成源映射,您可以运行以下命令
jupyter lab build --minimize=False
开发卸载
pip uninstall jupyterlab-gridwidth
在开发模式下,您还需要删除由jupyter labextension develop
命令创建的符号链接。要找到其位置,您可以使用jupyter labextension list
来确定labextensions
文件夹的位置。然后您可以在该文件夹中删除名为jupyterlab-gridwidth
的符号链接。
打包扩展
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪一个,请了解更多关于安装包的信息。
源分布
构建分布
jupyterlab_gridwidth-0.4.3.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a39494de3dc20d76d4163dc8bf58c1ccdf34b5ffc38b0cbea5c2b101aba89b8c |
|
MD5 | d21f142821c3549e60e0c92046b5d1b5 |
|
BLAKE2b-256 | 666d59814f7e0f9f0223c9e03ddd9e760f598d6eed9f44f5a93fdbbce653fc88 |