jupyter-notebook - 在 Jupyter 笔记本中,如何获得 javascript 魔法单元的语法高亮显示?
解决方案
以下代码适用于带有笔记本 5.x 的 ~/.jupyter/custom/custom.js 中的 SQL:
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(); } }) ;
});
});
推荐阅读
- flutter - Flutter getx 控制器获取当前页面上下文
- kotlin - 我使用 listState 来管理我的 LazColumn 的滚动以显示和隐藏我的标题栏。(分页)
- android - 应用程序运行时如何将数据保存到 sharedPreferences 销毁
- pandas - 如何根据熊猫中的条件提取数据库?
- html - 如何在 HTML 和 CSS 中的标题中的两个元素之间平均间隔一个元素
- django - POST表单提交后django显示消息问题?
- swift - 核心数据:返回对象的通用类函数
- python - Open AI Gym:如何将每个步骤中的多个动作传递到我们的自定义健身房环境?
- laravel - 如何在 laravel 中编写子查询
- python - 在 Python 的内存中不使用额外空间/列表/数组的反向列表