Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New ipython notebook templating

Is it possible to define some template content cells which all new ipython notebooks include when being created?

I'd like my notebooks to include some standard CSS using this method and possibly also have a markdown cell with links I'm frequently using .

like image 432
pandita Avatar asked Nov 08 '13 02:11

pandita


People also ask

How do I create a new IPython notebook?

A new notebook may be created at any time, either from the dashboard, or using the File | New menu option from within an active notebook. The new notebook is created within the same directory and will open in a new browser tab.

What is the difference between Jupyter Notebook and IPython notebook?

The IPython Notebook is now known as the Jupyter Notebook. It is an interactive computational environment, in which you can combine code execution, rich text, mathematics, plots and rich media. For more details on the Jupyter Notebook, please see the Jupyter website.

Is IPython deprecated?

By default, this was Python. The IPython console is now deprecated and if you want to start it, you'll need to use the Jupyter Console, which is a terminal-based console frontend for Jupyter kernels.


1 Answers

Thanks to @Jakob for the help.

To get permanent customised CSS within the notebooks, I needed to create <myprofile>/static/custom/custom.css in my .ipython user folder folder.

This worked quite ok. I used the firefox's webdev tools to find the css items and classes in the ipython notebook and managed to get a monokai-ish style:

ipython notebook with monokai style

I also learned from here that you can inject javascript which might make it possible to add default content to new notebooks. I haven't tried this one yet though.

Edit: if interested, the css file lives here. The monokai colors are based on .cm-s-ipython, which I think is similar what sublime text is using.

like image 70
pandita Avatar answered Dec 21 '22 23:12

pandita