新的ipython笔记本模板 [英] New ipython notebook templating

查看:85
本文介绍了新的ipython笔记本模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以定义所有新的ipython笔记本在创建时都包含的一些模板内容单元格?

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

我希望我的笔记本使用此方法包含一些标准CSS,并且可能还会有一个带有链接的markdown单元格, m经常使用.

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 .

推荐答案

感谢@Jakob的帮助.

Thanks to @Jakob for the help.

要在笔记本中获得永久的定制CSS,我需要在.ipython用户文件夹文件夹中创建<myprofile>/static/custom/custom.css.

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

这很好.我使用firefox的webdev工具在ipython笔记本中查找css项和类,并设法获得了monokai-ish风格:

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:

我还从此处,您可以注入javascript,这可能使向新笔记本添加默认内容成为可能.我还没有尝试过.

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.

如果感兴趣,css文件位于此处. monokai颜色基于.cm-s-ipython,我认为这与升华文字所使用的颜色相似.

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.

这篇关于新的ipython笔记本模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆