How to change the default cell type in a notebook?

Currently, the default cell type is code, which is fine for most circumstances, but I would like to be able to switch the default to Markdown for some given notebook or notebook-containing folder. How can this be accomplished?

While I am interested in the generic solution to this, I am most interested in options that work for notebooks / folders on Wikimedia’s instance of JupyterHub, PAWS.

1 Like

This is not a direct answer to your question, but maybe you will find it helpful.

  • When an empty code cell is current, e.g. when you first open a notebook
  • Esc-M will turn the code cell to markdown
  • C will copy the cell
  • V will copy the cell, repeated V’s will continue to open up new markdown cells.

The keyboard short-cuts are m, c, v. Sorry for the case error in my original post.

1 Like

Thanks - wasn’t aware of the Esc-M part, and it does not seem to be mentioned in the keyboard shortcuts. This is helpful, but the main reason why I am interested in this is that I want to nudge myself into documenting code before I write it, and being required to do such manual Esc-M gymnastics is probably not a long-term solution.

I have been trying to understand the purpose of changing the default cell type. In my mind, the default is code, because it is the type more commonly used. Presumably, you expect to use markdown more commonly than code. Perhaps you are creating a jupyter-book.

(Esc M was a typo on my part. That merges a the following cell with the current cell.)

In 3 keystrokes, “Esc, m, c”, you have made a markdown cell and put the cell into your clipboard. With n presses of “v”, you now have n+1 markdown cells to play with.

Use them as needed. At any point, “Esc a”, can create a code cell above your current cell and “Esc b” will open a code cell below your current cell because code is the default. (a=above, b=below).

You can repeat “a” or “b” as needed. “Esc x” deletes cells. Again, the “x” can be entered repeatedly. So creating cells of any type is a pretty quick keyboard operation.

I hope this helps. It does not seem like gymnastics to me compared with moving the mouse around or creating some sort of UI customization of a notebook or Jupyter Lab.