|
|
@ -1,10 +1,11 @@ |
|
|
|
// Process ++inserted text++
|
|
|
|
// Process ==highlighted text==
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
module.exports = function mark(state, silent) { |
|
|
|
module.exports = function del(state, silent) { |
|
|
|
var found, |
|
|
|
pos, |
|
|
|
stack, |
|
|
|
max = state.posMax, |
|
|
|
start = state.pos, |
|
|
|
lastChar, |
|
|
@ -13,11 +14,6 @@ module.exports = function mark(state, silent) { |
|
|
|
if (state.src.charCodeAt(start) !== 0x3D/* = */) { return false; } |
|
|
|
if (start + 4 >= max) { return false; } |
|
|
|
if (state.src.charCodeAt(start + 1) !== 0x3D/* = */) { return false; } |
|
|
|
|
|
|
|
// make ins lower a priority tag with respect to links, same as <em>;
|
|
|
|
// this code also prevents recursion
|
|
|
|
if (silent && state.isInLabel) { return false; } |
|
|
|
|
|
|
|
if (state.level >= state.options.maxNesting) { return false; } |
|
|
|
|
|
|
|
lastChar = start > 0 ? state.src.charCodeAt(start - 1) : -1; |
|
|
@ -37,6 +33,7 @@ module.exports = function mark(state, silent) { |
|
|
|
} |
|
|
|
|
|
|
|
state.pos = start + 2; |
|
|
|
stack = 1; |
|
|
|
|
|
|
|
while (state.pos + 1 < max) { |
|
|
|
if (state.src.charCodeAt(state.pos) === 0x3D/* = */) { |
|
|
@ -45,7 +42,15 @@ module.exports = function mark(state, silent) { |
|
|
|
nextChar = state.pos + 2 < max ? state.src.charCodeAt(state.pos + 2) : -1; |
|
|
|
if (nextChar !== 0x3D/* = */ && lastChar !== 0x3D/* = */) { |
|
|
|
if (lastChar !== 0x20 && lastChar !== 0x0A) { |
|
|
|
// closing '++'
|
|
|
|
// closing '=='
|
|
|
|
stack--; |
|
|
|
} else if (nextChar !== 0x20 && nextChar !== 0x0A) { |
|
|
|
// opening '=='
|
|
|
|
stack++; |
|
|
|
} // else {
|
|
|
|
// // standalone ' == ' indented with spaces
|
|
|
|
//}
|
|
|
|
if (stack <= 0) { |
|
|
|
found = true; |
|
|
|
break; |
|
|
|
} |
|
|
|