首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JupyterLab在notebook.json或custom.js启动时如何加载?

JupyterLab在notebook.json或custom.js启动时如何加载?
EN

Stack Overflow用户
提问于 2021-05-09 14:18:56
回答 1查看 826关注 0票数 1

我想让JupyterLab启动和加载自定义设置,并自动覆盖高级设置。

但我做不到,虽然我尝试了三种方法notebook.json/custom.js/config.js.

我该怎么做呢?

我的环境

版本

  • jupyter-client 6.1.12
  • jupyter-contrib-core 0.3.3
  • jupyter-contrib-nbextensions 0.5.1
  • jupyter-core 4.7.1
  • jupyter-highlight-selected-word 0.2.0
  • jupyter-latex-envs 1。4.6
  • jupyter-nbextensions-configurator 0.4.1
  • jupyter-packaging 0.10.1
  • jupyter-server 1.6.4
  • jupyterlab 3.0.14
  • jupyterlab-pygments 0.1.2
  • jupyterlab-server 2.5.0

目录

代码语言:javascript
复制
├ ~/
  ├ .jupyter/
    ├ nbconfig/
      ├ notebook.json
    ├ config/
      ├ config.js
    ├ custom/
      ├ custom.js

设置

代码语言:javascript
复制
// ~/.jupyter/nbconfig/notebook.json
{
    "load_extensions": {
        "codefolding/main": true
    },
    "MarkdownCell": {
        "cm_config": {
            "autoClosingBrackets": true,
            "lineNumbers": true,
            "lineWrapping": false
        }
    },
    "CodeCell": {
        "cm_config": {
            "lineNumbers": true,
            "lineWrapping": true
        }
    },
    "Cell": {
        "cm_config": {
            "lineNumbers": true,
            "lineWrapping": true
        }
    },
    "codeCellConfig": {
        "cm_config": {
            "tabSize": 4,
            "insertSpaces": true,
            "readOnly": false,
            "autoClosingBrackets": true,
            "matchBrackets": true,
            "lineNumbers": true,
            "lineWrapping": "wordWrapColumn",
            "wordWrapColumn": 95
        }
    }
}
代码语言:javascript
复制
// ~/.jupyter/custom/custom.js or ~/.jupyter/config/config.js
var cm_config = require('notebook/js/cell').Cell.options_default.cm_config;
cm_config.tabSize = 4;
cm_config.readOnly = false;
cm_config.lineNumbers = true;
cm_config.linWrapping = true;
// cm_config.wordWrapColumn = 95;
cm_config.autoClosingBrackets = true;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-09 16:26:31

解决了!谢谢你的建议@krassowski!

现在,我可以加载木星实验室高级设置时,启动时,与{sys.prefix}/share/jupyter/lab/settings/override.json如下所示。

代码语言:javascript
复制
{
    "@jupyterlab/apputils-extension:themes": {
        "theme": "JupyterLab Dark"
    },
    "@jupyterlab/notebook-extension:tracker": {
        "markdownCellConfig": {
            "autoClosingBrackets": true,
            "lineNumbers": true,
            "lineWrap": "off"
        },
        "rawCellConfig": {
            "lineNumbers": true,
            "lineWrap": "wordWrapColumn",
            "wordWrapColumn": 130
        },
        "codeCellConfig": {
            "tabSize": 4,
            "insertSpaces": true,
            "readOnly": false,
            "codeFolding": false,
            "autoClosingBrackets": true,
            "matchBrackets": true,
            "lineNumbers": true,
            "lineWrap": "wordWrapColumn",
            "wordWrapColumn": 130
        }
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67458735

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档