From d84c8fa863b58a8831fb9ff8030a20621825aef1 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 3 Jun 2014 14:04:56 -0700 Subject: [PATCH 1/2] Fixed mardown rendering bug. The wrong signature of `$()` was being used wrong: http://api.jquery.com/jQuery/#jQuery1 right: http://api.jquery.com/jQuery/#jQuery2 Instead of implictly calling parseHTML, call it explicitly. closes #5943 --- IPython/html/static/notebook/js/textcell.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index 9b7724a86..f68412d36 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -256,7 +256,7 @@ var IPython = (function (IPython) { var html = marked.parser(marked.lexer(text)); html = IPython.mathjaxutils.replace_math(html, math); html = security.sanitize_html(html); - html = $(html); + html = $($.parseHTML(html)); // links in markdown cells should open in new tabs html.find("a[href]").not('[href^="#"]').attr("target", "_blank"); this.set_rendered(html); @@ -428,7 +428,7 @@ var IPython = (function (IPython) { var html = marked.parser(marked.lexer(text)); html = IPython.mathjaxutils.replace_math(html, math); html = security.sanitize_html(html); - var h = $(html); + var h = $($.parseHTML(html)); // add id and linkback anchor var hash = h.text().replace(/ /g, '-'); h.attr('id', hash); From f6da79e1e14e1017363447916b3307936780b12b Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 3 Jun 2014 15:43:46 -0700 Subject: [PATCH 2/2] Update JS markdown tests. --- IPython/html/tests/notebook/markdown.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IPython/html/tests/notebook/markdown.js b/IPython/html/tests/notebook/markdown.js index b65a07636..0c1f61eed 100644 --- a/IPython/html/tests/notebook/markdown.js +++ b/IPython/html/tests/notebook/markdown.js @@ -10,7 +10,7 @@ casper.notebook_test(function () { cell.render(); return cell.get_rendered(); }); - this.test.assertEquals(output, '

Foo

', 'Markdown JS API works.'); + this.test.assertEquals(output.trim(), '

Foo

', 'Markdown JS API works.'); // Test menubar entries. output = this.evaluate(function () { @@ -21,7 +21,7 @@ casper.notebook_test(function () { $('#run_cell').mouseenter().click(); return cell.get_rendered(); }); - this.test.assertEquals(output, '

Foo

', 'Markdown menubar items work.'); + this.test.assertEquals(output.trim(), '

Foo

', 'Markdown menubar items work.'); // Test toolbar buttons. output = this.evaluate(function () { @@ -32,5 +32,5 @@ casper.notebook_test(function () { $('#run_b').click(); return cell.get_rendered(); }); - this.test.assertEquals(output, '

Foo

', 'Markdown toolbar items work.'); + this.test.assertEquals(output.trim(), '

Foo

', 'Markdown toolbar items work.'); });