Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2710272

Browse files
author
Vitaly Puzrin
committed
dist rebuild
1 parent fc3dc00 commit 2710272

File tree

2 files changed

+77
-52
lines changed

2 files changed

+77
-52
lines changed

dist/markdown-it.js

Lines changed: 74 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! markdown-it 12.0.2 https://github.com/markdown-it/markdown-it @license MIT */
1+
/*! markdown-it 12.0.3 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());
@@ -2965,6 +2965,9 @@
29652965
if (code === 10 /* \n */) {
29662966
return result;
29672967
}
2968+
if (code === 60 /* < */) {
2969+
return result;
2970+
}
29682971
if (code === 62 /* > */) {
29692972
result.pos = pos + 1;
29702973
result.str = unescapeAll(str.slice(start + 1, pos));
@@ -2992,11 +2995,17 @@
29922995
break;
29932996
}
29942997
if (code === 92 /* \ */ && pos + 1 < max) {
2998+
if (str.charCodeAt(pos + 1) === 32) {
2999+
break;
3000+
}
29953001
pos += 2;
29963002
continue;
29973003
}
29983004
if (code === 40 /* ( */) {
29993005
level++;
3006+
if (level > 32) {
3007+
return result;
3008+
}
30003009
}
30013010
if (code === 41 /* ) */) {
30023011
if (level === 0) {
@@ -3046,6 +3055,8 @@
30463055
result.str = unescapeAll$1(str.slice(start + 1, pos));
30473056
result.ok = true;
30483057
return result;
3058+
} else if (code === 40 /* ( */ && marker === 41 /* ) */) {
3059+
return result;
30493060
} else if (code === 10) {
30503061
lines++;
30513062
} else if (code === 92 /* \ */ && pos + 1 < max) {
@@ -5262,7 +5273,7 @@
52625273
return true;
52635274
};
52645275
// List of valid html blocks names, accorting to commonmark spec
5265-
var html_blocks = [ "address", "article", "aside", "base", "basefont", "blockquote", "body", "caption", "center", "col", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "meta", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "section", "source", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul" ];
5276+
var html_blocks = [ "address", "article", "aside", "base", "basefont", "blockquote", "body", "caption", "center", "col", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "section", "source", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul" ];
52665277
// Regexps to match html elements
52675278
var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
52685279
var unquoted = "[^\"'=<>`\\x00-\\x20]+";
@@ -5273,7 +5284,7 @@
52735284
var open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>";
52745285
var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
52755286
var comment = "\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e";
5276-
var processing = "<[?].*?[?]>";
5287+
var processing = "<[?][\\s\\S]*?[?]>";
52775288
var declaration = "<![A-Z]+\\s+[^>]*>";
52785289
var cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>";
52795290
var HTML_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + "|" + comment + "|" + processing + "|" + declaration + "|" + cdata + ")");
@@ -5797,24 +5808,35 @@
57975808
};
57985809
// Parse backticks
57995810
var backticks = function backtick(state, silent) {
5800-
var start, max, marker, matchStart, matchEnd, token, pos = state.pos, ch = state.src.charCodeAt(pos);
5811+
var start, max, marker, token, matchStart, matchEnd, openerLength, closerLength, pos = state.pos, ch = state.src.charCodeAt(pos);
58015812
if (ch !== 96 /* ` */) {
58025813
return false;
58035814
}
58045815
start = pos;
58055816
pos++;
58065817
max = state.posMax;
5807-
while (pos < max && state.src.charCodeAt(pos) === 96 /* ` */) {
5818+
// scan marker length
5819+
while (pos < max && state.src.charCodeAt(pos) === 96 /* ` */) {
58085820
pos++;
58095821
}
58105822
marker = state.src.slice(start, pos);
5823+
openerLength = marker.length;
5824+
if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
5825+
if (!silent) state.pending += marker;
5826+
state.pos += openerLength;
5827+
return true;
5828+
}
58115829
matchStart = matchEnd = pos;
5812-
while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
5830+
// Nothing found in the cache, scan until the end of the line (or until marker is found)
5831+
while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
58135832
matchEnd = matchStart + 1;
5814-
while (matchEnd < max && state.src.charCodeAt(matchEnd) === 96 /* ` */) {
5833+
// scan marker length
5834+
while (matchEnd < max && state.src.charCodeAt(matchEnd) === 96 /* ` */) {
58155835
matchEnd++;
58165836
}
5817-
if (matchEnd - matchStart === marker.length) {
5837+
closerLength = matchEnd - matchStart;
5838+
if (closerLength === openerLength) {
5839+
// Found matching closer length.
58185840
if (!silent) {
58195841
token = state.push("code_inline", "code", 0);
58205842
token.markup = marker;
@@ -5823,11 +5845,13 @@
58235845
state.pos = matchEnd;
58245846
return true;
58255847
}
5848+
// Some different length found, put it in cache as upper limit of where closer can be found
5849+
state.backticks[closerLength] = matchStart;
58265850
}
5827-
if (!silent) {
5828-
state.pending += marker;
5829-
}
5830-
state.pos += marker.length;
5851+
// Scanned through the end, didn't find anything
5852+
state.backticksScanned = true;
5853+
if (!silent) state.pending += marker;
5854+
state.pos += openerLength;
58315855
return true;
58325856
};
58335857
// ~~strike through~~
@@ -6027,7 +6051,7 @@
60276051
var normalizeReference$1 = utils.normalizeReference;
60286052
var isSpace$9 = utils.isSpace;
60296053
var link = function link(state, silent) {
6030-
var attrs, code, label, labelEnd, labelStart, pos, res, ref, title, token, href = "", oldPos = state.pos, max = state.posMax, start = state.pos, parseReference = true;
6054+
var attrs, code, label, labelEnd, labelStart, pos, res, ref, token, href = "", title = "", oldPos = state.pos, max = state.posMax, start = state.pos, parseReference = true;
60316055
if (state.src.charCodeAt(state.pos) !== 91 /* [ */) {
60326056
return false;
60336057
}
@@ -6065,32 +6089,30 @@
60656089
} else {
60666090
href = "";
60676091
}
6068-
}
6069-
// [link]( <href> "title" )
6070-
// ^^ skipping these spaces
6071-
start = pos;
6072-
for (;pos < max; pos++) {
6073-
code = state.src.charCodeAt(pos);
6074-
if (!isSpace$9(code) && code !== 10) {
6075-
break;
6076-
}
6077-
}
6078-
// [link]( <href> "title" )
6079-
// ^^^^^^^ parsing link title
6080-
res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
6081-
if (pos < max && start !== pos && res.ok) {
6082-
title = res.str;
6083-
pos = res.pos;
60846092
// [link]( <href> "title" )
6085-
// ^^ skipping these spaces
6086-
for (;pos < max; pos++) {
6093+
// ^^ skipping these spaces
6094+
start = pos;
6095+
for (;pos < max; pos++) {
60876096
code = state.src.charCodeAt(pos);
60886097
if (!isSpace$9(code) && code !== 10) {
60896098
break;
60906099
}
60916100
}
6092-
} else {
6093-
title = "";
6101+
// [link]( <href> "title" )
6102+
// ^^^^^^^ parsing link title
6103+
res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
6104+
if (pos < max && start !== pos && res.ok) {
6105+
title = res.str;
6106+
pos = res.pos;
6107+
// [link]( <href> "title" )
6108+
// ^^ skipping these spaces
6109+
for (;pos < max; pos++) {
6110+
code = state.src.charCodeAt(pos);
6111+
if (!isSpace$9(code) && code !== 10) {
6112+
break;
6113+
}
6114+
}
6115+
}
60946116
}
60956117
if (pos >= max || state.src.charCodeAt(pos) !== 41 /* ) */) {
60966118
// parsing a valid shortcut link failed, fallback to reference
@@ -6269,20 +6291,23 @@
62696291
return true;
62706292
};
62716293
// Process autolinks '<protocol:...>'
6272-
/*eslint max-len:0*/ var EMAIL_RE = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;
6273-
var AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;
6294+
/*eslint max-len:0*/ var EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;
6295+
var AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/;
62746296
var autolink = function autolink(state, silent) {
6275-
var tail, linkMatch, emailMatch, url, fullUrl, token, pos = state.pos;
6297+
var url, fullUrl, token, ch, start, max, pos = state.pos;
62766298
if (state.src.charCodeAt(pos) !== 60 /* < */) {
62776299
return false;
62786300
}
6279-
tail = state.src.slice(pos);
6280-
if (tail.indexOf(">") < 0) {
6281-
return false;
6301+
start = state.pos;
6302+
max = state.posMax;
6303+
for (;;) {
6304+
if (++pos >= max) return false;
6305+
ch = state.src.charCodeAt(pos);
6306+
if (ch === 60 /* < */) return false;
6307+
if (ch === 62 /* > */) break;
62826308
}
6283-
if (AUTOLINK_RE.test(tail)) {
6284-
linkMatch = tail.match(AUTOLINK_RE);
6285-
url = linkMatch[0].slice(1, -1);
6309+
url = state.src.slice(start + 1, pos);
6310+
if (AUTOLINK_RE.test(url)) {
62866311
fullUrl = state.md.normalizeLink(url);
62876312
if (!state.md.validateLink(fullUrl)) {
62886313
return false;
@@ -6298,12 +6323,10 @@
62986323
token.markup = "autolink";
62996324
token.info = "auto";
63006325
}
6301-
state.pos += linkMatch[0].length;
6326+
state.pos += url.length + 2;
63026327
return true;
63036328
}
6304-
if (EMAIL_RE.test(tail)) {
6305-
emailMatch = tail.match(EMAIL_RE);
6306-
url = emailMatch[0].slice(1, -1);
6329+
if (EMAIL_RE.test(url)) {
63076330
fullUrl = state.md.normalizeLink("mailto:" + url);
63086331
if (!state.md.validateLink(fullUrl)) {
63096332
return false;
@@ -6319,7 +6342,7 @@
63196342
token.markup = "autolink";
63206343
token.info = "auto";
63216344
}
6322-
state.pos += emailMatch[0].length;
6345+
state.pos += url.length + 2;
63236346
return true;
63246347
}
63256348
return false;
@@ -6415,12 +6438,11 @@
64156438
openersBottom[closer.marker] = [ -1, -1, -1 ];
64166439
}
64176440
minOpenerIdx = openersBottom[closer.marker][closer.length % 3];
6418-
newMinOpenerIdx = -1;
64196441
openerIdx = closerIdx - closer.jump - 1;
6442+
newMinOpenerIdx = openerIdx;
64206443
for (;openerIdx > minOpenerIdx; openerIdx -= opener.jump + 1) {
64216444
opener = delimiters[openerIdx];
64226445
if (opener.marker !== closer.marker) continue;
6423-
if (newMinOpenerIdx === -1) newMinOpenerIdx = openerIdx;
64246446
if (opener.open && opener.end < 0) {
64256447
isOddMatch = false;
64266448
// from spec:
@@ -6517,6 +6539,9 @@
65176539
this.delimiters = [];
65186540
// Stack of delimiter lists for upper level tags
65196541
this._prev_delimiters = [];
6542+
// backtick length => last seen position
6543+
this.backticks = {};
6544+
this.backticksScanned = false;
65206545
}
65216546
// Flush pending text
65226547

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)