[IPython-User] View rendered reStructuredText (Sphinx) docstrings in iPython?
Thomas Kluyver
takowl@gmail....
Thu Jan 26 10:06:01 CST 2012
Hi Jon,
So, there's different bits of IPython. In the terminal, we're quite limited
in what we can do - most modern terminals let us change the colour of text,
or make it slightly bold. It would be possible to do some rendering of reST
here (e.g. convert *emphasis* to bold text), but it's very limited;
especially with links (which I think are the most disruptive thing for
reading raw reST), you can't hide the URL.
In the Qt console and now the HTML notebook, the situation is much better -
you could render the reST to HTML for the frontend to display.
A command like zip? is translated to get_ipython().magic(u'pinfo zip') ,
which calls the magic_pinfo function:
https://github.com/ipython/ipython/blob/master/IPython/core/magic.py#L541
That in turn calls shell.inspect.pinfo, which is here:
https://github.com/ipython/ipython/blob/master/IPython/core/oinspect.py#L435
I think probably the best approach would be to make an extension (
http://ipython.org/ipython-doc/stable/config/extensions/index.html ), which
would subclass Inspector, overriding the pinfo method with one that
produced an HTML result to send to the frontend.
Best wishes,
Thomas
On 25 January 2012 16:56, Maccarthy, Jonathan K <jkmacc@lanl.gov> wrote:
> Hello,
>
> Does anyone know if it's possible to have iPython render reStructuredText
> (i.e. Sphinx) docstrings when you type 'help foo', or 'foo?' ? I'm
> finding that many projects are moving to Sphinx documentation, which makes
> their docstrings harder to read on the fly (unpythonic?). <rant> Needing a
> browser to view the docs seems to miss the point of docstrings. </rant>
> Does iPython have this functionality somewhere? If not, perhaps any devs
> could suggest where in the iPython source it would go (if this is even
> feasible)?
>
> Thanks in advance,
> Jon
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120126/fbcef855/attachment.html
More information about the IPython-User
mailing list