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
Markdown syntax highlighting bug due to a dollar sign ($) within a code block #6774
Comments
To add: the markdown renders and displays correctly, it's only syntax highlighting within the jupyterlab editor. |
Thanks for the report @SultanOrazbayev! I have confirmed that the CodeMirror demo here does not display this rendering problem, so the bug is on our end (n.b., the classic notebook also shows this bug). This is probably a mistake in our multiplexing codemirror mode here: jupyterlab/packages/codemirror/src/codemirror-ipythongfm.ts Lines 32 to 58 in 079115d
which switches to LaTeX mode upon encountering a $ symbol.
I'm not sure what the fix would look like just now -- we would need to identify that we are in a code fence and not turn on LaTeX mode. |
Thanks for the follow-up! I'm not sure if this is an option, but could a keyword at the beginning of the code block be used to disable texMode? e.g. if the code block contains
|
A workaround for this issue is to use the unicode |
I encountered this strange quirk today. Phew, I'm glad its root cause is known. In the interim of any changes to this behavior, it may be worth conveying this functionality to the user in some way. |
Confirming that this remains in current JLab (3.0.12) but doesn't occur in classic, same file open side-by-side simultaneously in both: (glad I found this open already, was just about to open a new one as I scratched my head for a while wondering if I'd messed up my own markdown)... Not sure how hard the fix is, wish I could help :) I'm trying to dog-food hard by using JLab for everything where I'd normally use other tools, hopefully we can iron the smaller kinks that way... |
I wonder if this is related to #8645. Both may boil down to issues with detecting where you're trying to enter into "mathmode" |
@telamonian agreed - I haven't looked at the logic, but basically the math mode detection shouldn't cross code boundaries, nicely highlighted by having two: |
Just as a further note, this also occurs in JupyterLab 3.0.14 using |
For reference, the way the mathmode parsing works is that we take this Very Special regex:
and use it to split markdown cells into non-math and math parts. It's likely that in order to fix this issue either |
Hm, that's interesting because, as @ian-r-rose noted, there's functionality for changing the context to TeX upon encountering the delimiter elsewhere (see codemirror-ipythongfm.ts). I suspect the regex is unnecessary for the reason of CodeMirror having built-in support for this kind of behavior (which, as aforementioned, appears to have been implemented). |
I don't know if this is useful information, but even using the unicode workaround doesn't fix the rendering issue. Text between two
|
I looked into this one. The clean solution would be to re-write the |
Thanks for the clarification, will do. |
Describe the bug
The syntax highlighting breaks down once a dollar sign is used within a code block (see the attached image). I tried using syntax highlighting (e.g. specifying
bash
after the triple backticks), but it doesn't help.Screen Shot 2019-07-06 at 17.20.40.pdf
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The syntax highlighting of the
# Next section
and any supporting code below.Desktop (please complete the following information):
** Potentially related cases (jupyter notebook)
#1834
#5266
#547
The text was updated successfully, but these errors were encountered: