##// END OF EJS Templates
Treat set_rendered as unsafe.
Jonathan Frederic -
Show More
@@ -245,8 +245,6 b' var IPython = (function (IPython) {'
245 * @method set_rendered
245 * @method set_rendered
246 */
246 */
247 TextCell.prototype.set_rendered = function(text) {
247 TextCell.prototype.set_rendered = function(text) {
248 // TODO: This HTML needs to be treated as potentially dangerous
249 // user input.
250 this.element.find('div.text_cell_render').html(text);
248 this.element.find('div.text_cell_render').html(text);
251 };
249 };
252
250
@@ -297,6 +295,8 b' var IPython = (function (IPython) {'
297 // make this value the starting point, so that we can only undo
295 // make this value the starting point, so that we can only undo
298 // to this state, instead of a blank cell
296 // to this state, instead of a blank cell
299 this.code_mirror.clearHistory();
297 this.code_mirror.clearHistory();
298 // TODO: This HTML needs to be treated as potentially dangerous
299 // user input and should be handled before set_rendered.
300 this.set_rendered(data.rendered || '');
300 this.set_rendered(data.rendered || '');
301 this.rendered = false;
301 this.rendered = false;
302 this.render();
302 this.render();
@@ -355,12 +355,17 b' var IPython = (function (IPython) {'
355 // Links in markdown cells should open in new tabs.
355 // Links in markdown cells should open in new tabs.
356 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
356 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
357 try {
357 try {
358 // TODO: This HTML needs to be treated as potentially dangerous
359 // user input and should be handled before set_rendered.
358 this.set_rendered(html);
360 this.set_rendered(html);
359 } catch (e) {
361 } catch (e) {
360 console.log("Error running Javascript in Markdown:");
362 console.log("Error running Javascript in Markdown:");
361 console.log(e);
363 console.log(e);
362 this.set_rendered($("<div/>").addClass("js-error").html(
364 rendered.empty();
363 "Error rendering Markdown!<br/>" + e.toString())
365 rendered.append(
366 $("<div/>")
367 .append($("<div/>").text('Error rendering Markdown!').addClass("js-error"))
368 .append($("<div/>").text(e.toString()).addClass("js-error"))
364 );
369 );
365 }
370 }
366 this.element.find('div.text_cell_input').hide();
371 this.element.find('div.text_cell_input').hide();
@@ -507,8 +512,6 b' var IPython = (function (IPython) {'
507
512
508
513
509 HeadingCell.prototype.set_rendered = function (html) {
514 HeadingCell.prototype.set_rendered = function (html) {
510 // TODO: This HTML needs to be treated as potentially dangerous
511 // user input.
512 this.element.find("div.text_cell_render").html(html);
515 this.element.find("div.text_cell_render").html(html);
513 };
516 };
514
517
@@ -542,7 +545,8 b' var IPython = (function (IPython) {'
542 .attr('href', '#' + hash)
545 .attr('href', '#' + hash)
543 .text('¶')
546 .text('¶')
544 );
547 );
545
548 // TODO: This HTML needs to be treated as potentially dangerous
549 // user input and should be handled before set_rendered.
546 this.set_rendered(h);
550 this.set_rendered(h);
547 this.typeset();
551 this.typeset();
548 this.element.find('div.text_cell_input').hide();
552 this.element.find('div.text_cell_input').hide();
General Comments 0
You need to be logged in to leave comments. Login now