[IPython-dev] Highlight lines of code in code cells?
Mark Voorhies
mark.voorhies at ucsf.edu
Mon Dec 2 20:44:49 EST 2013
On 12/02/2013 04:22 PM, Mark Voorhies wrote:
> On 12/02/2013 04:10 PM, Gabriel Becker wrote:
>> On Mon, Dec 2, 2013 at 3:54 PM, Mark Voorhies <mark.voorhies at ucsf.edu>wrote:
>>
>>> On 12/02/2013 03:19 PM, Greg Wilson wrote:
>>>
>>>> Thanks,
>>>> Greg
>>>
>>> Just started fiddling with this, using rmagic.py and cythonmagic.py as
>>> references.
>>>
>>> Can anyone point me at documentation for getting at retrieving cell
>>> content by
>>> number and/or tag via the IPython shell instance?
>>>
>>
>> I could be entirely off base here, but my understanding is that the IPython
>> kernel (which provides the magics) used by the notebook doesn't have any
>> concept of cells/the whole notebook in the way you are going to need them.
>
> Looks like shell.history_manager.get_range works for cell numbers
> (and that the "tags" that Greg mentioned aren't yet implemented).
Here's a simple prototype:
https://github.com/markvoorhies/ipython/tree/diffmagic
(https://github.com/markvoorhies/ipython/commit/d24bbb8cd76ba420c61b428b2c9802651f815c6d)
"%diff 3 5"
Gives a simple text rendering of a line-based diff of cells 3 and 5, e.g.:
- def Hello():
+ def Hello(s):
? +
# A simple function
- print "Hello, world"
? ^^^^^
+ print "Hello, %s" % s
? ^^ ++++
--Mark
>
> --Mark
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
> .
>
More information about the IPython-dev
mailing list