Browse Source

Allow opening quote after another punctuation char in typographer

close https://github.com/markdown-it/markdown-it/issues/643
pull/652/head
Alex Kocharin 4 years ago
parent
commit
f798bea962
  1. 10
      lib/rules_core/smartquotes.js
  2. 7
      test/fixtures/markdown-it/smartquotes.txt

10
lib/rules_core/smartquotes.js

@ -114,8 +114,14 @@ function process_inlines(tokens, state) {
}
if (canOpen && canClose) {
// treat this as the middle of the word
canOpen = false;
// Replace quotes in the middle of punctuation sequence, but not
// in the middle of the words, i.e.:
//
// 1. foo " bar " baz - not replaced
// 2. foo-"-bar-"-baz - replaced
// 3. foo"bar"baz - not replaced
//
canOpen = isLastPunctChar;
canClose = isNextPunctChar;
}

7
test/fixtures/markdown-it/smartquotes.txt

@ -137,3 +137,10 @@ and “that”.</p>
<p>“this” and<br>
“that”.</p>
.
Should allow quotes adjacent to other punctuation characters, #643:
.
The dog---"'man's' best friend"
.
<p>The dog—“‘man’s’ best friend”</p>
.

Loading…
Cancel
Save