diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index b45e29a..9bdf9e2 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -245,7 +245,9 @@ var IPython = (function (IPython) { * @method set_rendered */ TextCell.prototype.set_rendered = function(text) { - this.element.find('div.text_cell_render').text(text); + // TODO: This HTML needs to be treated as potentially dangerous + // user input. + this.element.find('div.text_cell_render').html(text); }; /** @@ -353,17 +355,12 @@ var IPython = (function (IPython) { // Links in markdown cells should open in new tabs. html.find("a[href]").not('[href^="#"]').attr("target", "_blank"); try { - // TODO: This HTML needs to be treated as potentially dangerous - // user input. - rendered.html(html); + this.set_rendered(html); } catch (e) { console.log("Error running Javascript in Markdown:"); console.log(e); - rendered.empty(); - rendered.append( - $("
") - .append($("").text('Error rendering Markdown!').addClass("js-error")) - .append($("").text(e.toString()).addClass("js-error")) + this.set_rendered($("").addClass("js-error").html( + "Error rendering Markdown!