[IPython-User] View rendered reStructuredText (Sphinx) docstrings in iPython?
Thu Jan 26 10:06:01 CST 2012
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:
That in turn calls shell.inspect.pinfo, which is here:
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.
On 25 January 2012 16:56, Maccarthy, Jonathan K <email@example.com> wrote:
> 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
> Thanks in advance,
> IPython-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User