From 61bc4ba78a9dac8f13b0d0d91d4c00168de9360c Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Sat, 2 May 2020 01:13:46 -0500 Subject: [PATCH] fix underscore emphasis then comma --- src/rules.js | 3 ++- test/specs/new/emphasis_extra tests.html | 2 +- test/specs/new/emphasis_extra tests.md | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/rules.js b/src/rules.js index e41e00ae50..d6c16521cb 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_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/, + em: /^_([^\s_])_(?!_)|^_([^\s_<][\s\S]*?[^\s_])_(?!_|[^\s,punctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\s,punctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/, code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, br: /^( {2,}|\\)\n(?!\s*$)/, del: noopTest, @@ -178,6 +178,7 @@ const inline = { // list of punctuation marks from common mark spec // without ` and ] to workaround Rule 17 (inline code blocks/links) +// without , to work around example 393 inline._punctuation = '!"#$%&\'()*+\\-./:;<=>?@\\[^_{|}~'; inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex(); diff --git a/test/specs/new/emphasis_extra tests.html b/test/specs/new/emphasis_extra tests.html index 0e2609cdbd..84bca1a2f6 100644 --- a/test/specs/new/emphasis_extra tests.html +++ b/test/specs/new/emphasis_extra tests.html @@ -1 +1 @@ -

test. test: test! test? test-

\ No newline at end of file +

test. test: test! test? test- test,

diff --git a/test/specs/new/emphasis_extra tests.md b/test/specs/new/emphasis_extra tests.md index bf8afdc7d1..bd55c5e7fb 100644 --- a/test/specs/new/emphasis_extra tests.md +++ b/test/specs/new/emphasis_extra tests.md @@ -1 +1,6 @@ -_test_. _test_: _test_! _test_? _test_- \ No newline at end of file +_test_. +_test_: +_test_! +_test_? +_test_- +_test_,