How to make new cells in ipython laptop utilizer by default?

Currently, whenever you create a new cell in your iPython laptop, by default it opens a cell for Python code. Then I can change it to markdown by pressing ctrl m m

Is there any method or parameter that I can configure so that the new cells are in markdown mode by default?

I found this question , which seems to be asking the same thing, but it was mistakenly marked as a duplicate and did not receive an answer.

+6
source share
2 answers

I just read the js code for IPython and found the insert_cell_below method in https://github.com/ipython/ipython/blob/master/IPython/html/static/notebook/js/notebook.js#L849 .

If you want to do this programmatically, it will just be the case to do something like:

from IPython.display import display, Javascript def markdown_below(): display(Javascript(""" IPython.notebook.insert_cell_below('markdown') """)); markdown_below() 

It would be pretty early to turn into a toolbar button similar to the gist button in https://github.com/minrk/ipython_extensions . p>

NTN

+4
source

Quote from Brian E. Granger in 2012 from this forum: http://python.6.x6.nabble.com/Start-notebook-with-custom-markdown-code-snippets-as-default-td4997506.html

The best way to do this right now is to clone an existing laptop. We don’t have a great way to do this, but starting in January we’ll work on the toolbar and we’ll add such things.

0
source

Source: https://habr.com/ru/post/955540/


All Articles