Skip to main content

A JupyterLab extension to convert plaintext files to jupyter notebooks

Project description

jupyter-plainb

Github Actions Status

A JupyterLab extension to convert plaintext files to Jupyter notebooks

Installation

pip install jupyter-plainb

Requirements

  • 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 .ipynb with 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 .py or .md file 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 .ipynb file → 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-plainb

Contributing

See CONTRIBUTING.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_plainb-0.2.2.tar.gz (435.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupyter_plainb-0.2.2-py3-none-any.whl (64.5 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_plainb-0.2.2.tar.gz.

File metadata

  • Download URL: jupyter_plainb-0.2.2.tar.gz
  • Upload date:
  • Size: 435.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for jupyter_plainb-0.2.2.tar.gz
Algorithm Hash digest
SHA256 824d1d129a034032580138e7b5707556471e44bc5aba2e1b0600a2a9f4a596f3
MD5 841a720ca0d5f8afe05ad05961a02b4a
BLAKE2b-256 680bd0372db923f71b8e6941b131233486bb1b9905b4b015eb6f6954c8aa5a4b

See more details on using hashes here.

File details

Details for the file jupyter_plainb-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: jupyter_plainb-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 64.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for jupyter_plainb-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b4b76e4e410a2bae6e4cee75f56a405b046097cea4f783f82dee9bf6305fdbf
MD5 deb6600a0766454ea8fedc1d8c09416c
BLAKE2b-256 120a8789dc634ba688c7af1dbd7ada13b47c32a1facc26b07bda9c4cbce0bc39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page