From 9c976cda1ce80e45901290c51c57e40a7ea31266 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 3 Jul 2018 11:43:01 -0700 Subject: [PATCH] enable CommonMark spec 468 A minor adjustment to the href-matching regexp permits CommonMark spec 468 to pass. All other passing specs are unaffected. The regexp was incorrectly excluding parentheses as valid characters in a URL. --- lib/marked.js | 2 +- test/specs/commonmark/commonmark-spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/marked.js b/lib/marked.js index ca608845b5..3e0e886ef0 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -544,7 +544,7 @@ inline.tag = edit(inline.tag) .getRegex(); inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/; -inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f()\\]*\)|[^\s\x00-\x1f()\\])*?)/; +inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/; inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; inline.link = edit(inline.link) diff --git a/test/specs/commonmark/commonmark-spec.js b/test/specs/commonmark/commonmark-spec.js index 4205044586..074b34b981 100644 --- a/test/specs/commonmark/commonmark-spec.js +++ b/test/specs/commonmark/commonmark-spec.js @@ -349,7 +349,7 @@ describe('CommonMark 0.28 Links', function() { var section = 'Links'; // var shouldPassButFails = []; - var shouldPassButFails = [468, 474, 478, 483, 489, 490, 491, 492, 495, 496, 497, 499, 503, 504, 505, 507, 508, 509, 523, 535]; + var shouldPassButFails = [474, 478, 483, 489, 490, 491, 492, 495, 496, 497, 499, 503, 504, 505, 507, 508, 509, 523, 535]; var willNotBeAttemptedByCoreTeam = [];