Jlab扩展,用于显示课程级别和结构
项目描述
jupyterlab_hidecell
JupyterLab扩展,用于
- 标记单元格,以便它们可以隐藏或删除其输入、输出或两者
- 可以替换经典笔记本中之前的 'hide-input' 扩展
与Jupyter book兼容
尽可能使此扩展与jupyter-book在此处描述的标签兼容: https://jupyterbook.org/en/stable/interactive/hiding.html#hide-code-cell-content
需求
- JupyterLab >= 4.0.0
使用方法
将您的笔记本转换为
使用之前的 hide-input
扩展,您可以使用
hideinput-to-hidecell notebook1 .. notebookN
将旧的 hide_input: true
替换为所有笔记本参数中新的 hide-input
标签
调色板命令和快捷键
所有命令都作为切换器运行,因此您可以使用相同的快捷键来隐藏和显示内容;在调色板中搜索 hidecell
以显示
快捷键 | 命令 | 描述 |
---|---|---|
Accel-0 H I |
hidecell:toggle-hide-input |
输入区域被隐藏,一个视觉手柄允许切换回显示 |
Accel-0 H O |
hidecell:toggle-hide-output |
输出也相同 |
Accel-0 H C |
hidecell:toggle-hide-cell |
整个单元格也相同 |
Accel-0 R I |
hidecell:toggle-remove-input |
输入区域将不再可见 |
Accel-0 R O |
hidecell:toggle-remove-output |
输出也相同 |
Accel-0 R C |
hidecell:toggle-remove-cell |
整个单元格(消失) |
Accel-0 N |
hidecell:debug-on |
突出显示受任何标签影响的单元格 |
Accel-0 F |
hidecell:关闭调试 |
退出调试模式 |
其他控制
由于这完全依赖于上述标签的存在,您也可以使用 jupyterlab 的所谓“属性检查器”功能;然而,在这种情况下,您需要负责避免重复的标签...
限制
渲染完全在 CSS 中完成;转换为非 HTML 格式将破坏此布局
安装
要安装扩展,请执行
pip install jupyterlab-hidecell
卸载
要删除扩展,请执行
pip uninstall jupyterlab-hidecell
开发安装
警告 从现在开始,这是扩展 cookie-cutter 模板附带的标准文本;它不一定准确
注意:您需要 NodeJS 来构建扩展包。
jlpm
命令是 JupyterLab 安装时附带的对 yarn 的固定版本。您可以使用 yarn
或 npm
替代 jlpm
。
# Clone the repo to your local environment
# Change directory to the jupyterlab_hidecell 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-hidecell
在开发模式下,您还需要删除由 jupyter labextension develop
命令创建的符号链接。要找到其位置,您可以运行 jupyter labextension list
以确定 labextensions
文件夹的位置。然后您可以从该文件夹中删除名为 jupyterlab-hidecell
的符号链接。
打包扩展
请参阅 RELEASE
项目详情
jupyterlab_hidecell-0.2.2.tar.gz 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | db8132b9a872e8c229534215e7107b3e3f400819ecd3eb6048fdd8bf30210cca |
|
MD5 | 1af6b742d44b03ec3b1e20b536f26e55 |
|
BLAKE2b-256 | d3c1d88d956e603e73cc9cf3d42951615fe0f3da3c7bd5041e2be6d132bf521b |