Skip to content

Commit ec08633

Browse files
committed
Improved js injection
1 parent 931e42b commit ec08633

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lightning/main.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ def __repr__(self):
2828
else:
2929
return 'Lightning server at host: %s' % self.host
3030

31-
3231
def get_ipython_markup_link(self):
33-
return '%s/js/ipython-comm.js' % (self.host)
34-
32+
return '%s/js/ipython-comm.js' % self.host
3533

3634
def enable_ipython(self, **kwargs):
3735
"""
@@ -46,18 +44,16 @@ def enable_ipython(self, **kwargs):
4644
# https://github.com/jakevdp/mpld3/blob/master/mpld3/_display.py#L357
4745

4846
from IPython.core.getipython import get_ipython
49-
from IPython.display import display, HTML
47+
from IPython.display import display, Javascript
5048

5149
self.ipython_enabled = True
5250
ip = get_ipython()
5351
formatter = ip.display_formatter.formatters['text/html']
5452
formatter.for_type(Visualization, lambda viz, kwds=kwargs: viz.get_html())
5553

5654
r = requests.get(self.get_ipython_markup_link(), auth=self.auth)
57-
ipython_comm_markup = '<script>' + r.text + '</script>'
58-
59-
display(HTML(ipython_comm_markup))
6055

56+
display(Javascript(r.text))
6157

6258
def disable_ipython(self):
6359
"""

0 commit comments

Comments
 (0)