2

是否可以自定义 jupyter notebook 前端部分(不仅仅是 css)?基本上,我想为我的自定义 html 页面提供服务,该页面具有代码块,我想要在 Jupyter 笔记本中使用单元格的功能。我可以自定义页面的样式,但没有找到任何更改布局(html)的方法。

4

1 回答 1

2

您可以使用该文件(与您可能正在编辑custom.js的文件位于同一位置)在页面加载时加载任意 Javascript。custom.css您可以使用它来修改 DOM,例如使用 JQuery。或者,如果您打算进行更复杂的工作或分发您的 javascript,最好进行扩展(http://jupyter-notebook.readthedocs.io/en/latest/extending/frontend_extensions.html

如果我具体知道您要做什么,我可以尝试帮助举个例子,但这里是有关如何编写custom.js文件的基本框架:

define([
    'base/js/namespace',
    'base/js/events'
], function(Jupyter, events) {
    events.on('app_initialized.NotebookApp', function(){
        //your custom code here
    });
});
于 2017-03-13T14:46:10.667 回答