From df2a907f6591fe5f103d7c11715dfa84e7860b79 2014-06-04 22:54:06 From: Min RK Date: 2014-06-04 22:54:06 Subject: [PATCH] Merge pull request #5944 from jdfreder/i5943 Markdown rendering bug fix. --- diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index 78a56da..0db7af8 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); diff --git a/IPython/html/tests/notebook/markdown.js b/IPython/html/tests/notebook/markdown.js index b65a076..0c1f61e 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.'); });