Merge pull request #5944 from jdfreder/i5943

Markdown rendering bug fix.
This commit is contained in:
Min RK 2014-06-04 15:54:06 -07:00
commit 2c8a53aca1
2 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -10,7 +10,7 @@ casper.notebook_test(function () {
cell.render();
return cell.get_rendered();
});
this.test.assertEquals(output, '<h1 id=\"foo\">Foo</h1>', 'Markdown JS API works.');
this.test.assertEquals(output.trim(), '<h1 id=\"foo\">Foo</h1>', '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, '<h1 id=\"foo\">Foo</h1>', 'Markdown menubar items work.');
this.test.assertEquals(output.trim(), '<h1 id=\"foo\">Foo</h1>', '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, '<h1 id=\"foo\">Foo</h1>', 'Markdown toolbar items work.');
this.test.assertEquals(output.trim(), '<h1 id=\"foo\">Foo</h1>', 'Markdown toolbar items work.');
});