oro*_*ome 31 ipython ihaskell jupyter
我想对我的IPython/IHaskell/Jupyter笔记本的外观进行一些简单的修改,比如
rendered_html :link {
text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何做到这一点.我已经尝试了许多通过搜索找到的解决方案,例如,将CSS放入其中
~/.ipython/profile_default/static/css/custom.css
Run Code Online (Sandbox Code Playgroud)
但没有任何影响,我怀疑,鉴于笔记本架构最近的变化,实现这一目标的方法已经改变,我发现的指令已经过时了.
如何为我的IPython/IHaskell/Jupyter Notebook设置自定义CSS?
OS X 10.10.4; Xcode 6.4; CLT:6.4.0.0.1; Clang:6.1; Python Python 2.7.10(Homebrew); IHaskell 0.6.4.1,IPython 3.0.0(4.0.0和Jupiter 4.0的答案也很受欢迎,因为我很快就会升级).
kyn*_*nan 54
要将自定义CSS添加到您可以使用的特定笔记本中HTML.添加并执行具有以下内容的常规Python代码单元:
from IPython.core.display import HTML
HTML("""
<style>
// add your CSS styling here
</style>
""")
Run Code Online (Sandbox Code Playgroud)
或者(感谢@abalter)使用%%html细胞魔法:
%%html
<style>
// add your CSS styling here
</style>
Run Code Online (Sandbox Code Playgroud)
小智 51
启动Jupyter/IPython 4.1,自定义文件夹位置已更改为~/.jupyter/custom/.所以,把你custom.css和custom.js这样的:
~/.jupyter/custom/custom.css
~/.jupyter/custom/custom.js
Run Code Online (Sandbox Code Playgroud)
这样对我有用.积分归于Liang2
编辑:
如果缺少~/.jupyter文件夹,可以使用jupyter notebook --generate-config命令生成文件夹.
kik*_*oso 19
我认为你的道路custom.css应该是:
~/.ipython/profile_default/static/custom/custom.css
Run Code Online (Sandbox Code Playgroud)
custom文件夹而不是css文件夹.
小智 13
这是我所做的。
从http://jupyter.readthedocs.io/en/latest/projects/jupyter-directories.html我发现您可以通过设置JUPYTER_CONFIG_DIR环境变量来更改配置目录,然后我像这样运行 jupyter:
JUPYTER_CONFIG_DIR=./jupyter/ jupyter notebook
Run Code Online (Sandbox Code Playgroud)
我当前目录中的 jupyter 目录具有以下结构:
jupyter/ - 风俗/ - 自定义.css - custom.js
根据建议的文档,我首先从Anaconda Navigator中下载了Anaconda3 - Jupyter 5.0 Notebook是几个预建选项之一.我在这个位置找到了我的CSS文件.
C:\Users\YourUsername\Anaconda3\Lib\site-packages\notebook\static\cutom\custom.css
我在这里找到了一个很好的解决方案: https ://martinapugliese.github.io/jupyter-customise/
不过我需要添加这个:
<style>..</style>Run Code Online (Sandbox Code Playgroud)
from IPython.core.display import HTML
def _set_css_style(css_file_path):
"""
Read the custom CSS file and load it into Jupyter.
Pass the file path to the CSS file.
"""
styles = open(css_file_path, "r").read()
s = '<style>%s</style>' % styles
return HTML(s)
Run Code Online (Sandbox Code Playgroud)
截至 2021 年,Jupyter 4.7、Ipython 7,以下位置对我有用:
/home/$USER/.jupyter/custom/custom.css
Run Code Online (Sandbox Code Playgroud)
旧答案:
根据 Jupyter 文档custom.css应放入default_profile/static/custom文件夹中。
您将通过在 Jupyter 笔记本单元中运行来找到默认配置文件的位置:
import jupyter_core
jupyter_core.paths.jupyter_config_dir()
Run Code Online (Sandbox Code Playgroud)
这给了我:
'/home/sergey/.jupyter'
Run Code Online (Sandbox Code Playgroud)
之后,在.jupyter文件夹中创建目录结构,如:
static
??? custom
??? custom.css
Run Code Online (Sandbox Code Playgroud)
如您所见,所需的结构是 ~/.jupyter/static/custom/custom.css
这在 Ubuntu 18.04 和最新的 Jupyter(2018 年 10 月)中对我有用
对于基本 conda 环境,我在这里找到它:〜/Programs/Anaconda3/lib/python3.6/site-packages/notebook/static/custom
对于自定义 conda 环境,我在这里找到它:〜/Programs/Anaconda3/envs/[环境名称]/lib/python3.6/site-packages/notebook/static/custom
适用于 Ubuntu 18.04、conda 4.6.8。
| 归档时间: |
|
| 查看次数: |
36291 次 |
| 最近记录: |