-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Dollar $ sign ($) triggers errors in Markdown highlighting, even when escaped #1080
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
Comments
I updated the post because it seems that the dollar triggers these errors. Even escaping it (by adding a back-slash before the dollar sign) doesn't help. |
When Markdown cells are rendered, dollar signs can be used to delimit latex-style formulae. However, I didn't think that affected the syntax highlighting when they're in edit mode. 😕 |
I did a bit of diving into this. I don't think that the "$" is the issue but rather how CodeMirror (or possibly our code) behaves when it reaches a special character. There is likely a regex in the CodeMirror code that causes % to be treated as the start of a If any front end folks have a good suggestion to fix this, that would be great. FWIW, the syntax highlighting is wonky but the rendered cell after hitting SHIFT-ENTER looks fine. |
The formatting looks OK (while editing) once I remove the dollar sign from But yes, this is a code highlighting problem (that makes it hard to edit), fre 12 feb. 2016 02:29 Carol Willing [email protected] skrev:
|
Someone also pointed out to me yesterday that if you put something that looks like a git commit ID in a markdown cell, it gets highlighted in blue and underlined. I guess the syntax highlighting is a bit more Github flavoured than the rendering. |
This is something I run into almost daily, and while obviously the notebook renders fine, I do get annoyed at the minor syntax highlighting error. Would this be something that would need to be fixed upstream (ie CodeMirror), or would this be handled inside Jupyter? Edit: I can now see that CodeMirror doesn't support LaTeX and that support is added here inside the Jupyter Repo: https://github.com/jupyter/notebook/blob/ca50f1af5afb525fd95b98b2e61e69db28094467/notebook/static/notebook/js/codemirror-ipythongfm.js |
This still appears to be an issue. |
Looks like it works if you escape it with two backslashes. I just tried it in Jupyter Lab 0.34.3 and it worked. source: https://stackoverflow.com/questions/16089089/escaping-dollar-sign-in-ipython-notebook |
In the latest jlab (0.35.4), I only have to escape dollar signs with one backslash, same as the classic notebook. |
Ah, I didn't understand that the issue here is about the syntax highlighting, not the rendering. Yes, I still see an issue with the syntax highlighting. |
Two backslashes for $ and one for % did it. Looks fine for me in notebook server 5.7.4 |
A workaround for this issue is to use the unicode |
Using |
The Also, it's not possible to escape it when you write it in a code block: Though the symbol renders correctly, which suggests that the highlighting parser has different logic than the renderer. |
I'm finding that if I do a two-slash-then-dollar-sign "\$" rather than just typing dollar-sign "$" in the context of writing a paragraph, it makes things look good (within Jupyter Notebook, Python 3, using narrative, Esc+M to set Markdown type cells that present well if you hit Enter after typing. Unfortunately, after you "git add .", "git commit -m 'comment'", and "git push origin master", the rendering at github.com ends up doing some odd font intermittently between instances of double-slash-dollar-sign "\$" in my text narrative, failing to ignore the stylistic implications of dollar-sign "$" in the way that jupyter ignored in the version I last reviewed before pushing to git. TLDR: markdown in jupyter looks like hell on github, meaning it unfortunately might be easier to pdf writeups from jupyter (generally available at the time of creation) than github (generally available for retro-browsing, as version control software). |
Well, this really doesn't work. I don't see any solution at all. I've tried everything suggested on this page. The only one that works is where there is only a single dollar sign on a line. Anything else seems to break, sometimes in VERY strange ways. Note that when this is rendered, both Chrome and Firefox display the second line correctly for a moment, and then it is turned into math-renderer style which is clearly NOT what I want. My first image shows the source in plain text. The file is named "EXAMPLE.md". My second image shows how it is rendered on Github. |
@tvbush - we don't have any control over how GitHub renders Jupyter notebooks. If this is an issue with displaying a notebook on GitHub, you'll need to file a support request with GitHub. |
Did you try to reproduce my issue? |
For an unknown reason, one of my cells has weird Markdown highlighting (see attached screenshot). It seems like it might have something to do with the presence of "%" characeters?
Other cells are formatted correctly.
EDIT: seems caused by the first dollar sign.
The text was updated successfully, but these errors were encountered: