##// END OF EJS Templates
refactor to improve cell switching in edit mode...
refactor to improve cell switching in edit mode This code was repeated in both CodeCell and TextCell, both of which are extensions of Cell, so this just unifies the logic in Cell. TextCell had logic here to check if the cell was rendered or not, but I don't believe it is possible to end up triggering such a code path. (Should that be required, I can always just add back these methods to TextCell, performing the .rendered==True check, and calling the Cell prior to this, code mirror at_top would only return true on if the cursor was at the first character of the top line. Now, pressing up arrow on any character on the top line will take you to the cell above. The same applies for the bottom line. Pressing down arrow would only go to the next cell if the cursor was at a location *after* the last character (something that is only possible to achieve in vim mode if the last line is empty, for example). Now, down arrow on any character of the last line will go to the next cell.

File last commit:

r13864:f536475f
r15754:d60e793e
Show More
ipython_console_highlighting.py
27 lines | 892 B | text/x-python | PythonLexer
/ IPython / sphinxext / ipython_console_highlighting.py
Fernando Perez
Update docs for automatic API building.
r1850 """
chebee7i
Update code for making sphinx aware of IPython console lexer.
r13631 reST directive for syntax-highlighting ipython interactive sessions.
Fernando Perez
Update docs for automatic API building.
r1850
chebee7i
Update code for making sphinx aware of IPython console lexer.
r13631 """
Fernando Perez
Update docs for automatic API building.
r1850
Fernando Perez
Add the matplotlib sphinx extensions, authored by the MPL team.
r1694 from sphinx import highlighting
chebee7i
Update code for making sphinx aware of IPython console lexer.
r13631 from ..nbconvert.utils.lexers import IPyLexer
Brian Granger
Cleanup of docs....
r2275
def setup(app):
"""Setup as a sphinx extension."""
# This is only a lexer, so adding it below to pygments appears sufficient.
chebee7i
Update code for making sphinx aware of IPython console lexer.
r13631 # But if somebody knows what the right API usage should be to do that via
Brian Granger
Cleanup of docs....
r2275 # sphinx, by all means fix it here. At least having this setup.py
# suppresses the sphinx warning we'd get without it.
pass
chebee7i
lexerself -> lexer.
r13652 # Register the extension as a valid pygments lexer.
chebee7i
Update code for making sphinx aware of IPython console lexer.
r13631 # Alternatively, we could register the lexer with pygments instead. This would
# require using setuptools entrypoints: http://pygments.org/docs/plugins
chebee7i
Clean up aliases for lexers.
r13864 ipy2 = IPyLexer(python3=False)
chebee7i
Update code for making sphinx aware of IPython console lexer.
r13631 ipy3 = IPyLexer(python3=True)
chebee7i
Clean up aliases for lexers.
r13864 highlighting.lexers['ipython'] = ipy2
highlighting.lexers['ipython2'] = ipy2
chebee7i
Make IPyLexer available in Pygments as 'ipython' and 'ipython3'.
r13633 highlighting.lexers['ipython3'] = ipy3