From 47cf2b2cf2118147e5b564bbe3e6c86962ec11d0 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 3 Jul 2018 10:43:21 +0200 Subject: [PATCH 1/2] add hard line break when backslash at EOL A backslash at the end of the line is a hard line break. Ref: https://spec.commonmark.org/0.28/#example-293 --- lib/marked.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/marked.js b/lib/marked.js index ca608845b5..5ae9a8240e 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -522,7 +522,7 @@ var inline = { strong: /^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)|^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)/, em: /^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/, code: /^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/, - br: /^ {2,}\n(?!\s*$)/, + br: /^( {2,}|\\)\n(?!\s*$)/, del: noop, text: /^[\s\S]+?(?=[\\ Date: Tue, 3 Jul 2018 11:06:44 +0200 Subject: [PATCH 2/2] test: re-activate passing tests --- test/specs/commonmark/commonmark-spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/specs/commonmark/commonmark-spec.js b/test/specs/commonmark/commonmark-spec.js index 4205044586..94d894c1ea 100644 --- a/test/specs/commonmark/commonmark-spec.js +++ b/test/specs/commonmark/commonmark-spec.js @@ -289,7 +289,7 @@ describe('CommonMark 0.28 Backslash escapes', function() { var section = 'Backslash escapes'; // var shouldPassButFails = []; - var shouldPassButFails = [290, 291, 293, 300, 301]; + var shouldPassButFails = [290, 291, 300, 301]; var willNotBeAttemptedByCoreTeam = []; @@ -409,7 +409,7 @@ describe('CommonMark 0.28 Hard line breaks', function() { var section = 'Hard line breaks'; // var shouldPassButFails = []; - var shouldPassButFails = [611, 606, 609, 613]; + var shouldPassButFails = [613]; var willNotBeAttemptedByCoreTeam = [];