diff --git a/notebook/static/notebook/js/outputarea.js b/notebook/static/notebook/js/outputarea.js index 71c7b57260..95e641281d 100644 --- a/notebook/static/notebook/js/outputarea.js +++ b/notebook/static/notebook/js/outputarea.js @@ -701,7 +701,16 @@ define([ var text_and_math = mathjaxutils.remove_math(markdown); var text = text_and_math[0]; var math = text_and_math[1]; - marked(text, function (err, html) { + // Prevent marked from returning inline styles for table cells + var renderer = new marked.Renderer(); + renderer.tablecell = function (content, flags) { + var type = flags.header ? 'th' : 'td'; + var start_tag = '<' + type + '>'; + var end_tag = '\n'; + return start_tag + content + end_tag; + }; + marked(text, { renderer: renderer }, function (err, html) { + // marked(text, function (err, html) { html = mathjaxutils.replace_math(html, math); toinsert.append(html); }); diff --git a/notebook/static/notebook/js/textcell.js b/notebook/static/notebook/js/textcell.js index 85425cfc85..a49b938bef 100644 --- a/notebook/static/notebook/js/textcell.js +++ b/notebook/static/notebook/js/textcell.js @@ -391,7 +391,16 @@ define([ var text_and_math = mathjaxutils.remove_math(text); text = text_and_math[0]; math = text_and_math[1]; - marked(text, function (err, html) { + // Prevent marked from returning inline styles for table cells + var renderer = new marked.Renderer(); + renderer.tablecell = function (content, flags) { + var type = flags.header ? 'th' : 'td'; + var start_tag = '<' + type + '>'; + var end_tag = '\n'; + return start_tag + content + end_tag; + }; + marked(text, { renderer: renderer }, function (err, html) { + // marked(text, function (err, html) { html = mathjaxutils.replace_math(html, math); html = security.sanitize_html(html); html = $($.parseHTML(html));