Export HTML node

Hi!

Is there a way to export html code from html cells?

Like what it’s already possible for SVG nodes.

At the moment HTML nodes are exportable as PNG but it would be really great to have the possibility to export them as a .html file

1 Like

If the cell is named, you could simply refer to its outerHTML property. That is,

my_cell = {
  let div = d3.create('div')
  // code to create some HTML
  return div.node()

Then, in another cell,

my_cell.outerHTML

Should return the HTML code that you want. You could pipe that to some function to export it or simply copy and paste the code, depending on your needs.

1 Like

Thank you @mcmcclur!

It would be a great addition to have it in the menu when using HTML cells.

Love that idea! Could you please add it to our Feedback repo? That way you will get updates on any discussions.

Alternatively you can also copy the HTML via the DevTools Elements panel.