Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter notebook new cell type default

When I use a jupyter notebook,

I would like new cells to be of type "markdown".

By default, the type of new cells is "code". Which config file should I modify and which variable should I change?

like image 420
jeybee Avatar asked Nov 02 '16 14:11

jeybee


People also ask

How do you get a new cell in Jupyter Notebook?

While in command mode: A to insert a new cell above the current cell, B to insert a new cell below. M to change the current cell to Markdown, Y to change it back to code. D + D (press the key twice) to delete the current cell.

What cell types are available in Jupyter Notebook?

There are three types of cells: code cells, markdown cells, and raw cells. Every cell starts off being a code cell, but its type can be changed by using a drop-down on the toolbar (which will be “Code”, initially), or via keyboard shortcuts.

What set of setup are needed to insert a new code cell below an existing cell?

You can add new cells by using the + CODE and + TEXT buttons that show when you hover between cells. These buttons are also in the toolbar above the notebook where they can be used to add a cell below the currently selected cell. You can move a cell by selecting it and clicking Cell Up or Cell Down in the top toolbar.


2 Answers

In JupyterLab, you can go to Settings -> Advanced Settings manager -> Notebook and then add the following in "User Preferences":

{
    "defaultCell": "markdown"
}
like image 171
joelostblom Avatar answered Oct 02 '22 17:10

joelostblom


Go to the site-packages directory of your python environment and modify site-packages/notebook/static/notebook/js/main.min.js

Find something like

Notebook.options_default = {
    // can be any cell type, or the special values of
    // 'above', 'below', or 'selected' to get the value from another cell.
    default_cell_type: 'code'
};

change default_cell_type: 'code' into default_cell_type: 'markdown'

like image 44
sunwback Avatar answered Oct 02 '22 16:10

sunwback