Merge pull request #1122 from jcb91/pymd

[python-markdown] avoid js error when marked doesn't wrap things in <p>
This commit is contained in:
Josh Barnes
2017-10-13 15:22:03 +01:00
committed by GitHub
@@ -63,9 +63,9 @@ define([
html = marked(text);
} else if (out_data.msg_type === "stream") {
html = marked(out_data.content.text);
var t = html.match(/<p>([\s\S]*?)<\/p>/)[1]; //strip <p> and </p> that marked adds and we don't want
html = t ? t : html;
var q = html.match(/&#39;([\s\S]*?)&#39;/); // strip quotes from strings
var t = html.match(/^\s*<p>([\s\S]*?)<\/p>\s*$/); //strip <p> and </p> that marked (maybe) adds and we don't want
html = t !== null ? t[1] : html;
var q = html.match(/^&#39;([\s\S]*?)&#39;$/); // strip quotes from strings
if (q !== null) html = q[1]
} else if (out_data.msg_type === "execute_result" | out_data.msg_type === "display_data" ) {
var ul = out_data.content.data;
@@ -90,9 +90,9 @@ define([
} else {
html = marked(ul['text/plain']);
// [\s\S] is used to also catch newlines
var t = html.match(/<p>([\s\S]*?)<\/p>/)[1]; //strip <p> and </p> that marked adds and we don't want
html = t ? t : html;
var q = html.match(/&#39;([\s\S]*?)&#39;/); // strip quotes from strings
var t = html.match(/^\s*<p>([\s\S]*?)<\/p>\s*$/); //strip <p> and </p> that marked adds and we don't want
html = t !== null ? t[1] : html;
var q = html.match(/^&#39;([\s\S]*?)&#39;$/); // strip quotes from strings
if (q !== null) html = q[1]
}
}