From a4d0b62849e427ab5bce5eae7660eb0f1a88010b Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Tue, 14 Apr 2020 10:19:16 +0300 Subject: [PATCH 1/2] test: remove shouldFail, issue #1594 --- test/specs/commonmark/commonmark.0.29.json | 6 ++---- test/specs/gfm/commonmark.0.29.json | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/test/specs/commonmark/commonmark.0.29.json b/test/specs/commonmark/commonmark.0.29.json index e15f83c1ba..57ee02b3bf 100644 --- a/test/specs/commonmark/commonmark.0.29.json +++ b/test/specs/commonmark/commonmark.0.29.json @@ -3359,8 +3359,7 @@ "example": 413, "start_line": 6895, "end_line": 6899, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**bar***\n", @@ -3368,8 +3367,7 @@ "example": 414, "start_line": 6902, "end_line": 6906, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "foo***bar***baz\n", diff --git a/test/specs/gfm/commonmark.0.29.json b/test/specs/gfm/commonmark.0.29.json index 5dc9d47d8c..a726cdc5b8 100644 --- a/test/specs/gfm/commonmark.0.29.json +++ b/test/specs/gfm/commonmark.0.29.json @@ -3359,8 +3359,7 @@ "example": 413, "start_line": 6895, "end_line": 6899, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**bar***\n", @@ -3368,8 +3367,7 @@ "example": 414, "start_line": 6902, "end_line": 6906, - "section": "Emphasis and strong emphasis", - "shouldFail": true + "section": "Emphasis and strong emphasis" }, { "markdown": "foo***bar***baz\n", From 2c903bf88a8cfdd84a42151ce68e58400bed7d6d Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Tue, 14 Apr 2020 10:20:48 +0300 Subject: [PATCH 2/2] fix: closing delimited, close issue #1594 --- src/rules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rules.js b/src/rules.js index 268d0cf29a..c7399cc593 100644 --- a/src/rules.js +++ b/src/rules.js @@ -169,7 +169,7 @@ const inline = { reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/, nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/, strong: /^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/, - em: /^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/, + em: /^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/, code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, br: /^( {2,}|\\)\n(?!\s*$)/, del: noopTest, @@ -178,7 +178,7 @@ const inline = { // list of punctuation marks from common mark spec // without ` and ] to workaround Rule 17 (inline code blocks/links) -inline._punctuation = '!"#$%&\'()*+,\\-./:;<=>?@\\[^_{|}~'; +inline._punctuation = '!"#$%&\'()*+\\-./:;<=>?@\\[^_{|}~'; inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex(); inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;