[IPython-dev] Printing HTML within IPython Notebook / IPython-specific prettyprint?
Jeffrey Tratner
jtratner at gmail.com
Fri May 10 14:01:46 EDT 2013
Hi all,
I know that I can use IPython.core.display.HTML to format something such
that it outputs as HTML into the notebook. However, it appears to only work
if it's the output of a cell, e.g.
```
from IPython.core.display import HTML
html_text = HTML("<p style='font-weight: bold;'> Some text! </p>")
html_text
```
But I'd like to be able to output pretty printed HTML in the midst of a
function. Is it possible to get IPython to consider something as HTML
(instead of as plain text)? I tried using `lib.pretty`, but that didn't
hook into it, and a plain print statemtn didn't work either.).
It would be great to be able to do something like
```
from __future__ import print_function
try:
from IPython.somemodule import print_func
except ImportError:
print_func = print
```
Does this exist now and/or is it planned for the future? If not, any
suggestions on how I might go about making this work?
Thanks,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130510/30021d6b/attachment.html>
More information about the IPython-dev
mailing list