Skip to content

Commit 4a1279b

Browse files
committed
[python-markdown] allow whitespace before/after wrapping <p> tags
1 parent d606a9c commit 4a1279b

File tree

1 file changed

+2
-2
lines changed
  • src/jupyter_contrib_nbextensions/nbextensions/python-markdown

1 file changed

+2
-2
lines changed

src/jupyter_contrib_nbextensions/nbextensions/python-markdown/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ define([
6363
html = marked(text);
6464
} else if (out_data.msg_type === "stream") {
6565
html = marked(out_data.content.text);
66-
var t = html.match(/^<p>([\s\S]*?)<\/p>$/); //strip <p> and </p> that marked (maybe) adds and we don't want
66+
var t = html.match(/^\s*<p>([\s\S]*?)<\/p>\s*$/); //strip <p> and </p> that marked (maybe) adds and we don't want
6767
html = t !== null ? t[1] : html;
6868
var q = html.match(/^&#39;([\s\S]*?)&#39;$/); // strip quotes from strings
6969
if (q !== null) html = q[1]
@@ -90,7 +90,7 @@ define([
9090
} else {
9191
html = marked(ul['text/plain']);
9292
// [\s\S] is used to also catch newlines
93-
var t = html.match(/^<p>([\s\S]*?)<\/p>$/); //strip <p> and </p> that marked adds and we don't want
93+
var t = html.match(/^\s*<p>([\s\S]*?)<\/p>\s*$/); //strip <p> and </p> that marked adds and we don't want
9494
html = t !== null ? t[1] : html;
9595
var q = html.match(/^&#39;([\s\S]*?)&#39;$/); // strip quotes from strings
9696
if (q !== null) html = q[1]

0 commit comments

Comments
 (0)