artalk 2.5.3 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Artalk.es.js +221 -142
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.js +1 -1
- package/dist/ArtalkLite.es.js +16 -16
- package/dist/ArtalkLite.iife.js +1 -1
- package/dist/ArtalkLite.js +1 -1
- package/dist/types/artalk-config.d.ts +3 -3
- package/package.json +3 -3
- package/src/defaults.ts +1 -1
- package/src/editor/submit.ts +4 -4
- package/src/lib/utils.ts +2 -1
- package/types/artalk-config.d.ts +3 -3
package/dist/Artalk.es.js
CHANGED
|
@@ -136,7 +136,8 @@ function onImagesLoaded($container, event) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
function getGravatarURL(ctx, emailMD5) {
|
|
139
|
-
|
|
139
|
+
const { mirror, params } = ctx.conf.gravatar;
|
|
140
|
+
return `${mirror.replace(/\/$/, "")}/${emailMD5}?${params.replace(/^\?/, "")}`;
|
|
140
141
|
}
|
|
141
142
|
function versionCompare(a, b) {
|
|
142
143
|
const pa = a.split(".");
|
|
@@ -540,6 +541,7 @@ function getDefaults() {
|
|
|
540
541
|
headerIds: true,
|
|
541
542
|
headerPrefix: "",
|
|
542
543
|
highlight: null,
|
|
544
|
+
hooks: null,
|
|
543
545
|
langPrefix: "language-",
|
|
544
546
|
mangle: true,
|
|
545
547
|
pedantic: false,
|
|
@@ -664,18 +666,6 @@ function resolveUrl(base, href) {
|
|
|
664
666
|
}
|
|
665
667
|
const noopTest = { exec: function noopTest2() {
|
|
666
668
|
} };
|
|
667
|
-
function merge(obj) {
|
|
668
|
-
let i = 1, target, key;
|
|
669
|
-
for (; i < arguments.length; i++) {
|
|
670
|
-
target = arguments[i];
|
|
671
|
-
for (key in target) {
|
|
672
|
-
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
|
673
|
-
obj[key] = target[key];
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
return obj;
|
|
678
|
-
}
|
|
679
669
|
function splitCells(tableRow, count) {
|
|
680
670
|
const row = tableRow.replace(/\|/g, (match, offset, str) => {
|
|
681
671
|
let escaped = false, curr = offset;
|
|
@@ -743,10 +733,34 @@ function findClosingBracket(str, b) {
|
|
|
743
733
|
}
|
|
744
734
|
return -1;
|
|
745
735
|
}
|
|
746
|
-
function
|
|
747
|
-
if (opt
|
|
736
|
+
function checkDeprecations(opt, callback) {
|
|
737
|
+
if (!opt || opt.silent) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
if (callback) {
|
|
741
|
+
console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async");
|
|
742
|
+
}
|
|
743
|
+
if (opt.sanitize || opt.sanitizer) {
|
|
748
744
|
console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
|
|
749
745
|
}
|
|
746
|
+
if (opt.highlight || opt.langPrefix !== "language-") {
|
|
747
|
+
console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.");
|
|
748
|
+
}
|
|
749
|
+
if (opt.mangle) {
|
|
750
|
+
console.warn("marked(): mangle parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-mangle.");
|
|
751
|
+
}
|
|
752
|
+
if (opt.baseUrl) {
|
|
753
|
+
console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.");
|
|
754
|
+
}
|
|
755
|
+
if (opt.smartypants) {
|
|
756
|
+
console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.");
|
|
757
|
+
}
|
|
758
|
+
if (opt.xhtml) {
|
|
759
|
+
console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.");
|
|
760
|
+
}
|
|
761
|
+
if (opt.headerIds || opt.headerPrefix) {
|
|
762
|
+
console.warn("marked(): headerIds and headerPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-gfm-heading-id.");
|
|
763
|
+
}
|
|
750
764
|
}
|
|
751
765
|
function repeatString(pattern, count) {
|
|
752
766
|
if (count < 1) {
|
|
@@ -1036,6 +1050,7 @@ class Tokenizer {
|
|
|
1036
1050
|
if (cap) {
|
|
1037
1051
|
const token = {
|
|
1038
1052
|
type: "html",
|
|
1053
|
+
block: true,
|
|
1039
1054
|
raw: cap[0],
|
|
1040
1055
|
pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
|
|
1041
1056
|
text: cap[0]
|
|
@@ -1174,6 +1189,7 @@ class Tokenizer {
|
|
|
1174
1189
|
raw: cap[0],
|
|
1175
1190
|
inLink: this.lexer.state.inLink,
|
|
1176
1191
|
inRawBlock: this.lexer.state.inRawBlock,
|
|
1192
|
+
block: false,
|
|
1177
1193
|
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
|
|
1178
1194
|
};
|
|
1179
1195
|
}
|
|
@@ -1410,7 +1426,7 @@ class Tokenizer {
|
|
|
1410
1426
|
const block = {
|
|
1411
1427
|
newline: /^(?: *(?:\n|$))+/,
|
|
1412
1428
|
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
1413
|
-
fences: /^ {0,3}(`{3,}(?=[^`\n]
|
|
1429
|
+
fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1414
1430
|
hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
|
1415
1431
|
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
|
1416
1432
|
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
|
@@ -1435,14 +1451,14 @@ block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
|
1435
1451
|
block.html = edit$1(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
1436
1452
|
block.paragraph = edit$1(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
|
|
1437
1453
|
block.blockquote = edit$1(block.blockquote).replace("paragraph", block.paragraph).getRegex();
|
|
1438
|
-
block.normal =
|
|
1439
|
-
block.gfm =
|
|
1454
|
+
block.normal = __spreadValues({}, block);
|
|
1455
|
+
block.gfm = __spreadProps(__spreadValues({}, block.normal), {
|
|
1440
1456
|
table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
1441
1457
|
// Cells
|
|
1442
1458
|
});
|
|
1443
1459
|
block.gfm.table = edit$1(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
|
|
1444
1460
|
block.gfm.paragraph = edit$1(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
|
|
1445
|
-
block.pedantic =
|
|
1461
|
+
block.pedantic = __spreadProps(__spreadValues({}, block.normal), {
|
|
1446
1462
|
html: edit$1(
|
|
1447
1463
|
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
1448
1464
|
).replace("comment", block._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
@@ -1498,8 +1514,8 @@ inline.link = edit$1(inline.link).replace("label", inline._label).replace("href"
|
|
|
1498
1514
|
inline.reflink = edit$1(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
|
|
1499
1515
|
inline.nolink = edit$1(inline.nolink).replace("ref", block._label).getRegex();
|
|
1500
1516
|
inline.reflinkSearch = edit$1(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
|
|
1501
|
-
inline.normal =
|
|
1502
|
-
inline.pedantic =
|
|
1517
|
+
inline.normal = __spreadValues({}, inline);
|
|
1518
|
+
inline.pedantic = __spreadProps(__spreadValues({}, inline.normal), {
|
|
1503
1519
|
strong: {
|
|
1504
1520
|
start: /^__|\*\*/,
|
|
1505
1521
|
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
|
@@ -1515,7 +1531,7 @@ inline.pedantic = merge({}, inline.normal, {
|
|
|
1515
1531
|
link: edit$1(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
|
|
1516
1532
|
reflink: edit$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
|
|
1517
1533
|
});
|
|
1518
|
-
inline.gfm =
|
|
1534
|
+
inline.gfm = __spreadProps(__spreadValues({}, inline.normal), {
|
|
1519
1535
|
escape: edit$1(inline.escape).replace("])", "~|])").getRegex(),
|
|
1520
1536
|
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
|
1521
1537
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
@@ -1524,7 +1540,7 @@ inline.gfm = merge({}, inline.normal, {
|
|
|
1524
1540
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
1525
1541
|
});
|
|
1526
1542
|
inline.gfm.url = edit$1(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
|
|
1527
|
-
inline.breaks =
|
|
1543
|
+
inline.breaks = __spreadProps(__spreadValues({}, inline.gfm), {
|
|
1528
1544
|
br: edit$1(inline.br).replace("{2,}", "*").getRegex(),
|
|
1529
1545
|
text: edit$1(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1530
1546
|
});
|
|
@@ -1940,7 +1956,7 @@ class Renderer {
|
|
|
1940
1956
|
${quote}</blockquote>
|
|
1941
1957
|
`;
|
|
1942
1958
|
}
|
|
1943
|
-
html(html) {
|
|
1959
|
+
html(html, block2) {
|
|
1944
1960
|
return html;
|
|
1945
1961
|
}
|
|
1946
1962
|
/**
|
|
@@ -2275,7 +2291,7 @@ class Parser {
|
|
|
2275
2291
|
continue;
|
|
2276
2292
|
}
|
|
2277
2293
|
case "html": {
|
|
2278
|
-
out += this.renderer.html(token.text);
|
|
2294
|
+
out += this.renderer.html(token.text, token.block);
|
|
2279
2295
|
continue;
|
|
2280
2296
|
}
|
|
2281
2297
|
case "paragraph": {
|
|
@@ -2375,98 +2391,157 @@ class Parser {
|
|
|
2375
2391
|
return out;
|
|
2376
2392
|
}
|
|
2377
2393
|
}
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2394
|
+
class Hooks {
|
|
2395
|
+
constructor(options) {
|
|
2396
|
+
this.options = options || defaults$3;
|
|
2381
2397
|
}
|
|
2382
|
-
|
|
2383
|
-
|
|
2398
|
+
/**
|
|
2399
|
+
* Process markdown before marked
|
|
2400
|
+
*/
|
|
2401
|
+
preprocess(markdown) {
|
|
2402
|
+
return markdown;
|
|
2384
2403
|
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2404
|
+
/**
|
|
2405
|
+
* Process HTML after marked is finished
|
|
2406
|
+
*/
|
|
2407
|
+
postprocess(html) {
|
|
2408
|
+
return html;
|
|
2388
2409
|
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2410
|
+
}
|
|
2411
|
+
__publicField(Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
2412
|
+
"preprocess",
|
|
2413
|
+
"postprocess"
|
|
2414
|
+
]));
|
|
2415
|
+
function onError(silent, async, callback) {
|
|
2416
|
+
return (e) => {
|
|
2417
|
+
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
|
2418
|
+
if (silent) {
|
|
2419
|
+
const msg = "<p>An error occurred:</p><pre>" + escape(e.message + "", true) + "</pre>";
|
|
2420
|
+
if (async) {
|
|
2421
|
+
return Promise.resolve(msg);
|
|
2422
|
+
}
|
|
2423
|
+
if (callback) {
|
|
2424
|
+
callback(null, msg);
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
return msg;
|
|
2398
2428
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2429
|
+
if (async) {
|
|
2430
|
+
return Promise.reject(e);
|
|
2431
|
+
}
|
|
2432
|
+
if (callback) {
|
|
2433
|
+
callback(e);
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
throw e;
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2439
|
+
function parseMarkdown(lexer, parser2) {
|
|
2440
|
+
return (src, opt, callback) => {
|
|
2441
|
+
if (typeof opt === "function") {
|
|
2442
|
+
callback = opt;
|
|
2443
|
+
opt = null;
|
|
2444
|
+
}
|
|
2445
|
+
const origOpt = __spreadValues({}, opt);
|
|
2446
|
+
opt = __spreadValues(__spreadValues({}, marked$1.defaults), origOpt);
|
|
2447
|
+
const throwError = onError(opt.silent, opt.async, callback);
|
|
2448
|
+
if (typeof src === "undefined" || src === null) {
|
|
2449
|
+
return throwError(new Error("marked(): input parameter is undefined or null"));
|
|
2450
|
+
}
|
|
2451
|
+
if (typeof src !== "string") {
|
|
2452
|
+
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
2453
|
+
}
|
|
2454
|
+
checkDeprecations(opt, callback);
|
|
2455
|
+
if (opt.hooks) {
|
|
2456
|
+
opt.hooks.options = opt;
|
|
2457
|
+
}
|
|
2458
|
+
if (callback) {
|
|
2459
|
+
const highlight = opt.highlight;
|
|
2460
|
+
let tokens;
|
|
2461
|
+
try {
|
|
2462
|
+
if (opt.hooks) {
|
|
2463
|
+
src = opt.hooks.preprocess(src);
|
|
2409
2464
|
}
|
|
2465
|
+
tokens = lexer(src, opt);
|
|
2466
|
+
} catch (e) {
|
|
2467
|
+
return throwError(e);
|
|
2410
2468
|
}
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
delete opt.highlight;
|
|
2418
|
-
if (!tokens.length)
|
|
2419
|
-
return done();
|
|
2420
|
-
let pending = 0;
|
|
2421
|
-
marked$1.walkTokens(tokens, function(token) {
|
|
2422
|
-
if (token.type === "code") {
|
|
2423
|
-
pending++;
|
|
2424
|
-
setTimeout(() => {
|
|
2425
|
-
highlight(token.text, token.lang, function(err, code) {
|
|
2426
|
-
if (err) {
|
|
2427
|
-
return done(err);
|
|
2428
|
-
}
|
|
2429
|
-
if (code != null && code !== token.text) {
|
|
2430
|
-
token.text = code;
|
|
2431
|
-
token.escaped = true;
|
|
2469
|
+
const done = function(err) {
|
|
2470
|
+
let out;
|
|
2471
|
+
if (!err) {
|
|
2472
|
+
try {
|
|
2473
|
+
if (opt.walkTokens) {
|
|
2474
|
+
marked$1.walkTokens(tokens, opt.walkTokens);
|
|
2432
2475
|
}
|
|
2433
|
-
|
|
2434
|
-
if (
|
|
2435
|
-
|
|
2476
|
+
out = parser2(tokens, opt);
|
|
2477
|
+
if (opt.hooks) {
|
|
2478
|
+
out = opt.hooks.postprocess(out);
|
|
2436
2479
|
}
|
|
2437
|
-
})
|
|
2438
|
-
|
|
2480
|
+
} catch (e) {
|
|
2481
|
+
err = e;
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
opt.highlight = highlight;
|
|
2485
|
+
return err ? throwError(err) : callback(null, out);
|
|
2486
|
+
};
|
|
2487
|
+
if (!highlight || highlight.length < 3) {
|
|
2488
|
+
return done();
|
|
2489
|
+
}
|
|
2490
|
+
delete opt.highlight;
|
|
2491
|
+
if (!tokens.length)
|
|
2492
|
+
return done();
|
|
2493
|
+
let pending = 0;
|
|
2494
|
+
marked$1.walkTokens(tokens, function(token) {
|
|
2495
|
+
if (token.type === "code") {
|
|
2496
|
+
pending++;
|
|
2497
|
+
setTimeout(() => {
|
|
2498
|
+
highlight(token.text, token.lang, function(err, code) {
|
|
2499
|
+
if (err) {
|
|
2500
|
+
return done(err);
|
|
2501
|
+
}
|
|
2502
|
+
if (code != null && code !== token.text) {
|
|
2503
|
+
token.text = code;
|
|
2504
|
+
token.escaped = true;
|
|
2505
|
+
}
|
|
2506
|
+
pending--;
|
|
2507
|
+
if (pending === 0) {
|
|
2508
|
+
done();
|
|
2509
|
+
}
|
|
2510
|
+
});
|
|
2511
|
+
}, 0);
|
|
2512
|
+
}
|
|
2513
|
+
});
|
|
2514
|
+
if (pending === 0) {
|
|
2515
|
+
done();
|
|
2439
2516
|
}
|
|
2440
|
-
|
|
2441
|
-
if (pending === 0) {
|
|
2442
|
-
done();
|
|
2517
|
+
return;
|
|
2443
2518
|
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
function onError(e) {
|
|
2447
|
-
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
|
2448
|
-
if (opt.silent) {
|
|
2449
|
-
return "<p>An error occurred:</p><pre>" + escape(e.message + "", true) + "</pre>";
|
|
2519
|
+
if (opt.async) {
|
|
2520
|
+
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer(src2, opt)).then((tokens) => opt.walkTokens ? Promise.all(marked$1.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html) => opt.hooks ? opt.hooks.postprocess(html) : html).catch(throwError);
|
|
2450
2521
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
const tokens = Lexer.lex(src, opt);
|
|
2455
|
-
if (opt.walkTokens) {
|
|
2456
|
-
if (opt.async) {
|
|
2457
|
-
return Promise.all(marked$1.walkTokens(tokens, opt.walkTokens)).then(() => {
|
|
2458
|
-
return Parser.parse(tokens, opt);
|
|
2459
|
-
}).catch(onError);
|
|
2522
|
+
try {
|
|
2523
|
+
if (opt.hooks) {
|
|
2524
|
+
src = opt.hooks.preprocess(src);
|
|
2460
2525
|
}
|
|
2461
|
-
|
|
2526
|
+
const tokens = lexer(src, opt);
|
|
2527
|
+
if (opt.walkTokens) {
|
|
2528
|
+
marked$1.walkTokens(tokens, opt.walkTokens);
|
|
2529
|
+
}
|
|
2530
|
+
let html = parser2(tokens, opt);
|
|
2531
|
+
if (opt.hooks) {
|
|
2532
|
+
html = opt.hooks.postprocess(html);
|
|
2533
|
+
}
|
|
2534
|
+
return html;
|
|
2535
|
+
} catch (e) {
|
|
2536
|
+
return throwError(e);
|
|
2462
2537
|
}
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2538
|
+
};
|
|
2539
|
+
}
|
|
2540
|
+
function marked$1(src, opt, callback) {
|
|
2541
|
+
return parseMarkdown(Lexer.lex, Parser.parse)(src, opt, callback);
|
|
2467
2542
|
}
|
|
2468
2543
|
marked$1.options = marked$1.setOptions = function(opt) {
|
|
2469
|
-
|
|
2544
|
+
marked$1.defaults = __spreadValues(__spreadValues({}, marked$1.defaults), opt);
|
|
2470
2545
|
changeDefaults(marked$1.defaults);
|
|
2471
2546
|
return marked$1;
|
|
2472
2547
|
};
|
|
@@ -2475,8 +2550,8 @@ marked$1.defaults = defaults$3;
|
|
|
2475
2550
|
marked$1.use = function(...args) {
|
|
2476
2551
|
const extensions = marked$1.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
2477
2552
|
args.forEach((pack) => {
|
|
2478
|
-
const opts =
|
|
2479
|
-
opts.async = marked$1.defaults.async || opts.async;
|
|
2553
|
+
const opts = __spreadValues({}, pack);
|
|
2554
|
+
opts.async = marked$1.defaults.async || opts.async || false;
|
|
2480
2555
|
if (pack.extensions) {
|
|
2481
2556
|
pack.extensions.forEach((ext) => {
|
|
2482
2557
|
if (!ext.name) {
|
|
@@ -2555,6 +2630,32 @@ marked$1.use = function(...args) {
|
|
|
2555
2630
|
}
|
|
2556
2631
|
opts.tokenizer = tokenizer;
|
|
2557
2632
|
}
|
|
2633
|
+
if (pack.hooks) {
|
|
2634
|
+
const hooks = marked$1.defaults.hooks || new Hooks();
|
|
2635
|
+
for (const prop in pack.hooks) {
|
|
2636
|
+
const prevHook = hooks[prop];
|
|
2637
|
+
if (Hooks.passThroughHooks.has(prop)) {
|
|
2638
|
+
hooks[prop] = (arg) => {
|
|
2639
|
+
if (marked$1.defaults.async) {
|
|
2640
|
+
return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then((ret2) => {
|
|
2641
|
+
return prevHook.call(hooks, ret2);
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
const ret = pack.hooks[prop].call(hooks, arg);
|
|
2645
|
+
return prevHook.call(hooks, ret);
|
|
2646
|
+
};
|
|
2647
|
+
} else {
|
|
2648
|
+
hooks[prop] = (...args2) => {
|
|
2649
|
+
let ret = pack.hooks[prop].apply(hooks, args2);
|
|
2650
|
+
if (ret === false) {
|
|
2651
|
+
ret = prevHook.apply(hooks, args2);
|
|
2652
|
+
}
|
|
2653
|
+
return ret;
|
|
2654
|
+
};
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
opts.hooks = hooks;
|
|
2658
|
+
}
|
|
2558
2659
|
if (pack.walkTokens) {
|
|
2559
2660
|
const walkTokens = marked$1.defaults.walkTokens;
|
|
2560
2661
|
opts.walkTokens = function(token) {
|
|
@@ -2602,29 +2703,7 @@ marked$1.walkTokens = function(tokens, callback) {
|
|
|
2602
2703
|
}
|
|
2603
2704
|
return values;
|
|
2604
2705
|
};
|
|
2605
|
-
marked$1.parseInline =
|
|
2606
|
-
if (typeof src === "undefined" || src === null) {
|
|
2607
|
-
throw new Error("marked.parseInline(): input parameter is undefined or null");
|
|
2608
|
-
}
|
|
2609
|
-
if (typeof src !== "string") {
|
|
2610
|
-
throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
|
|
2611
|
-
}
|
|
2612
|
-
opt = merge({}, marked$1.defaults, opt || {});
|
|
2613
|
-
checkSanitizeDeprecation(opt);
|
|
2614
|
-
try {
|
|
2615
|
-
const tokens = Lexer.lexInline(src, opt);
|
|
2616
|
-
if (opt.walkTokens) {
|
|
2617
|
-
marked$1.walkTokens(tokens, opt.walkTokens);
|
|
2618
|
-
}
|
|
2619
|
-
return Parser.parseInline(tokens, opt);
|
|
2620
|
-
} catch (e) {
|
|
2621
|
-
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
|
2622
|
-
if (opt.silent) {
|
|
2623
|
-
return "<p>An error occurred:</p><pre>" + escape(e.message + "", true) + "</pre>";
|
|
2624
|
-
}
|
|
2625
|
-
throw e;
|
|
2626
|
-
}
|
|
2627
|
-
};
|
|
2706
|
+
marked$1.parseInline = parseMarkdown(Lexer.lexInline, Parser.parseInline);
|
|
2628
2707
|
marked$1.Parser = Parser;
|
|
2629
2708
|
marked$1.parser = Parser.parse;
|
|
2630
2709
|
marked$1.Renderer = Renderer;
|
|
@@ -2633,6 +2712,7 @@ marked$1.Lexer = Lexer;
|
|
|
2633
2712
|
marked$1.lexer = Lexer.lex;
|
|
2634
2713
|
marked$1.Tokenizer = Tokenizer;
|
|
2635
2714
|
marked$1.Slugger = Slugger;
|
|
2715
|
+
marked$1.Hooks = Hooks;
|
|
2636
2716
|
marked$1.parse = marked$1;
|
|
2637
2717
|
marked$1.options;
|
|
2638
2718
|
marked$1.setOptions;
|
|
@@ -2642,6 +2722,9 @@ marked$1.parseInline;
|
|
|
2642
2722
|
Parser.parse;
|
|
2643
2723
|
Lexer.lex;
|
|
2644
2724
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2725
|
+
function getDefaultExportFromCjs(x) {
|
|
2726
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2727
|
+
}
|
|
2645
2728
|
var escapes = {
|
|
2646
2729
|
"&": "&",
|
|
2647
2730
|
"<": "<",
|
|
@@ -3031,15 +3114,8 @@ function insane(html, options, strict) {
|
|
|
3031
3114
|
}
|
|
3032
3115
|
insane.defaults = defaults$1;
|
|
3033
3116
|
var insane_1 = insane;
|
|
3034
|
-
|
|
3035
|
-
var hanabi$1 = {
|
|
3036
|
-
get exports() {
|
|
3037
|
-
return hanabiExports;
|
|
3038
|
-
},
|
|
3039
|
-
set exports(v) {
|
|
3040
|
-
hanabiExports = v;
|
|
3041
|
-
}
|
|
3042
|
-
};
|
|
3117
|
+
const insane$1 = /* @__PURE__ */ getDefaultExportFromCjs(insane_1);
|
|
3118
|
+
var hanabi$1 = { exports: {} };
|
|
3043
3119
|
(function(module, exports) {
|
|
3044
3120
|
(function(global2, factory) {
|
|
3045
3121
|
module.exports = factory();
|
|
@@ -3095,7 +3171,8 @@ var hanabi$1 = {
|
|
|
3095
3171
|
return index;
|
|
3096
3172
|
});
|
|
3097
3173
|
})(hanabi$1);
|
|
3098
|
-
|
|
3174
|
+
var hanabiExports = hanabi$1.exports;
|
|
3175
|
+
const hanabi = /* @__PURE__ */ getDefaultExportFromCjs(hanabiExports);
|
|
3099
3176
|
let instance;
|
|
3100
3177
|
function getInstance() {
|
|
3101
3178
|
return instance;
|
|
@@ -3148,7 +3225,7 @@ function marked(ctx, src) {
|
|
|
3148
3225
|
if (!markedContent) {
|
|
3149
3226
|
markedContent = src.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g, (_, code) => `<pre><code>${hanabi(code)}</code></pre>`).replace(/!\[(.*?)\]\((.*?)\)/g, (_, alt, imgSrc) => `<img src="${imgSrc}" alt="${alt}" />`).replace(/\[(.*?)\]\((.*?)\)/g, (_, text, link) => `<a href="${link}" target="_blank">${text}</a>`).replace(/\n/g, "<br>");
|
|
3150
3227
|
}
|
|
3151
|
-
let dest =
|
|
3228
|
+
let dest = insane$1(markedContent, {
|
|
3152
3229
|
allowedClasses: {},
|
|
3153
3230
|
// @refer CVE-2018-8495
|
|
3154
3231
|
// @link https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-8495
|
|
@@ -3419,7 +3496,7 @@ function t(key, args = {}) {
|
|
|
3419
3496
|
str = str.replace(/\{\s*(\w+?)\s*\}/g, (_, token) => args[token] || "");
|
|
3420
3497
|
return str;
|
|
3421
3498
|
}
|
|
3422
|
-
const version = "2.5.
|
|
3499
|
+
const version = "2.5.5";
|
|
3423
3500
|
class User {
|
|
3424
3501
|
constructor() {
|
|
3425
3502
|
__publicField(this, "ctx");
|
|
@@ -4947,8 +5024,8 @@ const defaults = {
|
|
|
4947
5024
|
countEl: "#ArtalkCount",
|
|
4948
5025
|
pvEl: "#ArtalkPV",
|
|
4949
5026
|
gravatar: {
|
|
4950
|
-
|
|
4951
|
-
|
|
5027
|
+
mirror: "https://cravatar.cn/avatar/",
|
|
5028
|
+
params: "d=mp&s=240"
|
|
4952
5029
|
},
|
|
4953
5030
|
pagination: {
|
|
4954
5031
|
pageSize: 20,
|
|
@@ -7642,10 +7719,12 @@ function Do(m) {
|
|
|
7642
7719
|
} catch (err) {
|
|
7643
7720
|
console.error(err);
|
|
7644
7721
|
m.editor.showNotify(`${m.editor.$t("commentFail")},${err.msg || String(err)}`, "e");
|
|
7722
|
+
return;
|
|
7723
|
+
} finally {
|
|
7724
|
+
m.editor.hideLoading();
|
|
7645
7725
|
}
|
|
7646
7726
|
m.editor.reset();
|
|
7647
7727
|
m.editor.ctx.trigger("editor-submitted");
|
|
7648
|
-
m.editor.hideLoading();
|
|
7649
7728
|
});
|
|
7650
7729
|
}
|
|
7651
7730
|
function getSubmitAddParams(m) {
|