New ipython notebook templating

落花浮王杯 提交于 2019-12-28 13:23:27

问题


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 .


回答1:


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:

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.



来源:https://stackoverflow.com/questions/19850829/new-ipython-notebook-templating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!