Merge pull request #5944 from jdfreder/i5943

Markdown rendering bug fix.
pull/37/head
Min RK 12 years ago
commit 2c8a53aca1

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

@ -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.');
});

Loading…
Cancel
Save