[IPython-User] _repr_html_ CSS and javascripts?

Matthias BUSSONNIER bussonniermatthias@gmail....
Mon Aug 6 15:30:02 CDT 2012

Le 6 août 2012 à 22:15, Thomas Kluyver a écrit :

> On 6 August 2012 18:34, Matthias BUSSONNIER
> <bussonniermatthias@gmail.com> wrote:
>>> I'm happily using the _repr_html_ method in my object with basic HTML.
>>> Since I can't find any further documentation on this, can I use CSS
>>> styles and/or javascript in my renderings?
>> for javascript use _repr_javascript_
> I think he's asking about embedding JS or CSS into the HTML produced
> by _repr_html_(). As far as I know, that should be possible. Try it
> and see what happens ;-).

But then the HTML won't be QtConsole compatible. 

And we prefer not to have <scritps> tag published because they can prevent the notebook from loading. 
Javascript already have keywords that allow to pass css and html that will be correctly wrapped, inserted in the headers, and libs not republished if already available.

More over the js object give you direct access to it's containing div through the `container`variable which is handy to revere to the displayed object. 

You can try to do stuff by writing <script> in html, but it is not something we should be published anywhere because google as a too good memory. 
(i'm still curious of how well it works…) 


More information about the IPython-User mailing list