[IPython-dev] How to display markdown text in DataFrame in Notebook

Matthias Bussonnier bussonniermatthias at gmail.com
Sat May 30 12:48:49 EDT 2015


> On May 30, 2015, at 03:59, Anton Akhmerov <anton.akhmerov at gmail.com> wrote:
> 
> Somewhat paradoxically, there's no easy way to display markdown
> programmatically in ipython. You can manually create HTML out of
> markdown by using markdown2html filters from
> IPython.nbconvert.filters.



For some reason people don’t try, or don’t read the doc:

class o:
    def _repr_markdown_(self):
        return '[try it](https://try.jupyter.org)'
    
o()


And we support arbitrary mime type, the _repr_*_ that exist are here just for convenience.

> If you want a more systematic solution, I believe you could subclass
> the DataFrame 

Which is the bad solution also, register a display_formatter for a specific object type:

https://nbviewer.jupyter.org/github/ipython/ipython-in-depth/blob/bigsplit/examples/IPython%20Kernel/Custom%20Display%20Logic.ipynb#Adding-IPython-display-support-to-existing-objects <https://nbviewer.jupyter.org/github/ipython/ipython-in-depth/blob/bigsplit/examples/IPython%20Kernel/Custom%20Display%20Logic.ipynb#Adding-IPython-display-support-to-existing-objects>

— 
M


> 
> Best,
> Anton
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev


— 
M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150530/b310ce57/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2015-05-30 at 09.42.04.png
Type: image/png
Size: 37416 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150530/b310ce57/attachment.png>


More information about the IPython-dev mailing list