mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-09-16 12:39:05 +00:00
update
This commit is contained in:
44
node_modules/markdown-it/lib/rules_inline/balance_pairs.js
generated
vendored
Normal file
44
node_modules/markdown-it/lib/rules_inline/balance_pairs.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// For each opening emphasis-like marker find a matching closing one
|
||||
//
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = function link_pairs(state) {
|
||||
var i, j, lastDelim, currDelim,
|
||||
delimiters = state.delimiters,
|
||||
max = state.delimiters.length;
|
||||
|
||||
for (i = 0; i < max; i++) {
|
||||
lastDelim = delimiters[i];
|
||||
|
||||
if (!lastDelim.close) { continue; }
|
||||
|
||||
j = i - lastDelim.jump - 1;
|
||||
|
||||
while (j >= 0) {
|
||||
currDelim = delimiters[j];
|
||||
|
||||
if (currDelim.open &&
|
||||
currDelim.marker === lastDelim.marker &&
|
||||
currDelim.end < 0 &&
|
||||
currDelim.level === lastDelim.level) {
|
||||
|
||||
// typeofs are for backward compatibility with plugins
|
||||
var odd_match = (currDelim.close || lastDelim.open) &&
|
||||
typeof currDelim.length !== 'undefined' &&
|
||||
typeof lastDelim.length !== 'undefined' &&
|
||||
(currDelim.length + lastDelim.length) % 3 === 0;
|
||||
|
||||
if (!odd_match) {
|
||||
lastDelim.jump = i - j;
|
||||
lastDelim.open = false;
|
||||
currDelim.end = i;
|
||||
currDelim.jump = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
j -= currDelim.jump + 1;
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user