From: Darren D. <dar...@co...> - 2008-05-23 16:19:21
|
On Friday 23 May 2008 10:56:47 am Michael Droettboom wrote: > Michael Droettboom wrote: > > Secondly, the ipython console sessions aren't getting syntax highlighted > > -- it would be nice if they did, particularly to indicate input vs. > > output. I'll volunteer to look into this -- I've done some pygments > > customization work in the past and maybe it won't be too difficult. > > I just committed support for this on the trunk. The usage is not > automatic. The reST code must specifically request it using the > ..sourcecode directive: > > .. sourcecode:: ipython > > In [101]: ax.lines[0] > Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710> > > In [102]: line > Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710> > > Making this automatic would have required monkey-patching Sphinx -- > there doesn't seem to be an API to extend its algorithm to automatically > select a syntax highlighter, as I suppose this requirement is somewhat > obscure. I think it might be worth mentioning on Sphinx-dev, there might be some interest in supporting it. As it is, though, I don't think ".. sourcecode:: ipython" isn't much more distracting than, say: blah blah:: :ipython: In [101]: ax.lines[0] Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710> In [102]: line Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710> Darren |