https://github.com/answerdotai/meta-nbextension
Access to current notebook and cell in an nbclassic notebook
https://github.com/answerdotai/meta-nbextension
Last synced: 11 months ago
JSON representation
Access to current notebook and cell in an nbclassic notebook
- Host: GitHub
- URL: https://github.com/answerdotai/meta-nbextension
- Owner: AnswerDotAI
- Created: 2024-04-07T04:33:06.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-13T12:16:49.000Z (about 2 years ago)
- Last Synced: 2025-06-30T15:59:26.862Z (11 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# meta-nbextension
This is an nbextension for Jupyter Notebook (nbclassic) v6. It doesn't work for the latest v7 which is a skin of
Jupyter Lab.
After installing it, all notebooks will have an `nbmeta` variable automatically created and kept updated, which
contains the current cell index and notebook name. This has only been tested inside regular notebook execution; it
might not work in other contexts, such as nbconvert.
In addition, the `set_next_input` js payload is modified to take an optional `ctype` argument, for the cell type to
create (i.e. 'code' or 'markdown'). This function can be used to access this functionality:
```python
def set_next_cell(text, code=True, replace=False, execute=False):
if not code: execute=True
ip.payload_manager.write_payload(dict(
source='set_next_input',
replace=replace, execute=execute,
text=text, ctype='code' if code else 'markdown'))
```
## Installation
```
pip install meta-nbextension
```