[IPython-User] html/rst rendering in Ipython notebook as return from a python function

Massimo Di Stefano massimodisasha@gmail....
Mon Apr 2 17:54:46 CDT 2012


Hi All,

i was tring to learn how to use the notebook to render the output of a function as rst or html and display it in the notebook.
i see the recent version of pandas as this feature enabled to print out in the notebook a data frame and render it as an html table.

do you know how can i do the same with  a custom function ?

what i means is something like :

def myfunction():
    """  *this is italic test*
          ** this is bold **  """

and print it out as :

myfunc.__doc__

but seems it is not yet possible, as i can see from this thread :

http://python.6.n6.nabble.com/notebook-idea-reST-rendering-of-docstrings-td4342595.html

so, if i do something like :


class my class():
    def method1():
        some code


    def method2():
        some code

    def helpmethod1():
        help = """ some html code """
        return help

    def helpmethod2():
        help = """ some html code """
        return help


id like to render it in the notebook as html when i type instruction like :

In [1]: myclass(). helpmethod1



Is this possible ?


Thanks!

--Massimo.



More information about the IPython-User mailing list