From da4d9673c671c3f9eeaf3b73973d0a810c82bda0 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Fri, 28 Jun 2019 11:25:31 -0500 Subject: [PATCH 1/2] add test --- test/specs/new/breaks.html | 1 + test/specs/new/breaks.md | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 test/specs/new/breaks.html create mode 100644 test/specs/new/breaks.md diff --git a/test/specs/new/breaks.html b/test/specs/new/breaks.html new file mode 100644 index 0000000000..04dc13acd7 --- /dev/null +++ b/test/specs/new/breaks.html @@ -0,0 +1 @@ +

A
B

diff --git a/test/specs/new/breaks.md b/test/specs/new/breaks.md new file mode 100644 index 0000000000..e133fa00eb --- /dev/null +++ b/test/specs/new/breaks.md @@ -0,0 +1,6 @@ +--- +breaks: true +gfm: true +--- +A +B From e774f77e82079fa0ff891c861b0fb5238af5ad6a Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Fri, 28 Jun 2019 11:25:37 -0500 Subject: [PATCH 2/2] fix breaks --- lib/marked.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/marked.js b/lib/marked.js index 86286794e5..d07c39618f 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -634,7 +634,10 @@ inline.gfm.url = edit(inline.gfm.url, 'i') inline.breaks = merge({}, inline.gfm, { br: edit(inline.br).replace('{2,}', '*').getRegex(), - text: edit(inline.gfm.text).replace(/\{2,\}/g, '*').getRegex() + text: edit(inline.gfm.text) + .replace('\\b_', '\\b_| {2,}\\n') + .replace(/\{2,\}/g, '*') + .getRegex() }); /**