From 1421c3530484ef09c1b9e4815888b982eb3043ef Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 3 Apr 2020 14:40:28 +0300 Subject: [PATCH 1/2] test: for issue #1607 --- test/specs/new/em_2char.html | 2 ++ test/specs/new/em_2char.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/specs/new/em_2char.html b/test/specs/new/em_2char.html index 81da0a0001..56db779ccb 100644 --- a/test/specs/new/em_2char.html +++ b/test/specs/new/em_2char.html @@ -23,3 +23,5 @@

1_

1*

+ +

It’s leviOHsa, not levioSAH.

\ No newline at end of file diff --git a/test/specs/new/em_2char.md b/test/specs/new/em_2char.md index ca8689aaba..ef8e636657 100644 --- a/test/specs/new/em_2char.md +++ b/test/specs/new/em_2char.md @@ -23,3 +23,5 @@ _ 123_ _1__ *1** + +It’s levi*OH*sa, not levio*SAH.* From 6fc0721482e1a888728fd0f2f5f1352789e55cd9 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 3 Apr 2020 14:40:34 +0300 Subject: [PATCH 2/2] perf: regexp for em, close #1607 --- src/rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rules.js b/src/rules.js index 85cccd5efd..268d0cf29a 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\*])\*(?!\*|[^\spunctuation])|^\*([^\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,