From c38ee23f45aab44f55687b44c81ddcab0f25e714 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 29 May 2020 20:53:58 -0400 Subject: [PATCH] Fix Pedantic --- src/rules.js | 2 +- test/specs/run-spec.js | 2 ++ test/specs/what/em_left_square_bracket.html | 4 ++++ test/specs/what/em_left_square_bracket.md | 10 ++++++++++ test/specs/what/em_left_square_bracket0.html | 1 + test/specs/what/em_left_square_bracket0.md | 1 + test/specs/what/em_left_square_bracket00.html | 1 + test/specs/what/em_left_square_bracket00.md | 1 + test/specs/what/em_left_square_bracket000.html | 1 + test/specs/what/em_left_square_bracket0000.html | 1 + test/specs/what/em_left_square_bracket0000.md | 1 + test/specs/whats/strong_and_em_together.html | 7 +++++++ test/specs/whats/strong_and_em_together.md | 7 +++++++ 13 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/specs/what/em_left_square_bracket.html create mode 100644 test/specs/what/em_left_square_bracket.md create mode 100644 test/specs/what/em_left_square_bracket0.html create mode 100644 test/specs/what/em_left_square_bracket0.md create mode 100644 test/specs/what/em_left_square_bracket00.html create mode 100644 test/specs/what/em_left_square_bracket00.md create mode 100644 test/specs/what/em_left_square_bracket000.html create mode 100644 test/specs/what/em_left_square_bracket0000.html create mode 100644 test/specs/what/em_left_square_bracket0000.md create mode 100644 test/specs/whats/strong_and_em_together.html create mode 100644 test/specs/whats/strong_and_em_together.md diff --git a/src/rules.js b/src/rules.js index 6bbbfc4b..be90fcfc 100644 --- a/src/rules.js +++ b/src/rules.js @@ -229,7 +229,7 @@ inline.normal = merge({}, inline); inline.pedantic = merge({}, inline.normal, { strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/, + em: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/, link: edit(/^!?\[(label)\]\((.*?)\)/) .replace('label', inline._label) .getRegex(), diff --git a/test/specs/run-spec.js b/test/specs/run-spec.js index 5fb5651b..debf91ef 100644 --- a/test/specs/run-spec.js +++ b/test/specs/run-spec.js @@ -53,3 +53,5 @@ runSpecs('Original', './original', false, { gfm: false, pedantic: true }); runSpecs('New', './new'); runSpecs('ReDOS', './redos'); runSpecs('Security', './security', false, { silent: true }); // silent - do not show deprecation warning + +//runSpecs('Whats', './whats'); diff --git a/test/specs/what/em_left_square_bracket.html b/test/specs/what/em_left_square_bracket.html new file mode 100644 index 00000000..7132caf8 --- /dev/null +++ b/test/specs/what/em_left_square_bracket.html @@ -0,0 +1,4 @@ +

[[punctuation, asterisk, punctuation should work

+

[space, asterisk, punctuation should work

+

pnon-punctuation, asterisk, non-punctuation should work

+

p*[non-punctuation, asterisk, punctuation should NOT work*

diff --git a/test/specs/what/em_left_square_bracket.md b/test/specs/what/em_left_square_bracket.md new file mode 100644 index 00000000..4f6d7a70 --- /dev/null +++ b/test/specs/what/em_left_square_bracket.md @@ -0,0 +1,10 @@ +[*[punctuation, asterisk, punctuation should work* + + + *[space, asterisk, punctuation should work* + + +p*non-punctuation, asterisk, non-punctuation should work* + + +p*[non-punctuation, asterisk, punctuation should NOT work* diff --git a/test/specs/what/em_left_square_bracket0.html b/test/specs/what/em_left_square_bracket0.html new file mode 100644 index 00000000..8f88af18 --- /dev/null +++ b/test/specs/what/em_left_square_bracket0.html @@ -0,0 +1 @@ +

foo bar

diff --git a/test/specs/what/em_left_square_bracket0.md b/test/specs/what/em_left_square_bracket0.md new file mode 100644 index 00000000..300738b4 --- /dev/null +++ b/test/specs/what/em_left_square_bracket0.md @@ -0,0 +1 @@ +*foo *bar** diff --git a/test/specs/what/em_left_square_bracket00.html b/test/specs/what/em_left_square_bracket00.html new file mode 100644 index 00000000..67ef9766 --- /dev/null +++ b/test/specs/what/em_left_square_bracket00.html @@ -0,0 +1 @@ +

foo bar baz

diff --git a/test/specs/what/em_left_square_bracket00.md b/test/specs/what/em_left_square_bracket00.md new file mode 100644 index 00000000..bc4e9514 --- /dev/null +++ b/test/specs/what/em_left_square_bracket00.md @@ -0,0 +1 @@ +*foo **bar** baz* diff --git a/test/specs/what/em_left_square_bracket000.html b/test/specs/what/em_left_square_bracket000.html new file mode 100644 index 00000000..2a71b393 --- /dev/null +++ b/test/specs/what/em_left_square_bracket000.html @@ -0,0 +1 @@ +

foo _

diff --git a/test/specs/what/em_left_square_bracket0000.html b/test/specs/what/em_left_square_bracket0000.html new file mode 100644 index 00000000..cd620e6a --- /dev/null +++ b/test/specs/what/em_left_square_bracket0000.html @@ -0,0 +1 @@ +

(foo)

diff --git a/test/specs/what/em_left_square_bracket0000.md b/test/specs/what/em_left_square_bracket0000.md new file mode 100644 index 00000000..261a3189 --- /dev/null +++ b/test/specs/what/em_left_square_bracket0000.md @@ -0,0 +1 @@ +*(**foo**)* diff --git a/test/specs/whats/strong_and_em_together.html b/test/specs/whats/strong_and_em_together.html new file mode 100644 index 00000000..71ec78c7 --- /dev/null +++ b/test/specs/whats/strong_and_em_together.html @@ -0,0 +1,7 @@ +

This is strong and em.

+ +

So is this word.

+ +

This is strong and em.

+ +

So is this word.

diff --git a/test/specs/whats/strong_and_em_together.md b/test/specs/whats/strong_and_em_together.md new file mode 100644 index 00000000..95ee690d --- /dev/null +++ b/test/specs/whats/strong_and_em_together.md @@ -0,0 +1,7 @@ +***This is strong and em.*** + +So is ***this*** word. + +___This is strong and em.___ + +So is ___this___ word.