artalk 2.9.0 → 2.9.1
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.cjs +1 -1
- package/dist/Artalk.cjs.map +1 -1
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.iife.js.map +1 -1
- package/dist/Artalk.js +1 -1
- package/dist/Artalk.js.map +1 -1
- package/dist/Artalk.mjs +28 -21
- package/dist/Artalk.mjs.map +1 -1
- package/dist/ArtalkLite.cjs +1 -1
- package/dist/ArtalkLite.cjs.map +1 -1
- package/dist/ArtalkLite.iife.js +1 -1
- package/dist/ArtalkLite.iife.js.map +1 -1
- package/dist/ArtalkLite.js +1 -1
- package/dist/ArtalkLite.js.map +1 -1
- package/dist/ArtalkLite.mjs +6 -3
- package/dist/ArtalkLite.mjs.map +1 -1
- package/package.json +2 -2
package/dist/Artalk.mjs
CHANGED
|
@@ -1749,7 +1749,7 @@ class _Tokenizer {
|
|
|
1749
1749
|
code(src) {
|
|
1750
1750
|
const cap = this.rules.block.code.exec(src);
|
|
1751
1751
|
if (cap) {
|
|
1752
|
-
const text = cap[0].replace(/^ {1,4}/gm, "");
|
|
1752
|
+
const text = cap[0].replace(/^(?: {1,4}| {0,3}\t)/gm, "");
|
|
1753
1753
|
return {
|
|
1754
1754
|
type: "code",
|
|
1755
1755
|
raw: cap[0],
|
|
@@ -1912,7 +1912,7 @@ ${currentText}` : currentText;
|
|
|
1912
1912
|
itemContents = line.slice(indent);
|
|
1913
1913
|
indent += cap[1].length;
|
|
1914
1914
|
}
|
|
1915
|
-
if (blankLine && /^ *$/.test(nextLine)) {
|
|
1915
|
+
if (blankLine && /^[ \t]*$/.test(nextLine)) {
|
|
1916
1916
|
raw += nextLine + "\n";
|
|
1917
1917
|
src = src.substring(nextLine.length + 1);
|
|
1918
1918
|
endEarly = true;
|
|
@@ -1922,11 +1922,16 @@ ${currentText}` : currentText;
|
|
|
1922
1922
|
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
|
1923
1923
|
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
|
1924
1924
|
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
|
1925
|
+
const htmlBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}<[a-z].*>`, "i");
|
|
1925
1926
|
while (src) {
|
|
1926
1927
|
const rawLine = src.split("\n", 1)[0];
|
|
1928
|
+
let nextLineWithoutTabs;
|
|
1927
1929
|
nextLine = rawLine;
|
|
1928
1930
|
if (this.options.pedantic) {
|
|
1929
1931
|
nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
|
|
1932
|
+
nextLineWithoutTabs = nextLine;
|
|
1933
|
+
} else {
|
|
1934
|
+
nextLineWithoutTabs = nextLine.replace(/\t/g, " ");
|
|
1930
1935
|
}
|
|
1931
1936
|
if (fencesBeginRegex.test(nextLine)) {
|
|
1932
1937
|
break;
|
|
@@ -1934,19 +1939,22 @@ ${currentText}` : currentText;
|
|
|
1934
1939
|
if (headingBeginRegex.test(nextLine)) {
|
|
1935
1940
|
break;
|
|
1936
1941
|
}
|
|
1942
|
+
if (htmlBeginRegex.test(nextLine)) {
|
|
1943
|
+
break;
|
|
1944
|
+
}
|
|
1937
1945
|
if (nextBulletRegex.test(nextLine)) {
|
|
1938
1946
|
break;
|
|
1939
1947
|
}
|
|
1940
|
-
if (hrRegex.test(
|
|
1948
|
+
if (hrRegex.test(nextLine)) {
|
|
1941
1949
|
break;
|
|
1942
1950
|
}
|
|
1943
|
-
if (
|
|
1944
|
-
itemContents += "\n" +
|
|
1951
|
+
if (nextLineWithoutTabs.search(/[^ ]/) >= indent || !nextLine.trim()) {
|
|
1952
|
+
itemContents += "\n" + nextLineWithoutTabs.slice(indent);
|
|
1945
1953
|
} else {
|
|
1946
1954
|
if (blankLine) {
|
|
1947
1955
|
break;
|
|
1948
1956
|
}
|
|
1949
|
-
if (line.search(/[^ ]/) >= 4) {
|
|
1957
|
+
if (line.replace(/\t/g, " ").search(/[^ ]/) >= 4) {
|
|
1950
1958
|
break;
|
|
1951
1959
|
}
|
|
1952
1960
|
if (fencesBeginRegex.test(line)) {
|
|
@@ -1965,13 +1973,13 @@ ${currentText}` : currentText;
|
|
|
1965
1973
|
}
|
|
1966
1974
|
raw += rawLine + "\n";
|
|
1967
1975
|
src = src.substring(rawLine.length + 1);
|
|
1968
|
-
line =
|
|
1976
|
+
line = nextLineWithoutTabs.slice(indent);
|
|
1969
1977
|
}
|
|
1970
1978
|
}
|
|
1971
1979
|
if (!list2.loose) {
|
|
1972
1980
|
if (endsWithBlankLine) {
|
|
1973
1981
|
list2.loose = true;
|
|
1974
|
-
} else if (/\n *\n *$/.test(raw)) {
|
|
1982
|
+
} else if (/\n[ \t]*\n[ \t]*$/.test(raw)) {
|
|
1975
1983
|
endsWithBlankLine = true;
|
|
1976
1984
|
}
|
|
1977
1985
|
}
|
|
@@ -2394,21 +2402,21 @@ ${currentText}` : currentText;
|
|
|
2394
2402
|
}
|
|
2395
2403
|
}
|
|
2396
2404
|
}
|
|
2397
|
-
const newline = /^(?: *(?:\n|$))+/;
|
|
2398
|
-
const blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
|
|
2405
|
+
const newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
2406
|
+
const blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
2399
2407
|
const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
2400
2408
|
const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
2401
2409
|
const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
2402
2410
|
const bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
2403
|
-
const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex();
|
|
2411
|
+
const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex();
|
|
2404
2412
|
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
2405
2413
|
const blockText = /^[^\n]+/;
|
|
2406
2414
|
const _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
2407
|
-
const def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
2415
|
+
const def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
2408
2416
|
const list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
2409
2417
|
const _tag = "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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
2410
2418
|
const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
2411
|
-
const html = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n
|
|
2419
|
+
const html = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
2412
2420
|
const paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").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", _tag).getRegex();
|
|
2413
2421
|
const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
|
2414
2422
|
const blockNormal = {
|
|
@@ -2426,7 +2434,7 @@ const blockNormal = {
|
|
|
2426
2434
|
table: noopTest,
|
|
2427
2435
|
text: blockText
|
|
2428
2436
|
};
|
|
2429
|
-
const gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").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", _tag).getRegex();
|
|
2437
|
+
const gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\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", _tag).getRegex();
|
|
2430
2438
|
const blockGfm = __spreadProps(__spreadValues({}, blockNormal), {
|
|
2431
2439
|
table: gfmTable,
|
|
2432
2440
|
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).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", _tag).getRegex()
|
|
@@ -2583,10 +2591,6 @@ class _Lexer {
|
|
|
2583
2591
|
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
2584
2592
|
if (this.options.pedantic) {
|
|
2585
2593
|
src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
|
|
2586
|
-
} else {
|
|
2587
|
-
src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
|
|
2588
|
-
return leading + " ".repeat(tabs.length);
|
|
2589
|
-
});
|
|
2590
2594
|
}
|
|
2591
2595
|
let token;
|
|
2592
2596
|
let lastToken;
|
|
@@ -8808,7 +8812,7 @@ const GotoFocus = (ctx) => {
|
|
|
8808
8812
|
comment.focus();
|
|
8809
8813
|
}));
|
|
8810
8814
|
};
|
|
8811
|
-
const version = "2.9.
|
|
8815
|
+
const version = "2.9.1";
|
|
8812
8816
|
const Copyright = (ctx) => {
|
|
8813
8817
|
ctx.on("mounted", () => {
|
|
8814
8818
|
const list2 = ctx.get("list");
|
|
@@ -9270,7 +9274,7 @@ function loadNetworkPlugins(scripts, apiBase) {
|
|
|
9270
9274
|
if (!/^(http|https):\/\//.test(url))
|
|
9271
9275
|
url = `${apiBase.replace(/\/$/, "")}/${url.replace(/^\//, "")}`;
|
|
9272
9276
|
tasks.push(
|
|
9273
|
-
new Promise((resolve
|
|
9277
|
+
new Promise((resolve) => {
|
|
9274
9278
|
if (document.querySelector(`script[src="${url}"]`)) {
|
|
9275
9279
|
resolve();
|
|
9276
9280
|
return;
|
|
@@ -9279,7 +9283,10 @@ function loadNetworkPlugins(scripts, apiBase) {
|
|
|
9279
9283
|
script.src = url;
|
|
9280
9284
|
document.head.appendChild(script);
|
|
9281
9285
|
script.onload = () => resolve();
|
|
9282
|
-
script.onerror = (err) =>
|
|
9286
|
+
script.onerror = (err) => {
|
|
9287
|
+
console.error("[artalk] Failed to load plugin", err);
|
|
9288
|
+
resolve();
|
|
9289
|
+
};
|
|
9283
9290
|
})
|
|
9284
9291
|
);
|
|
9285
9292
|
});
|