Jupyter Notebook中的自定义语法突出显示 [英] Custom syntax highlighting in jupyter notebook
问题描述
我有一个特殊的函数系列,用于不同类型的跟踪和详细输出,在我的代码中多次调用这些函数.我给他们一个前缀,我经常搜索该前缀.但是,我意识到我花了很多时间寻找和编辑这些功能,因此我想尽可能地简化它.我想在对这些函数的所有调用中添加语法高亮显示,以便于查找.
I have a special family of functions used for different type of tracing and verbose output, calls to which are sprinkled throughout my code. I've given them a prefix and I often search for that prefix. However, I realized I spend so much time looking for and editing these functions that I'd like to make it a bit more streamlined if possible. I would like to add syntax highlighting to any calls to these functions so that they are easy to find.
我在Jupyter Notebook中工作,是否可以在不重写Jupyter的一半的情况下为Jupyter Notebooks中的任何一组指定函数的调用添加具有唯一颜色的语法高亮显示?
I work in Jupyter Notebook, is it's doable to add syntax highlighting with a unique color to calls to any of a specified set of functions in Jupyter Notebooks without rewriting half of Jupyter and how would I go about it?
推荐答案
我不知道我是否正确理解了您的问题.但是,如果您需要一个在Jupyter Notebook上突出显示所选变量的插件,则可以在python/Jupyter Notebook版本中安装以下Repo
I don't know if I understand your question correctly. But if you require a addon which highlights the selected variable on Jupyter Notebook you can install the following Repo in your python/Jupyter notebook version
请注意,应通过激活每个环境并在命令行中运行该命令(如果使用Conda或其他程序包管理器)在每个环境上运行jupyter nbextension enable highlight_selected_word/main
Note that you should run the jupyter nbextension enable highlight_selected_word/main
on every environment you have by activating each environment and runing that command in the command line (if using Conda or other package manager)
这篇关于Jupyter Notebook中的自定义语法突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!