@forsakringskassan/docs-generator 3.0.2 → 3.0.3
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/{create-markdown-renderer-C-rQVf_R.mjs → create-markdown-renderer-B2sP7UDF.mjs} +4 -4
- package/dist/{create-markdown-renderer-C-rQVf_R.mjs.map → create-markdown-renderer-B2sP7UDF.mjs.map} +1 -1
- package/dist/{format-code.worker-BwtL4Ldq.mjs → format-code.worker-DHkJESkS.mjs} +2 -2
- package/dist/{format-code.worker-BwtL4Ldq.mjs.map → format-code.worker-DHkJESkS.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/markdown.mjs +2 -2
- package/dist/processors/selectable-version.mjs +5 -2
- package/dist/runtime.mjs +1 -1
- package/dist/{vendor-CyiP4ufo.mjs → vendor-DLyCCfC4.mjs} +232 -127
- package/dist/{vendor-CyiP4ufo.mjs.map → vendor-DLyCCfC4.mjs.map} +1 -1
- package/dist/{worker-CpM7V-Ue.mjs → worker-CVWE4d_P.mjs} +3 -3
- package/dist/{worker-CpM7V-Ue.mjs.map → worker-CVWE4d_P.mjs.map} +1 -1
- package/package.json +1 -1
|
@@ -1723,6 +1723,15 @@ getDecoder(xmlDecodeTree);
|
|
|
1723
1723
|
function decodeHTML(str, mode = DecodingMode.Legacy) {
|
|
1724
1724
|
return htmlDecoder(str, mode);
|
|
1725
1725
|
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
|
|
1728
|
+
*
|
|
1729
|
+
* @param str The string to decode.
|
|
1730
|
+
* @returns The decoded string.
|
|
1731
|
+
*/
|
|
1732
|
+
function decodeHTMLStrict(str) {
|
|
1733
|
+
return htmlDecoder(str, DecodingMode.Strict);
|
|
1734
|
+
}
|
|
1726
1735
|
|
|
1727
1736
|
// Utilities
|
|
1728
1737
|
//
|
|
@@ -1902,6 +1911,10 @@ function isPunctChar (ch) {
|
|
|
1902
1911
|
return P$7.test(ch) || regex.test(ch)
|
|
1903
1912
|
}
|
|
1904
1913
|
|
|
1914
|
+
function isPunctCharCode (code) {
|
|
1915
|
+
return isPunctChar(fromCodePoint(code))
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1905
1918
|
// Markdown ASCII punctuation characters.
|
|
1906
1919
|
//
|
|
1907
1920
|
// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
|
|
@@ -1963,6 +1976,7 @@ function normalizeReference (str) {
|
|
|
1963
1976
|
// (remove this when node v10 is no longer supported).
|
|
1964
1977
|
//
|
|
1965
1978
|
if ('ẞ'.toLowerCase() === 'Ṿ') {
|
|
1979
|
+
/* c8 ignore next 2 */
|
|
1966
1980
|
str = str.replace(/ẞ/g, 'ß');
|
|
1967
1981
|
}
|
|
1968
1982
|
|
|
@@ -2001,6 +2015,28 @@ function normalizeReference (str) {
|
|
|
2001
2015
|
return str.toLowerCase().toUpperCase()
|
|
2002
2016
|
}
|
|
2003
2017
|
|
|
2018
|
+
function isAsciiTrimmable (c) {
|
|
2019
|
+
return c === 0x20 || c === 0x09 || c === 0x0a || c === 0x0d
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
// "Light" .trim() for blocks (headers, paragraphs), where unicode spaces
|
|
2023
|
+
// should be preserved.
|
|
2024
|
+
function asciiTrim (str) {
|
|
2025
|
+
let start = 0;
|
|
2026
|
+
for (; start < str.length; start++) {
|
|
2027
|
+
if (!isAsciiTrimmable(str.charCodeAt(start))) {
|
|
2028
|
+
break
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
let end = str.length - 1;
|
|
2032
|
+
for (; end >= start; end--) {
|
|
2033
|
+
if (!isAsciiTrimmable(str.charCodeAt(end))) {
|
|
2034
|
+
break
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
return str.slice(start, end + 1)
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2004
2040
|
// Re-export libraries commonly used in both markdown-it and its plugins,
|
|
2005
2041
|
// so plugins won't have to depend on them explicitly, which reduces their
|
|
2006
2042
|
// bundled size (e.g. a browser build).
|
|
@@ -2010,6 +2046,7 @@ const lib$3 = { mdurl, ucmicro };
|
|
|
2010
2046
|
var utils$4 = /*#__PURE__*/Object.freeze({
|
|
2011
2047
|
__proto__: null,
|
|
2012
2048
|
arrayReplaceAt: arrayReplaceAt,
|
|
2049
|
+
asciiTrim: asciiTrim,
|
|
2013
2050
|
assign: assign$1,
|
|
2014
2051
|
escapeHtml: escapeHtml,
|
|
2015
2052
|
escapeRE: escapeRE$1,
|
|
@@ -2017,6 +2054,7 @@ var utils$4 = /*#__PURE__*/Object.freeze({
|
|
|
2017
2054
|
has: has,
|
|
2018
2055
|
isMdAsciiPunct: isMdAsciiPunct,
|
|
2019
2056
|
isPunctChar: isPunctChar,
|
|
2057
|
+
isPunctCharCode: isPunctCharCode,
|
|
2020
2058
|
isSpace: isSpace,
|
|
2021
2059
|
isString: isString$2,
|
|
2022
2060
|
isValidEntityCode: isValidEntityCode,
|
|
@@ -3380,14 +3418,36 @@ const QUOTE_TEST_RE = /['"]/;
|
|
|
3380
3418
|
const QUOTE_RE = /['"]/g;
|
|
3381
3419
|
const APOSTROPHE = '\u2019'; /* ’ */
|
|
3382
3420
|
|
|
3383
|
-
function
|
|
3384
|
-
|
|
3421
|
+
function addReplacement (replacements, tokenIdx, pos, ch) {
|
|
3422
|
+
if (!replacements[tokenIdx]) {
|
|
3423
|
+
replacements[tokenIdx] = [];
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
replacements[tokenIdx].push({ pos, ch });
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
function applyReplacements (str, replacements) {
|
|
3430
|
+
let result = '';
|
|
3431
|
+
let lastPos = 0;
|
|
3432
|
+
|
|
3433
|
+
replacements.sort((a, b) => a.pos - b.pos);
|
|
3434
|
+
|
|
3435
|
+
for (let i = 0; i < replacements.length; i++) {
|
|
3436
|
+
const replacement = replacements[i];
|
|
3437
|
+
|
|
3438
|
+
result += str.slice(lastPos, replacement.pos) + replacement.ch;
|
|
3439
|
+
lastPos = replacement.pos + 1;
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
return result + str.slice(lastPos)
|
|
3385
3443
|
}
|
|
3386
3444
|
|
|
3387
3445
|
function process_inlines (tokens, state) {
|
|
3388
3446
|
let j;
|
|
3389
3447
|
|
|
3390
3448
|
const stack = [];
|
|
3449
|
+
// token index -> list of replacements in the original token content
|
|
3450
|
+
const replacements = {};
|
|
3391
3451
|
|
|
3392
3452
|
for (let i = 0; i < tokens.length; i++) {
|
|
3393
3453
|
const token = tokens[i];
|
|
@@ -3401,9 +3461,9 @@ function process_inlines (tokens, state) {
|
|
|
3401
3461
|
|
|
3402
3462
|
if (token.type !== 'text') { continue }
|
|
3403
3463
|
|
|
3404
|
-
|
|
3464
|
+
const text = token.content;
|
|
3405
3465
|
let pos = 0;
|
|
3406
|
-
|
|
3466
|
+
const max = text.length;
|
|
3407
3467
|
|
|
3408
3468
|
/* eslint no-labels:0,block-scoped-var:0 */
|
|
3409
3469
|
OUTER:
|
|
@@ -3451,8 +3511,8 @@ function process_inlines (tokens, state) {
|
|
|
3451
3511
|
}
|
|
3452
3512
|
}
|
|
3453
3513
|
|
|
3454
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
3455
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
3514
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
3515
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
3456
3516
|
|
|
3457
3517
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
3458
3518
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
@@ -3495,7 +3555,7 @@ function process_inlines (tokens, state) {
|
|
|
3495
3555
|
if (!canOpen && !canClose) {
|
|
3496
3556
|
// middle of word
|
|
3497
3557
|
if (isSingle) {
|
|
3498
|
-
|
|
3558
|
+
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
3499
3559
|
}
|
|
3500
3560
|
continue
|
|
3501
3561
|
}
|
|
@@ -3518,18 +3578,8 @@ function process_inlines (tokens, state) {
|
|
|
3518
3578
|
closeQuote = state.md.options.quotes[1];
|
|
3519
3579
|
}
|
|
3520
3580
|
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
// could mess up indices when quote length != 1
|
|
3524
|
-
token.content = replaceAt(token.content, t.index, closeQuote);
|
|
3525
|
-
tokens[item.token].content = replaceAt(
|
|
3526
|
-
tokens[item.token].content, item.pos, openQuote);
|
|
3527
|
-
|
|
3528
|
-
pos += closeQuote.length - 1;
|
|
3529
|
-
if (item.token === i) { pos += openQuote.length - 1; }
|
|
3530
|
-
|
|
3531
|
-
text = token.content;
|
|
3532
|
-
max = text.length;
|
|
3581
|
+
addReplacement(replacements, i, t.index, closeQuote);
|
|
3582
|
+
addReplacement(replacements, item.token, item.pos, openQuote);
|
|
3533
3583
|
|
|
3534
3584
|
stack.length = j;
|
|
3535
3585
|
continue OUTER
|
|
@@ -3545,10 +3595,14 @@ function process_inlines (tokens, state) {
|
|
|
3545
3595
|
level: thisLevel
|
|
3546
3596
|
});
|
|
3547
3597
|
} else if (canClose && isSingle) {
|
|
3548
|
-
|
|
3598
|
+
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
3549
3599
|
}
|
|
3550
3600
|
}
|
|
3551
3601
|
}
|
|
3602
|
+
|
|
3603
|
+
Object.keys(replacements).forEach(function (tokenIdx) {
|
|
3604
|
+
tokens[tokenIdx].content = applyReplacements(tokens[tokenIdx].content, replacements[tokenIdx]);
|
|
3605
|
+
});
|
|
3552
3606
|
}
|
|
3553
3607
|
|
|
3554
3608
|
function smartquotes (state) {
|
|
@@ -5152,11 +5206,22 @@ function html_block (state, startLine, endLine, silent) {
|
|
|
5152
5206
|
|
|
5153
5207
|
let nextLine = startLine + 1;
|
|
5154
5208
|
|
|
5209
|
+
// Block types 6 and 7 (the only ones whose end condition is a blank line)
|
|
5210
|
+
// have `/^$/` as their closing regexp. For all other types (1-5, e.g.
|
|
5211
|
+
// `<!--` comments), a blank line is regular content and must not terminate
|
|
5212
|
+
// the block - it ends only when its closing sequence is found.
|
|
5213
|
+
const endsOnBlankLine = HTML_SEQUENCES[i][1].test('');
|
|
5214
|
+
|
|
5155
5215
|
// If we are here - we detected HTML block.
|
|
5156
5216
|
// Let's roll down till block end.
|
|
5157
5217
|
if (!HTML_SEQUENCES[i][1].test(lineText)) {
|
|
5158
5218
|
for (; nextLine < endLine; nextLine++) {
|
|
5159
|
-
if (state.sCount[nextLine] < state.blkIndent) {
|
|
5219
|
+
if (state.sCount[nextLine] < state.blkIndent) {
|
|
5220
|
+
// An outdented blank line shouldn't end a block that doesn't end on a
|
|
5221
|
+
// blank line (e.g. a `<!--` comment inside a list item). Such blocks
|
|
5222
|
+
// must continue until their closing sequence regardless of indent.
|
|
5223
|
+
if (endsOnBlankLine || !state.isEmpty(nextLine)) { break }
|
|
5224
|
+
}
|
|
5160
5225
|
|
|
5161
5226
|
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
5162
5227
|
max = state.eMarks[nextLine];
|
|
@@ -5219,7 +5284,7 @@ function heading (state, startLine, endLine, silent) {
|
|
|
5219
5284
|
token_o.map = [startLine, state.line];
|
|
5220
5285
|
|
|
5221
5286
|
const token_i = state.push('inline', '', 0);
|
|
5222
|
-
token_i.content = state.src.slice(pos, max)
|
|
5287
|
+
token_i.content = asciiTrim(state.src.slice(pos, max));
|
|
5223
5288
|
token_i.map = [startLine, state.line];
|
|
5224
5289
|
token_i.children = [];
|
|
5225
5290
|
|
|
@@ -5231,6 +5296,7 @@ function heading (state, startLine, endLine, silent) {
|
|
|
5231
5296
|
|
|
5232
5297
|
// lheading (---, ===)
|
|
5233
5298
|
|
|
5299
|
+
|
|
5234
5300
|
function lheading (state, startLine, endLine/*, silent */) {
|
|
5235
5301
|
const terminatorRules = state.md.block.ruler.getRules('paragraph');
|
|
5236
5302
|
|
|
@@ -5288,10 +5354,11 @@ function lheading (state, startLine, endLine/*, silent */) {
|
|
|
5288
5354
|
|
|
5289
5355
|
if (!level) {
|
|
5290
5356
|
// Didn't find valid underline
|
|
5357
|
+
state.parentType = oldParentType;
|
|
5291
5358
|
return false
|
|
5292
5359
|
}
|
|
5293
5360
|
|
|
5294
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
5361
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
5295
5362
|
|
|
5296
5363
|
state.line = nextLine + 1;
|
|
5297
5364
|
|
|
@@ -5314,6 +5381,7 @@ function lheading (state, startLine, endLine/*, silent */) {
|
|
|
5314
5381
|
|
|
5315
5382
|
// Paragraph
|
|
5316
5383
|
|
|
5384
|
+
|
|
5317
5385
|
function paragraph (state, startLine, endLine) {
|
|
5318
5386
|
const terminatorRules = state.md.block.ruler.getRules('paragraph');
|
|
5319
5387
|
const oldParentType = state.parentType;
|
|
@@ -5340,7 +5408,7 @@ function paragraph (state, startLine, endLine) {
|
|
|
5340
5408
|
if (terminate) { break }
|
|
5341
5409
|
}
|
|
5342
5410
|
|
|
5343
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
5411
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
5344
5412
|
|
|
5345
5413
|
state.line = nextLine;
|
|
5346
5414
|
|
|
@@ -5567,8 +5635,30 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
|
|
|
5567
5635
|
const max = this.posMax;
|
|
5568
5636
|
const marker = this.src.charCodeAt(start);
|
|
5569
5637
|
|
|
5570
|
-
//
|
|
5571
|
-
|
|
5638
|
+
// Astral characters below are combined manually, because .codePointAt()
|
|
5639
|
+
// does not guarantee numeric type output. And we don't wish JIT cache issues.
|
|
5640
|
+
// The broken surrogate pairs are evaluated as U+FFFD to prevent possible
|
|
5641
|
+
// crashes.
|
|
5642
|
+
|
|
5643
|
+
let lastChar;
|
|
5644
|
+
if (start === 0) {
|
|
5645
|
+
// treat beginning of the line as a whitespace
|
|
5646
|
+
lastChar = 0x20;
|
|
5647
|
+
} else if (start === 1) {
|
|
5648
|
+
lastChar = this.src.charCodeAt(0);
|
|
5649
|
+
if ((lastChar & 0xF800) === 0xD800) { lastChar = 0xFFFD; }
|
|
5650
|
+
} else {
|
|
5651
|
+
lastChar = this.src.charCodeAt(start - 1);
|
|
5652
|
+
if ((lastChar & 0xFC00) === 0xDC00) {
|
|
5653
|
+
// low surrogate => add high one, replace broken pair with U+FFFD
|
|
5654
|
+
const highSurr = this.src.charCodeAt(start - 2);
|
|
5655
|
+
lastChar = (highSurr & 0xFC00) === 0xD800
|
|
5656
|
+
? 0x10000 + ((highSurr - 0xD800) << 10) + (lastChar - 0xDC00)
|
|
5657
|
+
: 0xFFFD;
|
|
5658
|
+
} else if ((lastChar & 0xFC00) === 0xD800) {
|
|
5659
|
+
lastChar = 0xFFFD;
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5572
5662
|
|
|
5573
5663
|
let pos = start;
|
|
5574
5664
|
while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
|
|
@@ -5576,10 +5666,19 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
|
|
|
5576
5666
|
const count = pos - start;
|
|
5577
5667
|
|
|
5578
5668
|
// treat end of the line as a whitespace
|
|
5579
|
-
|
|
5669
|
+
let nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
|
|
5670
|
+
if ((nextChar & 0xFC00) === 0xD800) {
|
|
5671
|
+
// high surrogate => add low one, replace broken pair with U+FFFD
|
|
5672
|
+
const lowSurr = this.src.charCodeAt(pos + 1);
|
|
5673
|
+
nextChar = (lowSurr & 0xFC00) === 0xDC00
|
|
5674
|
+
? 0x10000 + ((nextChar - 0xD800) << 10) + (lowSurr - 0xDC00)
|
|
5675
|
+
: 0xFFFD;
|
|
5676
|
+
} else if ((nextChar & 0xFC00) === 0xDC00) {
|
|
5677
|
+
nextChar = 0xFFFD;
|
|
5678
|
+
}
|
|
5580
5679
|
|
|
5581
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
5582
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
5680
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
5681
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
5583
5682
|
|
|
5584
5683
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
5585
5684
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
@@ -6606,7 +6705,7 @@ function entity (state, silent) {
|
|
|
6606
6705
|
} else {
|
|
6607
6706
|
const match = state.src.slice(pos).match(NAMED_RE);
|
|
6608
6707
|
if (match) {
|
|
6609
|
-
const decoded =
|
|
6708
|
+
const decoded = decodeHTMLStrict(match[0]);
|
|
6610
6709
|
if (decoded !== match[0]) {
|
|
6611
6710
|
if (!silent) {
|
|
6612
6711
|
const token = state.push('text_special', '', 0);
|
|
@@ -7268,11 +7367,6 @@ const tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghik
|
|
|
7268
7367
|
// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
|
|
7269
7368
|
const tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
|
|
7270
7369
|
|
|
7271
|
-
function resetScanCache (self) {
|
|
7272
|
-
self.__index__ = -1;
|
|
7273
|
-
self.__text_cache__ = '';
|
|
7274
|
-
}
|
|
7275
|
-
|
|
7276
7370
|
function createValidator (re) {
|
|
7277
7371
|
return function (text, pos) {
|
|
7278
7372
|
const tail = text.slice(pos);
|
|
@@ -7311,8 +7405,11 @@ function compile (self) {
|
|
|
7311
7405
|
function untpl (tpl) { return tpl.replace('%TLDS%', re.src_tlds) }
|
|
7312
7406
|
|
|
7313
7407
|
re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');
|
|
7408
|
+
re.email_fuzzy_global = RegExp(untpl(re.tpl_email_fuzzy), 'ig');
|
|
7314
7409
|
re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');
|
|
7410
|
+
re.link_fuzzy_global = RegExp(untpl(re.tpl_link_fuzzy), 'ig');
|
|
7315
7411
|
re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
|
|
7412
|
+
re.link_no_ip_fuzzy_global = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'ig');
|
|
7316
7413
|
re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
|
|
7317
7414
|
|
|
7318
7415
|
//
|
|
@@ -7406,12 +7503,6 @@ function compile (self) {
|
|
|
7406
7503
|
'(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',
|
|
7407
7504
|
'i'
|
|
7408
7505
|
);
|
|
7409
|
-
|
|
7410
|
-
//
|
|
7411
|
-
// Cleanup
|
|
7412
|
-
//
|
|
7413
|
-
|
|
7414
|
-
resetScanCache(self);
|
|
7415
7506
|
}
|
|
7416
7507
|
|
|
7417
7508
|
/**
|
|
@@ -7419,55 +7510,45 @@ function compile (self) {
|
|
|
7419
7510
|
*
|
|
7420
7511
|
* Match result. Single element of array, returned by [[LinkifyIt#match]]
|
|
7421
7512
|
**/
|
|
7422
|
-
function Match (
|
|
7423
|
-
const
|
|
7424
|
-
const end = self.__last_index__;
|
|
7425
|
-
const text = self.__text_cache__.slice(start, end);
|
|
7513
|
+
function Match (text, schema, index, lastIndex) {
|
|
7514
|
+
const raw = text.slice(index, lastIndex);
|
|
7426
7515
|
|
|
7427
7516
|
/**
|
|
7428
7517
|
* Match#schema -> String
|
|
7429
7518
|
*
|
|
7430
7519
|
* Prefix (protocol) for matched string.
|
|
7431
7520
|
**/
|
|
7432
|
-
this.schema =
|
|
7521
|
+
this.schema = schema.toLowerCase();
|
|
7433
7522
|
/**
|
|
7434
7523
|
* Match#index -> Number
|
|
7435
7524
|
*
|
|
7436
7525
|
* First position of matched string.
|
|
7437
7526
|
**/
|
|
7438
|
-
this.index =
|
|
7527
|
+
this.index = index;
|
|
7439
7528
|
/**
|
|
7440
7529
|
* Match#lastIndex -> Number
|
|
7441
7530
|
*
|
|
7442
7531
|
* Next position after matched string.
|
|
7443
7532
|
**/
|
|
7444
|
-
this.lastIndex =
|
|
7533
|
+
this.lastIndex = lastIndex;
|
|
7445
7534
|
/**
|
|
7446
7535
|
* Match#raw -> String
|
|
7447
7536
|
*
|
|
7448
7537
|
* Matched string.
|
|
7449
7538
|
**/
|
|
7450
|
-
this.raw =
|
|
7539
|
+
this.raw = raw;
|
|
7451
7540
|
/**
|
|
7452
7541
|
* Match#text -> String
|
|
7453
7542
|
*
|
|
7454
7543
|
* Notmalized text of matched string.
|
|
7455
7544
|
**/
|
|
7456
|
-
this.text =
|
|
7545
|
+
this.text = raw;
|
|
7457
7546
|
/**
|
|
7458
7547
|
* Match#url -> String
|
|
7459
7548
|
*
|
|
7460
7549
|
* Normalized url of matched string.
|
|
7461
7550
|
**/
|
|
7462
|
-
this.url =
|
|
7463
|
-
}
|
|
7464
|
-
|
|
7465
|
-
function createMatch (self, shift) {
|
|
7466
|
-
const match = new Match(self, shift);
|
|
7467
|
-
|
|
7468
|
-
self.__compiled__[match.schema].normalize(match, self);
|
|
7469
|
-
|
|
7470
|
-
return match
|
|
7551
|
+
this.url = raw;
|
|
7471
7552
|
}
|
|
7472
7553
|
|
|
7473
7554
|
/**
|
|
@@ -7522,12 +7603,6 @@ function LinkifyIt (schemas, options) {
|
|
|
7522
7603
|
|
|
7523
7604
|
this.__opts__ = assign({}, defaultOptions$1, options);
|
|
7524
7605
|
|
|
7525
|
-
// Cache last tested result. Used to skip repeating steps on next `match` call.
|
|
7526
|
-
this.__index__ = -1;
|
|
7527
|
-
this.__last_index__ = -1; // Next scan position
|
|
7528
|
-
this.__schema__ = '';
|
|
7529
|
-
this.__text_cache__ = '';
|
|
7530
|
-
|
|
7531
7606
|
this.__schemas__ = assign({}, defaultSchemas, schemas);
|
|
7532
7607
|
this.__compiled__ = {};
|
|
7533
7608
|
|
|
@@ -7569,69 +7644,38 @@ LinkifyIt.prototype.set = function set (options) {
|
|
|
7569
7644
|
* Searches linkifiable pattern and returns `true` on success or `false` on fail.
|
|
7570
7645
|
**/
|
|
7571
7646
|
LinkifyIt.prototype.test = function test (text) {
|
|
7572
|
-
// Reset scan cache
|
|
7573
|
-
this.__text_cache__ = text;
|
|
7574
|
-
this.__index__ = -1;
|
|
7575
|
-
|
|
7576
7647
|
if (!text.length) { return false }
|
|
7577
7648
|
|
|
7578
|
-
let m,
|
|
7649
|
+
let m, re;
|
|
7579
7650
|
|
|
7580
7651
|
// try to scan for link with schema - that's the most simple rule
|
|
7581
7652
|
if (this.re.schema_test.test(text)) {
|
|
7582
7653
|
re = this.re.schema_search;
|
|
7583
7654
|
re.lastIndex = 0;
|
|
7584
7655
|
while ((m = re.exec(text)) !== null) {
|
|
7585
|
-
|
|
7586
|
-
if (len) {
|
|
7587
|
-
this.__schema__ = m[2];
|
|
7588
|
-
this.__index__ = m.index + m[1].length;
|
|
7589
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
7590
|
-
break
|
|
7591
|
-
}
|
|
7656
|
+
if (this.testSchemaAt(text, m[2], re.lastIndex)) { return true }
|
|
7592
7657
|
}
|
|
7593
7658
|
}
|
|
7594
7659
|
|
|
7595
7660
|
if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
|
|
7596
7661
|
// guess schemaless links
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
if (this.__index__ < 0 || tld_pos < this.__index__) {
|
|
7601
|
-
if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
|
|
7602
|
-
shift = ml.index + ml[1].length;
|
|
7603
|
-
|
|
7604
|
-
if (this.__index__ < 0 || shift < this.__index__) {
|
|
7605
|
-
this.__schema__ = '';
|
|
7606
|
-
this.__index__ = shift;
|
|
7607
|
-
this.__last_index__ = ml.index + ml[0].length;
|
|
7608
|
-
}
|
|
7609
|
-
}
|
|
7662
|
+
if (text.search(this.re.host_fuzzy_test) >= 0) {
|
|
7663
|
+
if (text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy) !== null) {
|
|
7664
|
+
return true
|
|
7610
7665
|
}
|
|
7611
7666
|
}
|
|
7612
7667
|
}
|
|
7613
7668
|
|
|
7614
7669
|
if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
|
|
7615
7670
|
// guess schemaless emails
|
|
7616
|
-
|
|
7617
|
-
if (at_pos >= 0) {
|
|
7671
|
+
if (text.indexOf('@') >= 0) {
|
|
7618
7672
|
// We can't skip this check, because this cases are possible:
|
|
7619
7673
|
// 192.168.1.1@gmail.com, my.in@example.com
|
|
7620
|
-
if (
|
|
7621
|
-
shift = me.index + me[1].length;
|
|
7622
|
-
next = me.index + me[0].length;
|
|
7623
|
-
|
|
7624
|
-
if (this.__index__ < 0 || shift < this.__index__ ||
|
|
7625
|
-
(shift === this.__index__ && next > this.__last_index__)) {
|
|
7626
|
-
this.__schema__ = 'mailto:';
|
|
7627
|
-
this.__index__ = shift;
|
|
7628
|
-
this.__last_index__ = next;
|
|
7629
|
-
}
|
|
7630
|
-
}
|
|
7674
|
+
if (text.match(this.re.email_fuzzy) !== null) { return true }
|
|
7631
7675
|
}
|
|
7632
7676
|
}
|
|
7633
7677
|
|
|
7634
|
-
return
|
|
7678
|
+
return false
|
|
7635
7679
|
};
|
|
7636
7680
|
|
|
7637
7681
|
/**
|
|
@@ -7680,23 +7724,88 @@ LinkifyIt.prototype.testSchemaAt = function testSchemaAt (text, schema, pos) {
|
|
|
7680
7724
|
**/
|
|
7681
7725
|
LinkifyIt.prototype.match = function match (text) {
|
|
7682
7726
|
const result = [];
|
|
7683
|
-
|
|
7727
|
+
const type_schemed = [];
|
|
7728
|
+
const type_fuzzy_link = [];
|
|
7729
|
+
const type_fuzzy_email = [];
|
|
7730
|
+
let m, len, re;
|
|
7684
7731
|
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7732
|
+
function choose (a, b) {
|
|
7733
|
+
if (!a) { return b }
|
|
7734
|
+
if (!b) { return a }
|
|
7735
|
+
if (a.index !== b.index) { return a.index < b.index ? a : b }
|
|
7736
|
+
return a.lastIndex >= b.lastIndex ? a : b
|
|
7689
7737
|
}
|
|
7690
7738
|
|
|
7691
|
-
|
|
7692
|
-
let tail = shift ? text.slice(shift) : text;
|
|
7739
|
+
if (!text.length) { return null }
|
|
7693
7740
|
|
|
7694
|
-
//
|
|
7695
|
-
|
|
7696
|
-
|
|
7741
|
+
// scan for links with schema
|
|
7742
|
+
if (this.re.schema_test.test(text)) {
|
|
7743
|
+
re = this.re.schema_search;
|
|
7744
|
+
re.lastIndex = 0;
|
|
7745
|
+
while ((m = re.exec(text)) !== null) {
|
|
7746
|
+
len = this.testSchemaAt(text, m[2], re.lastIndex);
|
|
7747
|
+
if (len) {
|
|
7748
|
+
type_schemed.push({
|
|
7749
|
+
schema: m[2],
|
|
7750
|
+
index: m.index + m[1].length,
|
|
7751
|
+
lastIndex: m.index + m[0].length + len
|
|
7752
|
+
});
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7697
7756
|
|
|
7698
|
-
|
|
7699
|
-
|
|
7757
|
+
if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
|
|
7758
|
+
re = this.__opts__.fuzzyIP ? this.re.link_fuzzy_global : this.re.link_no_ip_fuzzy_global;
|
|
7759
|
+
re.lastIndex = 0;
|
|
7760
|
+
while ((m = re.exec(text)) !== null) {
|
|
7761
|
+
type_fuzzy_link.push({
|
|
7762
|
+
schema: '',
|
|
7763
|
+
index: m.index + m[1].length,
|
|
7764
|
+
lastIndex: m.index + m[0].length
|
|
7765
|
+
});
|
|
7766
|
+
}
|
|
7767
|
+
}
|
|
7768
|
+
|
|
7769
|
+
if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
|
|
7770
|
+
re = this.re.email_fuzzy_global;
|
|
7771
|
+
re.lastIndex = 0;
|
|
7772
|
+
while ((m = re.exec(text)) !== null) {
|
|
7773
|
+
type_fuzzy_email.push({
|
|
7774
|
+
schema: 'mailto:',
|
|
7775
|
+
index: m.index + m[1].length,
|
|
7776
|
+
lastIndex: m.index + m[0].length
|
|
7777
|
+
});
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
7780
|
+
|
|
7781
|
+
const indexes = [0, 0, 0];
|
|
7782
|
+
let lastIndex = 0;
|
|
7783
|
+
|
|
7784
|
+
for (;;) {
|
|
7785
|
+
const candidates = [
|
|
7786
|
+
type_schemed[indexes[0]],
|
|
7787
|
+
type_fuzzy_email[indexes[1]],
|
|
7788
|
+
type_fuzzy_link[indexes[2]]
|
|
7789
|
+
];
|
|
7790
|
+
|
|
7791
|
+
const candidate = choose(choose(candidates[0], candidates[1]), candidates[2]);
|
|
7792
|
+
|
|
7793
|
+
if (!candidate) { break }
|
|
7794
|
+
|
|
7795
|
+
if (candidate === candidates[0]) {
|
|
7796
|
+
indexes[0]++;
|
|
7797
|
+
} else if (candidate === candidates[1]) {
|
|
7798
|
+
indexes[1]++;
|
|
7799
|
+
} else {
|
|
7800
|
+
indexes[2]++;
|
|
7801
|
+
}
|
|
7802
|
+
|
|
7803
|
+
if (candidate.index < lastIndex) { continue }
|
|
7804
|
+
|
|
7805
|
+
const match = new Match(text, candidate.schema, candidate.index, candidate.lastIndex);
|
|
7806
|
+
this.__compiled__[match.schema].normalize(match, this);
|
|
7807
|
+
result.push(match);
|
|
7808
|
+
lastIndex = candidate.lastIndex;
|
|
7700
7809
|
}
|
|
7701
7810
|
|
|
7702
7811
|
if (result.length) {
|
|
@@ -7713,10 +7822,6 @@ LinkifyIt.prototype.match = function match (text) {
|
|
|
7713
7822
|
* of the string, and null otherwise.
|
|
7714
7823
|
**/
|
|
7715
7824
|
LinkifyIt.prototype.matchAtStart = function matchAtStart (text) {
|
|
7716
|
-
// Reset scan cache
|
|
7717
|
-
this.__text_cache__ = text;
|
|
7718
|
-
this.__index__ = -1;
|
|
7719
|
-
|
|
7720
7825
|
if (!text.length) return null
|
|
7721
7826
|
|
|
7722
7827
|
const m = this.re.schema_at_start.exec(text);
|
|
@@ -7725,11 +7830,10 @@ LinkifyIt.prototype.matchAtStart = function matchAtStart (text) {
|
|
|
7725
7830
|
const len = this.testSchemaAt(text, m[2], m[0].length);
|
|
7726
7831
|
if (!len) return null
|
|
7727
7832
|
|
|
7728
|
-
|
|
7729
|
-
this.__index__ = m.index + m[1].length;
|
|
7730
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
7833
|
+
const match = new Match(text, m[2], m.index + m[1].length, m.index + m[0].length + len);
|
|
7731
7834
|
|
|
7732
|
-
|
|
7835
|
+
this.__compiled__[match.schema].normalize(match, this);
|
|
7836
|
+
return match
|
|
7733
7837
|
};
|
|
7734
7838
|
|
|
7735
7839
|
/** chainable
|
|
@@ -8781,7 +8885,7 @@ function MarkdownIt (presetName, options) {
|
|
|
8781
8885
|
* ```javascript
|
|
8782
8886
|
* var md = require('markdown-it')()
|
|
8783
8887
|
* .set({ html: true, breaks: true })
|
|
8784
|
-
* .set({ typographer
|
|
8888
|
+
* .set({ typographer: true });
|
|
8785
8889
|
* ```
|
|
8786
8890
|
*
|
|
8787
8891
|
* __Note:__ To achieve the best possible performance, don't modify a
|
|
@@ -21324,7 +21428,8 @@ function deflist_plugin (md) {
|
|
|
21324
21428
|
if (silent) {
|
|
21325
21429
|
// quirk: validation mode validates a dd block only, not a whole deflist
|
|
21326
21430
|
if (state.ddIndent < 0) { return false }
|
|
21327
|
-
|
|
21431
|
+
const markerPos = skipMarker(state, startLine);
|
|
21432
|
+
return markerPos >= 0 && state.sCount[startLine] < state.blkIndent
|
|
21328
21433
|
}
|
|
21329
21434
|
|
|
21330
21435
|
let nextLine = startLine + 1;
|
|
@@ -69928,4 +70033,4 @@ var typescript = /*#__PURE__*/Object.freeze({
|
|
|
69928
70033
|
});
|
|
69929
70034
|
|
|
69930
70035
|
export { HighlightJS as H, MarkdownIt as M, Ze$a as Z, closest as a, createInstance as b, cliProgress as c, createSyncFn as d, createTwoFilesPatch$1 as e, dedent$1 as f, deflist_plugin as g, distance as h, fm$2 as i, format2 as j, fse as k, inter as l, isCI as m, moduleImporter as n, runAsWorker as o, ts$6 as p, resolveConfig as r, tinylr as t, watch$1 as w };
|
|
69931
|
-
//# sourceMappingURL=vendor-
|
|
70036
|
+
//# sourceMappingURL=vendor-DLyCCfC4.mjs.map
|