Custom syntax highlighting in jupyter notebook

北城余情 提交于 2019-12-25 07:41:55

问题


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.

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?


回答1:


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

Jupyter Highlight Selected word

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)




回答2:


If you are likely to develop many notebooks and notebook related files, I also highly recommend that you check jupyterlab. It's as simple as notebooks to install and very convenient.



来源:https://stackoverflow.com/questions/41650535/custom-syntax-highlighting-in-jupyter-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!