ptjnb
v0.1.1
Published
A JupyterLab extension to convert plaintext files to jupyter notebooks
Maintainers
Readme
ptjnb
A JupyterLab extension to convert plaintext files to Jupyter notebooks
Installation
pip install ptjnbRequirements
- JupyterLab >= 4.0.0
Usage
Right-click menu
Select a .py or .md file in the file browser → right-click → Convert to Notebook submenu → pick a parser.
If a .ipynb with the same base name already exists, a confirmation dialog asks before overwriting.
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 ptjnbContributing
See CONTRIBUTING.md
