24

In IPython notebook, I used to be able to display a python string that contains html as actual html, by using the HTML function from IPython's display module.

from IPython.display import HTML

In jupyter notebook the display module no longer exists. Does anyone know where I can find the HTML function?

I use Jupyter notebook 4.1, IPython 4.0.2 and Python 3.5.1 64 bit

Thomas K
  • 39,200
  • 7
  • 84
  • 86
jkokorian
  • 2,905
  • 7
  • 32
  • 47
  • 1
    It's still there in `IPython.display`. The Python interfaces that your code in the notebook uses is part of *IPython*. Jupyter is the language-independent pieces, like the notebook UI and document format. – Thomas K Mar 28 '16 at 18:21
  • What the heck! I am affraid I made an embarrassing typo when trying this! Thanks very much! – jkokorian Mar 28 '16 at 20:22
  • Possible duplicate of [How to embed HTML into iPython output?](https://stackoverflow.com/questions/25698448/how-to-embed-html-into-ipython-output) – Ciro Santilli OurBigBook.com Nov 30 '17 at 17:13

1 Answers1

30

Use the function display

def bar():
    from IPython.display import display, HTML
    chart = HTML('<h1>Hello, world!</h1>')
    # or chart = charts.plot(...)
    display(chart)

bar()

source: http://suanfazu.com/t/jupyter-highcharts/13438/2

Greenstick
  • 8,632
  • 1
  • 24
  • 29
jona
  • 329
  • 2
  • 8