Johan Falkenjack
Johan Falkenjack

Reputation: 199

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.

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?

Upvotes: 1

Views: 10307

Answers (2)

Louis
Louis

Reputation: 112

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.

Upvotes: -1

David Alvarez
David Alvarez

Reputation: 1398

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)

Upvotes: 3

Related Questions