Notebook Splitting

split splits Jupyter notebooks by writing each cell type (markdown, code, and raw) to its own notebook.

Unless in quiet mode, split shows cell counts: markdown, code, raw, and total.

Result File Names

The results of splitting notebook nb.ipynb are named:

  • nb-markdown.ipynb

  • nb-code.ipynb

  • nb-raw.ipynb

When a particular type of cell does not occur, that result notebook is not written.

The result name additions can be adjusted in the configuration file by setting split_markdown_result_name, split_code_result_name, and split_raw_result_name; see Configuration Files.

Options

The following options are supported by split:

-t TYPES, --split-cell-types TYPES
                      comma-separated list of cell types to split (default:
                      'markdown,code,raw')

JSON Output

See Write JSON Output for general information about JSON output.

split produces the following members in the JSON output:

Name

Value

"CT"

count of cells with type CT

Cell types distinguished: markdown, code, raw

Examples

Split notebook test.ipynb in verbose mode without writing the results:

$ nbtb split test.ipynb -v -n
Dry run (no files written)
Options for nbsplit:
  (None)

::::::::::::::
test.ipynb
::::::::::::::
Split cell statistics:
          12 code
           7 markdown
           0 raw
          19 total
No files written

Notebooks processed: 1