diff --git a/src/rules.ts b/src/rules.ts index cc2e62bccf..04d58f222c 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -285,6 +285,13 @@ const _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u; const punctuation = edit(/^((?![*_])punctSpace)/, 'u') .replace(/punctSpace/g, _punctuationOrSpace).getRegex(); +/** Quote chars for pedantic rule 6 lookbehind; includes both straight and curly forms. */ +const closeQuoteClass = '["\u201c\u201d\u2018\u2019\']'; +/** Quote chars excluded from pedantic left-delim captured punct so `**"` / `**'` yields an empty nextChar. */ +const openQuoteClass = '["\'\u2018\u2019\u201c]'; +/** When lookbehind is supported, pedantic rule 6 does not match immediately after a quote (e.g. `"**` in `**"A"**`). */ +const closeQuoteLookbehind = supportsLookbehind ? `(? = { ...inlineNormal, + emStrongLDelim: emStrongLDelimPedantic, + emStrongRDelimAst: emStrongRDelimAstPedantic, + emStrongRDelimUnd: emStrongRDelimUndPedantic, link: edit(/^!?\[(label)\]\((.*?)\)/) .replace('label', _inlineLabel) .getRegex(), diff --git a/test/specs/original/strong_punctuation.html b/test/specs/original/strong_punctuation.html new file mode 100644 index 0000000000..ceac387649 --- /dev/null +++ b/test/specs/original/strong_punctuation.html @@ -0,0 +1,15 @@ +
foo:bar
+ +foobar
+ +foo:bar
+ +foo:bar
+ +foo:bar
+ +aa"A"and"B"aa
+ +aa'A'and'B'aa
+ +We can compare "direction" and "distance" in two ways
diff --git a/test/specs/original/strong_punctuation.md b/test/specs/original/strong_punctuation.md new file mode 100644 index 0000000000..d6a4c453eb --- /dev/null +++ b/test/specs/original/strong_punctuation.md @@ -0,0 +1,19 @@ +--- +pedantic: true +--- + +**foo:**bar + +**foo**bar + +*foo:*bar + +_foo:_bar + +__foo:__bar + +aa**"A"**and**"B"**aa + +aa**'A'**and**'B'**aa + +We can compare **"direction"** and **"distance"** in two ways