# maximsch2/SublimeIPythonNotebook

### Subversion checkout URL

You can clone with
or
.

# ENH: Use python/markdown mode in input/markdown cells#11

Closed
opened this Issue · 19 comments

### 2 participants

First, this is a great plugin. Good work.

I don't know if it is possible, but it would be awesome if we could figure out how to make sublime treat python cells as an actual python script so things like snippets and completions work. The same goes for markdown.

In reality, if we figure this out, I would like to have markdown cells treated as latex. I do a lot of latex math in python notebooks and having LaTeXTools snippets and completions at my disposal would be ideal. Perhaps, we could let there be an option in a user preferences file that says which syntax rule sublime should follow for each type of cell.

Owner

I am not sure if we are going to achieve full compatibility with all features of TeX/Python modes without integrating them into SublimeIPythonNotebook, but I think at least LaTexTools completions should now work in git master version. Can you try it out? If it will work fine, I'll push it as an update to Package Control.

Having an option will be non-trivial btw, because it looks like you have to rebuild tmLanguage file to change syntax inside parts of your document.

The completions associated with "scope": "text.tex.latex" work in a markdown cell!

However, I find the most useful completions are the ones associated with math mode (see link for what that scope is). Any chance we can get those to work inside a latex environment or math delimiters $? Owner Some of those completions actually do work for me, but it looks like they are overridden by global tex completions when overlapping... Ok the ones I am looking for are, for example, the greek letters. • a [TAB] -> \alpha • b [TAB] -> \beta ect... Owner Yeah, those don't work. You should be able to confirm using Command-Alt-P that "string.other.math.tex" is present inside the math delimiters, so I am not sure what we can do here... When I do Command-Alt-p I only se source.ipynb in the status bar. Are you getting something different? Owner Yes, I am seeing text.tex.latex and other stuff there. Do you have your cursor inside the math block? Yeah, I have tried it both just in between $  and in an environment like \begin{align}. Still only seeing source.ipynb Owner What about just inside the markdown cell? Can you also try ? If you don't have "text.tex.latex" there, then I don't know how are you getting any completions. I've tested it in ST2, let me see what happens in ST3. At random places in the markdown cell I still only get source.ipynb. Also in . I am using ST3, sorry I forgot to mention that earlier. I also don't know how I am getting completions. Very strange Owner OK, are you sure you have the latest version from github (not from Package Control)? I've tested it in ST3 and it works fine (I get source.tex.latex scope inside markdown cells, still no completion for alpha though) I deleted the one from package control (Installed\ Packages/IPython\ Notebook.sublime-package) and cloned the latest master into Packages/SublimeIPythonNotebook. It is odd, however, that from the command palette I am seeing duplicates for all the SublimeIpythonNotebook's commands Owner So completion was working there all along? You should clone github master into Packages/IPython Notebook Ok so I just manually deleted the package, but didn't tell package control to remove it, so Package control kept downloading it again. Give me a minute to test a clean wipe/pull Ok I got that straightened out. I now see that all LaTeX elements are being highlighted properly and that I have the correct scope when I do Command-Alt-p Also when I am in between  \$ I can do a [TAB] -> \alpha!! Looks like you got it figured out

Did the math completions just figure themselves out on their own?

I am assuming that all you needed to do was make a markdown cell LaTeX, and then LaTeXTools took over the math related scope issues. Is that correct?

Owner

Looks like it

closed this issue from a commit
 maximsch2 also add source.python and source.r, probably fixes #11 cc56a21
closed this in cc56a21
Owner

New version in Package Control (should appear there in ~1 hour) should allow snippet completions for Python, R and LaTeX inside Markdown cells.