notebook: Python 3.6 f-strings break notebook syntax highlighting
Using Notebook v4.3.1, use of f-strings (PEP 498, Python 3.6) breaks syntax highlighting for the remaining code in a given cell.
Is Jupyter curently unable to handle this syntax? I would imagine that this issue would have been raised by others were this the case.
Using OS X, brewed Python 3.6.0, Firefox 50.
$ python3 --version
Python 3.6.0
$ jupyter --version
4.2.1
$ jupyter-notebook --version
4.3.1
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.2
BuildVersion: 16C68
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 16 (10 by maintainers)
Commits related to this issue
- Patch for https://github.com/jupyter/notebook/issues/2037 https://github.com/codemirror/CodeMirror/issues/4454 — committed to gnestor/CodeMirror by gnestor 7 years ago
- update codemirror component to 5.37 This should fix f string syntax highlighting https://github.com/jupyter/notebook/issues/2037 — committed to Kilo59/notebook by Kilo59 6 years ago
Patch
Temporary solution tested on notebook version 4.3.1
Two patterns inside
site-packages/notebook/static/notebook/js/main.min.js
need replacing:[rub]
with[rubf]
and"rub"
with"rubf"
With sed:
Thanks, at least the fix is trivial.
Could we at least patch the existing Codemirror version? F-strings are the big ticket item in Python 3.6 after all.
You can try @bede’s patch: https://github.com/jupyter/notebook/issues/2037#issuecomment-272466046
I’ve marked this as 5.0 - I’d really like to get it fixed soon, because syntax highlighting is currently broken with the new Python 3.6 strings.
Are we aware of any fix for the Safari issue in CodeMirror that would let us update it again? If not, can we work out a way to use a patched CodeMirror?