jupyter-plainb
v0.2.2
Published
A JupyterLab extension to convert plaintext files to jupyter notebooks
Maintainers
Readme
jupyter-plainb
A JupyterLab extension to convert plaintext files to Jupyter notebooks
Installation
pip install jupyter-plainbRequirements
- JupyterLab >= 4.0.0
Usage
1. Convert to Notebook
Select a .py or .md file in the file browser → right-click → Convert to Notebook submenu → pick a parser.
- If a
.ipynbwith the same base name already exists, a confirmation dialog asks before overwriting.
2. Open With (Direct notebook editor)
You can open and edit .py or .md files directly in the JupyterLab Notebook editor without generating a .ipynb file.
- Right-click a
.pyor.mdfile in the file browser → hover over Open With → select Notebook. - Edits and cell runs save directly back to the original plaintext file format.
3. Convert to Plain Text (Reverse conversion)
Convert an existing .ipynb notebook back to one of the supported plaintext formats.
- Right-click a
.ipynbfile → hover over Convert to Plain Text submenu → select a target format.
4. Auto-convert on startup
Add plainTextNotebookConfig to jupyter_config.json (or JupyterLite's jupyter-lite.json):
{
"jupyter-config-data": {
"plainTextNotebookConfig": {
"rules": [
{ "dir": "percent", "parser": "parsePy" },
{ "dir": "sphinx_gallery", "parser": "parseSphinxGallery" },
{ "dir": "markdown", "parser": "parseClassicMd" },
{ "dir": "myst", "parser": "parseMystMd" }
]
}
}
}Each rule watches a directory and converts matching files on JupyterLab startup (skips files that already have a .ipynb sibling).
Supported formats
| Parser | Menu label | File type | Format |
| -------------------- | ---------------------- | --------- | ---------------------------------------------------------------------------------- |
| parsePy | Percent format (.py) | .py | Jupytext percent |
| parseSphinxGallery | Sphinx Gallery (.py) | .py | Sphinx-Gallery |
| parseClassicMd | Classic Markdown (.md) | .md | Standard markdown — fenced code blocks become code cells |
| parseMystMd | MyST Notebook (.md) | .md | MyST-NB {code-cell} directives |
Uninstall
pip uninstall jupyter-plainbContributing
See CONTRIBUTING.md
