首页 > 解决方案 > 如何在 JupyterHub 新环境中高亮 SQL?

问题描述

我正在寻找一种在 Jupyterlab 中突出显示我的 SQL 代码的方法, .

另外,我看到Jupyterlab 提出了一个高级设置编辑器,但我没有找到任何信息。

require(['notebook/js/codecell'], function (codecell) {
    codecell.CodeCell.options_default.highlight_modes['magic_text/x-mssql'] = { 'reg': [/%?%sql/] };
    Jupyter.notebook.events.one('kernel_ready.Kernel', function () {
        Jupyter.notebook.get_cells().map(function (cell) {
            if (cell.cell_type == 'code') { cell.auto_highlight(); }
        });
    });
});

我的环境版本:

jupyter core     : 4.6.1
jupyter-notebook : 6.0.0
qtconsole        : not installed
ipython          : 7.10.1
ipykernel        : 5.1.3
jupyter client   : 5.3.3
jupyter lab      : 1.2.1
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 4.4.0
traitlets        : 4.3.3

有没有办法得到这种结果?用魔法细胞?还是扩展?

在此处输入图像描述

另外,我看到Jupyterlab 提出了一个高级设置编辑器

在此处输入图像描述

谢谢 !!!

标签: pythonjupyter-notebookipythonjupyter-labjupyterhub

解决方案


推荐阅读