Skip to content

Commit 393354c

Browse files
author
Vitaly Puzrin
committed
Dist rebuild
1 parent 8564eed commit 393354c

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

dist/markdown-it.js

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! markdown-it 12.2.0 https://github.com/markdown-it/markdown-it @license MIT */
1+
/*! markdown-it 12.3.0 https://github.com/markdown-it/markdown-it @license MIT */
22
(function(global, factory) {
33
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
44
global.markdownit = factory());
@@ -5906,8 +5906,6 @@
59065906
marker: marker,
59075907
length: 0,
59085908
// disable "rule of 3" length checks meant for emphasis
5909-
jump: i / 2,
5910-
// for `~~` 1 marker = 2 characters
59115909
token: state.tokens.length - 1,
59125910
end: -1,
59135911
open: scanned.can_open,
@@ -5999,12 +5997,6 @@
59995997
marker: marker,
60005998
// Total length of these series of delimiters.
60015999
length: scanned.length,
6002-
// An amount of characters before this one that's equivalent to
6003-
// current one. In plain English: if this delimiter does not open
6004-
// an emphasis, neither do previous `jump` characters.
6005-
// Used to skip sequences like "*****" in one step, for 1st asterisk
6006-
// value will be 0, for 2nd it's 1 and so on.
6007-
jump: i,
60086000
// A position of the token this delimiter corresponds to.
60096001
token: state.tokens.length - 1,
60106002
// If this delimiter is matched as a valid opener, `end` will be
@@ -6036,7 +6028,11 @@
60366028

60376029
// `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`
60386030

6039-
isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 && delimiters[i - 1].token === startDelim.token - 1 && delimiters[startDelim.end + 1].token === endDelim.token + 1 && delimiters[i - 1].marker === startDelim.marker;
6031+
isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 &&
6032+
// check that first two markers match and adjacent
6033+
delimiters[i - 1].marker === startDelim.marker && delimiters[i - 1].token === startDelim.token - 1 &&
6034+
// check that last two markers are adjacent (we can safely assume they match)
6035+
delimiters[startDelim.end + 1].token === endDelim.token + 1;
60406036
ch = String.fromCharCode(startDelim.marker);
60416037
token = state.tokens[startDelim.token];
60426038
token.type = isStrong ? "strong_open" : "em_open";
@@ -6448,8 +6444,23 @@
64486444
// For each opening emphasis-like marker find a matching closing one
64496445
function processDelimiters(state, delimiters) {
64506446
var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx, isOddMatch, lastJump, openersBottom = {}, max = delimiters.length;
6447+
if (!max) return;
6448+
// headerIdx is the first delimiter of the current (where closer is) delimiter run
6449+
var headerIdx = 0;
6450+
var lastTokenIdx = -2;
6451+
// needs any value lower than -1
6452+
var jumps = [];
64516453
for (closerIdx = 0; closerIdx < max; closerIdx++) {
64526454
closer = delimiters[closerIdx];
6455+
jumps.push(0);
6456+
// markers belong to same delimiter run if:
6457+
// - they have adjacent tokens
6458+
// - AND markers are the same
6459+
6460+
if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {
6461+
headerIdx = closerIdx;
6462+
}
6463+
lastTokenIdx = closer.token;
64536464
// Length is only used for emphasis-specific "rule of 3",
64546465
// if it's not defined (in strikethrough or 3rd party plugins),
64556466
// we can default it to 0 to disable those checks.
@@ -6464,11 +6475,9 @@
64646475
openersBottom[closer.marker] = [ -1, -1, -1, -1, -1, -1 ];
64656476
}
64666477
minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + closer.length % 3];
6467-
openerIdx = closerIdx - closer.jump - 1;
6468-
// avoid crash if `closer.jump` is pointing outside of the array, see #742
6469-
if (openerIdx < -1) openerIdx = -1;
6478+
openerIdx = headerIdx - jumps[headerIdx] - 1;
64706479
newMinOpenerIdx = openerIdx;
6471-
for (;openerIdx > minOpenerIdx; openerIdx -= opener.jump + 1) {
6480+
for (;openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
64726481
opener = delimiters[openerIdx];
64736482
if (opener.marker !== closer.marker) continue;
64746483
if (opener.open && opener.end < 0) {
@@ -6491,13 +6500,16 @@
64916500
// If previous delimiter cannot be an opener, we can safely skip
64926501
// the entire sequence in future checks. This is required to make
64936502
// sure algorithm has linear complexity (see *_*_*_*_*_... case).
6494-
lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ? delimiters[openerIdx - 1].jump + 1 : 0;
6495-
closer.jump = closerIdx - openerIdx + lastJump;
6503+
lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ? jumps[openerIdx - 1] + 1 : 0;
6504+
jumps[closerIdx] = closerIdx - openerIdx + lastJump;
6505+
jumps[openerIdx] = lastJump;
64966506
closer.open = false;
64976507
opener.end = closerIdx;
6498-
opener.jump = lastJump;
64996508
opener.close = false;
65006509
newMinOpenerIdx = -1;
6510+
// treat next token as start of run,
6511+
// it optimizes skips in **<...>**a**<...>** pathological case
6512+
lastTokenIdx = -2;
65016513
break;
65026514
}
65036515
}
@@ -6794,7 +6806,7 @@
67946806
re.src_auth = "(?:(?:(?!" + re.src_ZCc + "|[@/\\[\\]()]).)+@)?";
67956807
re.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";
67966808
re.src_host_terminator = "(?=$|" + text_separators + "|" + re.src_ZPCc + ")(?!-|_|:\\d|\\.-|\\.(?!$|" + re.src_ZPCc + "))";
6797-
re.src_path = "(?:" + "[/?#]" + "(?:" + "(?!" + re.src_ZCc + "|" + text_separators + "|[()[\\]{}.,\"'?!\\-]).|" + "\\[(?:(?!" + re.src_ZCc + "|\\]).)*\\]|" + "\\((?:(?!" + re.src_ZCc + "|[)]).)*\\)|" + "\\{(?:(?!" + re.src_ZCc + "|[}]).)*\\}|" + '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' + "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" + "\\'(?=" + re.src_pseudo_letter + "|[-]).|" + // allow `I'm_king` if no pair found
6809+
re.src_path = "(?:" + "[/?#]" + "(?:" + "(?!" + re.src_ZCc + "|" + text_separators + "|[()[\\]{}.,\"'?!\\-;]).|" + "\\[(?:(?!" + re.src_ZCc + "|\\]).)*\\]|" + "\\((?:(?!" + re.src_ZCc + "|[)]).)*\\)|" + "\\{(?:(?!" + re.src_ZCc + "|[}]).)*\\}|" + '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' + "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" + "\\'(?=" + re.src_pseudo_letter + "|[-]).|" + // allow `I'm_king` if no pair found
67986810
"\\.{2,}[a-zA-Z0-9%/&]|" + // google has many dots in "google search" links (#66, #81).
67996811
// github has ... in commit range links,
68006812
// Restrict to
@@ -6803,7 +6815,8 @@
68036815
// - parts of file path
68046816
// - params separator
68056817
// until more examples found.
6806-
"\\.(?!" + re.src_ZCc + "|[.]).|" + (opts && opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + "\\,(?!" + re.src_ZCc + ").|" + // allow `,,,` in paths
6818+
"\\.(?!" + re.src_ZCc + "|[.]).|" + (opts && opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + ",(?!" + re.src_ZCc + ").|" + // allow `,,,` in paths
6819+
";(?!" + re.src_ZCc + ").|" + // allow `;` if not followed by space-like char
68076820
"\\!+(?!" + re.src_ZCc + "|[!]).|" + // allow `!!!` in paths, but not at the end
68086821
"\\?(?!" + re.src_ZCc + "|[?])." + ")+" + "|\\/" + ")?";
68096822
// Allow anything in markdown spec, forbid quote (") at the first position

dist/markdown-it.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy