|
|
@ -22,7 +22,11 @@ function scanDelims(state, start) { |
|
|
|
lastChar = start > 0 ? state.src.charCodeAt(start - 1) : -1; |
|
|
|
|
|
|
|
while (pos < max && state.src.charCodeAt(pos) === marker) { pos++; } |
|
|
|
if (pos >= max) { can_open = false; } |
|
|
|
|
|
|
|
if (pos >= max) { |
|
|
|
can_open = false; |
|
|
|
} |
|
|
|
|
|
|
|
count = pos - start; |
|
|
|
|
|
|
|
nextChar = pos < max ? state.src.charCodeAt(pos) : -1; |
|
|
@ -31,13 +35,15 @@ function scanDelims(state, start) { |
|
|
|
(isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar))); |
|
|
|
isNextPunctChar = nextChar >= 0 && |
|
|
|
(isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar))); |
|
|
|
isLastWhiteSpace = lastChar >= 0 && isWhiteSpace(lastChar); |
|
|
|
isNextWhiteSpace = nextChar >= 0 && isWhiteSpace(nextChar); |
|
|
|
|
|
|
|
// begin/end of the line counts as a whitespace too
|
|
|
|
isLastWhiteSpace = lastChar < 0 || isWhiteSpace(lastChar); |
|
|
|
isNextWhiteSpace = nextChar < 0 || isWhiteSpace(nextChar); |
|
|
|
|
|
|
|
if (isNextWhiteSpace) { |
|
|
|
can_open = false; |
|
|
|
} else if (isNextPunctChar) { |
|
|
|
if (!(isLastWhiteSpace || isLastPunctChar || lastChar === -1)) { |
|
|
|
if (!(isLastWhiteSpace || isLastPunctChar)) { |
|
|
|
can_open = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -45,7 +51,7 @@ function scanDelims(state, start) { |
|
|
|
if (isLastWhiteSpace) { |
|
|
|
can_close = false; |
|
|
|
} else if (isLastPunctChar) { |
|
|
|
if (!(isNextWhiteSpace || isNextPunctChar || nextChar === -1)) { |
|
|
|
if (!(isNextWhiteSpace || isNextPunctChar)) { |
|
|
|
can_close = false; |
|
|
|
} |
|
|
|
} |
|
|
|