From 8e64e13bbb8cf234560fc33e9e33d41e5cc8ed7d Mon Sep 17 00:00:00 2001 From: MinRK Date: Fri, 29 Jul 2011 11:04:04 -0700 Subject: [PATCH] support html representations in the notebook frontend html gets highest priority, because it is the native language of the frontend. --- .../frontend/html/notebook/static/css/notebook.css | 3 +++ .../frontend/html/notebook/static/js/codecell.js | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/css/notebook.css b/IPython/frontend/html/notebook/static/css/notebook.css index 248d91919..d138af834 100644 --- a/IPython/frontend/html/notebook/static/css/notebook.css +++ b/IPython/frontend/html/notebook/static/css/notebook.css @@ -285,6 +285,9 @@ div.output_latex { font-size: 116%; } +div.output_html { +} + div.output_png { } diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js index c641e81f6..88fb5a1b7 100644 --- a/IPython/frontend/html/notebook/static/js/codecell.js +++ b/IPython/frontend/html/notebook/static/js/codecell.js @@ -175,7 +175,9 @@ var IPython = (function (IPython) { CodeCell.prototype.append_display_data = function (data, element) { - if (data["text/latex"] !== undefined) { + if (data["text/html"] !== undefined) { + this.append_html(data["text/html"], element); + } else if (data["text/latex"] !== undefined) { this.append_latex(data["text/latex"], element); // If it is undefined, then we just appended to div.output, which // makes the latex visible and we can typeset it. The typesetting @@ -194,6 +196,15 @@ var IPython = (function (IPython) { }; + CodeCell.prototype.append_html = function (html, element) { + element = element || this.element.find("div.output"); + var toinsert = $("
").addClass("output_area output_html"); + toinsert.append(html); + element.append(toinsert); + return element; + } + + CodeCell.prototype.append_stream = function (data, element) { element = element || this.element.find("div.output"); var toinsert = $("
").addClass("output_area output_stream");