Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable syntax highlighting #214

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rschroll
Copy link
Contributor

I went to see about adding this and saw that there was already some code to do this. It was commented out, and a comment suggests that this was related to an API change within Jupyter itself (1a75466). I've tried to write it in a way that works with both the old and newer APIs, but I've only tested on notebook 6.4.11.

This does not work with JupyterLab, which seems to make this more difficult, likely requiring an extension.

This should work with a variety of older and newer versions of Jupyter.
It tries to avoid clobbering any existing highlighting modes for SQL,
but that's probably overkill.  Restarting and rerunning the import will
end up with multiple identical regexes in the list, but that doesn't
seem to be a problem.  Fixing this would be difficult because, in JS,
/a/ !== /a/.

This is not working in JupyterLab, which seems to have a whole different
way to deal with syntax highlighting.
The null coalescing operator doesn't work for undefined names (only
undefined properties), so we'll look for the global in the window
namespace.  If neither exists, as in JupyterLab, give up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant