-
-
Notifications
You must be signed in to change notification settings - Fork 409
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
Notebook: Syntax highlighting not working in Safari #168
Comments
Might belong to #17. |
@malmaud, any ideas? |
It looks like some "lazy" highlighting upon loading the notebook is being too lazy (aka never called) in Firefox and Safari but not in Chrome? |
|
@Carreau, did something change in IPython 2.0 about how syntax highlighting is applied to cells when they are loaded? |
Nop nothing should have changed. Can you try pasting this in the JS console ? CodeMirror.requireMode('julia', function(){
cells = IPython.notebook.get_cells();
for(var i in cells){
c = cells[i];
if (c.cell_type === 'code'){
c.auto_highlight()
}
}
}) If it works we might want to wrap this also in the |
It doesn't. A manual call to a cell's This, on the other hand, works: cells = IPython.notebook.get_cells();
cells[0].code_mirror.setOption("mode", "julia"); The architecture is a bit puzzling, so I can't tell if it's an issue with CodeMirror, IPython or IJulia. It seems similar to IHaskell/IHaskell#71, though! Any ideas? |
Weird. |
@stevengj Hmm, it still works for me. I have no special insight on what's going wrong. |
That's probably a race condition between codemirror requiring the "julia" . So Codemirror try to parse in julia mode but as it is not defined, or initialized yet the highlighting default to 'plain/text'( even if the option is set to 'julia') for newly created cell, julia mode is defined so it works.
It should not happend has the autohilight is triggered only once julia mode is loaded, but it might come from the fact that the actual highlighting of codemirror is done in a pseudo-background thread using callbacks . |
@Carreau |
I run into a problem that is very similar, but I'm not certain it's the same. When I open an existing IJulia notebook that has a lot of "stuff" (plots, code cells, etc....), sometimes syntax highlighting doesn't work at all, (even though computation still works) and closing the window and reopening, or normal refreshing does not fix the issue. However, force-refreshing, (CMD-SHIFT-R in Chrome on OSX) always fixes the issue, so I think it might have something to do with files getting fetched in a weird order and not being pulled from Chrome's cache properly? The issue is perplexing, and if this is not the same as what's being talked about here, I can go open a new issue, but it's hard to know since my problem is intermittent. |
I am having what I think is the same issue. I found that #201 fixes this for me. (For reasons I don't understand, |
Oops, please ignore my previous comment. Looks like #201 was merged a while ago, well before the most recent tagged version of IJulia. After removing and reinstalling IJulia, this issue is not actually fixed for me. I think something screwy is going on in my .julia directory. |
I think I'm seeing much the same thing. If I open an existing notebook in Firefox there's no syntax highlighting for Julia code. Calling I see something similar in Chrome, though there it's intermittent. Sometimes existing notebooks open with syntax highlighting, other times not. I'm on julia 0.3.3, IJulia, 0.1.16, ipython 2.3.0, Firefox 34.0.5, OS X 10.9.5. |
One way to workaround is to add the following to CodeMirror.requireMode('julia', function(){
IPython.CodeCell.options_default.cm_config.mode = "julia"
}) This will not change the mode of already created cells (in old notebooks), but will set the right mode for new ones. The above works for |
That's basically what this is doing, but there seem to be some timing issues. So you should not need to add that manually to your custom.js it should be added to it by IJulia when you With next version of IPython it should be taken care of by IPython itself. |
Ah, indeed, seems that I overwrote |
Is there a change that is needed to our |
This may have been fixed in IPython 3.2. See the issue at EntropyOrg/p5-Devel-IPerl#40 for more details. |
@zmughal, that's good to hear. (The latest IJulia |
This may be a minor issue but is probably worth reporting: For some reason, Julia syntax highlighting doesn't work for IJulia notebooks in Safari on Mac OS X 10.9. I've tried to pin down the issue:
I'm not very knowledgeable when it comes to JS. A couple of amateurish observations: The language setting for all cells is correctly set to
Julia
. Loading up the notebook in Julia mode does throw up loads of CSS warnings whereas loading a Python notebook doesn't. Maybe it's something trivial. Can any Mac user confirm this observation?The text was updated successfully, but these errors were encountered: