@forsakringskassan/docs-generator 3.3.1 → 3.3.2
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-39oFx5NW.mjs → create-markdown-renderer-AbpNHoqd.mjs} +3 -3
- package/dist/{create-markdown-renderer-39oFx5NW.mjs.map → create-markdown-renderer-AbpNHoqd.mjs.map} +1 -1
- package/dist/{format-code.worker-CmGmTvy2.mjs → format-code.worker-C__DrPyb.mjs} +2 -2
- package/dist/{format-code.worker-CmGmTvy2.mjs.map → format-code.worker-C__DrPyb.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/markdown.mjs +2 -2
- package/dist/{vendor-DjC7coI1.mjs → vendor-B2TWdfAe.mjs} +250 -236
- package/dist/{vendor-DjC7coI1.mjs.map → vendor-B2TWdfAe.mjs.map} +1 -1
- package/package.json +1 -1
|
@@ -1799,7 +1799,6 @@ function arrayReplaceAt (src, pos, newElements) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
|
|
1801
1801
|
function isValidEntityCode (c) {
|
|
1802
|
-
/* eslint no-bitwise:0 */
|
|
1803
1802
|
// broken sequence
|
|
1804
1803
|
if (c >= 0xD800 && c <= 0xDFFF) { return false }
|
|
1805
1804
|
// never used
|
|
@@ -1827,8 +1826,8 @@ function fromCodePoint (c) {
|
|
|
1827
1826
|
return String.fromCharCode(c)
|
|
1828
1827
|
}
|
|
1829
1828
|
|
|
1830
|
-
const UNESCAPE_MD_RE
|
|
1831
|
-
const ENTITY_RE
|
|
1829
|
+
const UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g;
|
|
1830
|
+
const ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
|
|
1832
1831
|
const UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');
|
|
1833
1832
|
|
|
1834
1833
|
const DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
|
|
@@ -1854,12 +1853,6 @@ function replaceEntityPattern (match, name) {
|
|
|
1854
1853
|
return match
|
|
1855
1854
|
}
|
|
1856
1855
|
|
|
1857
|
-
/* function replaceEntities(str) {
|
|
1858
|
-
if (str.indexOf('&') < 0) { return str; }
|
|
1859
|
-
|
|
1860
|
-
return str.replace(ENTITY_RE, replaceEntityPattern);
|
|
1861
|
-
} */
|
|
1862
|
-
|
|
1863
1856
|
function unescapeMd (str) {
|
|
1864
1857
|
if (str.indexOf('\\') < 0) { return str }
|
|
1865
1858
|
return str.replace(UNESCAPE_MD_RE, '$1')
|
|
@@ -1929,8 +1922,6 @@ function isWhiteSpace (code) {
|
|
|
1929
1922
|
return false
|
|
1930
1923
|
}
|
|
1931
1924
|
|
|
1932
|
-
/* eslint-disable max-len */
|
|
1933
|
-
|
|
1934
1925
|
// Currently without astral characters support.
|
|
1935
1926
|
function isPunctChar (ch) {
|
|
1936
1927
|
return P$7.test(ch) || regex.test(ch)
|
|
@@ -2306,7 +2297,7 @@ const default_rules = {};
|
|
|
2306
2297
|
default_rules.code_inline = function (tokens, idx, options, env, slf) {
|
|
2307
2298
|
const token = tokens[idx];
|
|
2308
2299
|
|
|
2309
|
-
return
|
|
2300
|
+
return '<code' + slf.renderAttrs(token) + '>' +
|
|
2310
2301
|
escapeHtml(token.content) +
|
|
2311
2302
|
'</code>'
|
|
2312
2303
|
};
|
|
@@ -2314,7 +2305,7 @@ default_rules.code_inline = function (tokens, idx, options, env, slf) {
|
|
|
2314
2305
|
default_rules.code_block = function (tokens, idx, options, env, slf) {
|
|
2315
2306
|
const token = tokens[idx];
|
|
2316
2307
|
|
|
2317
|
-
return
|
|
2308
|
+
return '<pre' + slf.renderAttrs(token) + '><code>' +
|
|
2318
2309
|
escapeHtml(tokens[idx].content) +
|
|
2319
2310
|
'</code></pre>\n'
|
|
2320
2311
|
};
|
|
@@ -2967,28 +2958,28 @@ function Token (type, tag, nesting) {
|
|
|
2967
2958
|
*
|
|
2968
2959
|
* Type of the token (string, e.g. "paragraph_open")
|
|
2969
2960
|
**/
|
|
2970
|
-
this.type
|
|
2961
|
+
this.type = type;
|
|
2971
2962
|
|
|
2972
2963
|
/**
|
|
2973
2964
|
* Token#tag -> String
|
|
2974
2965
|
*
|
|
2975
2966
|
* html tag name, e.g. "p"
|
|
2976
2967
|
**/
|
|
2977
|
-
this.tag
|
|
2968
|
+
this.tag = tag;
|
|
2978
2969
|
|
|
2979
2970
|
/**
|
|
2980
2971
|
* Token#attrs -> Array
|
|
2981
2972
|
*
|
|
2982
2973
|
* Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
|
|
2983
2974
|
**/
|
|
2984
|
-
this.attrs
|
|
2975
|
+
this.attrs = null;
|
|
2985
2976
|
|
|
2986
2977
|
/**
|
|
2987
2978
|
* Token#map -> Array
|
|
2988
2979
|
*
|
|
2989
2980
|
* Source map info. Format: `[ line_begin, line_end ]`
|
|
2990
2981
|
**/
|
|
2991
|
-
this.map
|
|
2982
|
+
this.map = null;
|
|
2992
2983
|
|
|
2993
2984
|
/**
|
|
2994
2985
|
* Token#nesting -> Number
|
|
@@ -2999,14 +2990,14 @@ function Token (type, tag, nesting) {
|
|
|
2999
2990
|
* - `0` means the tag is self-closing
|
|
3000
2991
|
* - `-1` means the tag is closing
|
|
3001
2992
|
**/
|
|
3002
|
-
this.nesting
|
|
2993
|
+
this.nesting = nesting;
|
|
3003
2994
|
|
|
3004
2995
|
/**
|
|
3005
2996
|
* Token#level -> Number
|
|
3006
2997
|
*
|
|
3007
2998
|
* nesting level, the same as `state.level`
|
|
3008
2999
|
**/
|
|
3009
|
-
this.level
|
|
3000
|
+
this.level = 0;
|
|
3010
3001
|
|
|
3011
3002
|
/**
|
|
3012
3003
|
* Token#children -> Array
|
|
@@ -3021,14 +3012,14 @@ function Token (type, tag, nesting) {
|
|
|
3021
3012
|
* In a case of self-closing tag (code, html, fence, etc.),
|
|
3022
3013
|
* it has contents of this tag.
|
|
3023
3014
|
**/
|
|
3024
|
-
this.content
|
|
3015
|
+
this.content = '';
|
|
3025
3016
|
|
|
3026
3017
|
/**
|
|
3027
3018
|
* Token#markup -> String
|
|
3028
3019
|
*
|
|
3029
3020
|
* '*' or '_' for emphasis, fence string for fence, etc.
|
|
3030
3021
|
**/
|
|
3031
|
-
this.markup
|
|
3022
|
+
this.markup = '';
|
|
3032
3023
|
|
|
3033
3024
|
/**
|
|
3034
3025
|
* Token#info -> String
|
|
@@ -3039,14 +3030,14 @@ function Token (type, tag, nesting) {
|
|
|
3039
3030
|
* - The value "auto" for autolink "link_open" and "link_close" tokens
|
|
3040
3031
|
* - The string value of the item marker for ordered-list "list_item_open" tokens
|
|
3041
3032
|
**/
|
|
3042
|
-
this.info
|
|
3033
|
+
this.info = '';
|
|
3043
3034
|
|
|
3044
3035
|
/**
|
|
3045
3036
|
* Token#meta -> Object
|
|
3046
3037
|
*
|
|
3047
3038
|
* A place for plugins to store an arbitrary data
|
|
3048
3039
|
**/
|
|
3049
|
-
this.meta
|
|
3040
|
+
this.meta = null;
|
|
3050
3041
|
|
|
3051
3042
|
/**
|
|
3052
3043
|
* Token#block -> Boolean
|
|
@@ -3054,7 +3045,7 @@ function Token (type, tag, nesting) {
|
|
|
3054
3045
|
* True for block-level tokens, false for inline tokens.
|
|
3055
3046
|
* Used in renderer to calculate line breaks
|
|
3056
3047
|
**/
|
|
3057
|
-
this.block
|
|
3048
|
+
this.block = false;
|
|
3058
3049
|
|
|
3059
3050
|
/**
|
|
3060
3051
|
* Token#hidden -> Boolean
|
|
@@ -3062,7 +3053,7 @@ function Token (type, tag, nesting) {
|
|
|
3062
3053
|
* If it's true, ignore this element when rendering. Used for tight lists
|
|
3063
3054
|
* to hide paragraphs.
|
|
3064
3055
|
**/
|
|
3065
|
-
this.hidden
|
|
3056
|
+
this.hidden = false;
|
|
3066
3057
|
}
|
|
3067
3058
|
|
|
3068
3059
|
/**
|
|
@@ -3158,8 +3149,8 @@ StateCore.prototype.Token = Token;
|
|
|
3158
3149
|
// Normalize input string
|
|
3159
3150
|
|
|
3160
3151
|
// https://spec.commonmark.org/0.29/#line-ending
|
|
3161
|
-
const NEWLINES_RE
|
|
3162
|
-
const NULL_RE
|
|
3152
|
+
const NEWLINES_RE = /\r\n?|\n/g;
|
|
3153
|
+
const NULL_RE = /\0/g;
|
|
3163
3154
|
|
|
3164
3155
|
function normalize (state) {
|
|
3165
3156
|
let str;
|
|
@@ -3177,9 +3168,9 @@ function block (state) {
|
|
|
3177
3168
|
let token;
|
|
3178
3169
|
|
|
3179
3170
|
if (state.inlineMode) {
|
|
3180
|
-
token
|
|
3181
|
-
token.content
|
|
3182
|
-
token.map
|
|
3171
|
+
token = new state.Token('inline', '', 0);
|
|
3172
|
+
token.content = state.src;
|
|
3173
|
+
token.map = [0, 1];
|
|
3183
3174
|
token.children = [];
|
|
3184
3175
|
state.tokens.push(token);
|
|
3185
3176
|
} else {
|
|
@@ -3293,36 +3284,36 @@ function linkify$1 (state) {
|
|
|
3293
3284
|
const pos = links[ln].index;
|
|
3294
3285
|
|
|
3295
3286
|
if (pos > lastPos) {
|
|
3296
|
-
const token
|
|
3287
|
+
const token = new state.Token('text', '', 0);
|
|
3297
3288
|
token.content = text.slice(lastPos, pos);
|
|
3298
|
-
token.level
|
|
3289
|
+
token.level = level;
|
|
3299
3290
|
nodes.push(token);
|
|
3300
3291
|
}
|
|
3301
3292
|
|
|
3302
|
-
const token_o
|
|
3303
|
-
token_o.attrs
|
|
3304
|
-
token_o.level
|
|
3305
|
-
token_o.markup
|
|
3306
|
-
token_o.info
|
|
3293
|
+
const token_o = new state.Token('link_open', 'a', 1);
|
|
3294
|
+
token_o.attrs = [['href', fullUrl]];
|
|
3295
|
+
token_o.level = level++;
|
|
3296
|
+
token_o.markup = 'linkify';
|
|
3297
|
+
token_o.info = 'auto';
|
|
3307
3298
|
nodes.push(token_o);
|
|
3308
3299
|
|
|
3309
|
-
const token_t
|
|
3300
|
+
const token_t = new state.Token('text', '', 0);
|
|
3310
3301
|
token_t.content = urlText;
|
|
3311
|
-
token_t.level
|
|
3302
|
+
token_t.level = level;
|
|
3312
3303
|
nodes.push(token_t);
|
|
3313
3304
|
|
|
3314
|
-
const token_c
|
|
3315
|
-
token_c.level
|
|
3316
|
-
token_c.markup
|
|
3317
|
-
token_c.info
|
|
3305
|
+
const token_c = new state.Token('link_close', 'a', -1);
|
|
3306
|
+
token_c.level = --level;
|
|
3307
|
+
token_c.markup = 'linkify';
|
|
3308
|
+
token_c.info = 'auto';
|
|
3318
3309
|
nodes.push(token_c);
|
|
3319
3310
|
|
|
3320
3311
|
lastPos = links[ln].lastIndex;
|
|
3321
3312
|
}
|
|
3322
3313
|
if (lastPos < text.length) {
|
|
3323
|
-
const token
|
|
3314
|
+
const token = new state.Token('text', '', 0);
|
|
3324
3315
|
token.content = text.slice(lastPos);
|
|
3325
|
-
token.level
|
|
3316
|
+
token.level = level;
|
|
3326
3317
|
nodes.push(token);
|
|
3327
3318
|
}
|
|
3328
3319
|
|
|
@@ -3697,15 +3688,15 @@ function text_join (state) {
|
|
|
3697
3688
|
|
|
3698
3689
|
|
|
3699
3690
|
const _rules$2 = [
|
|
3700
|
-
['normalize',
|
|
3701
|
-
['block',
|
|
3702
|
-
['inline',
|
|
3703
|
-
['linkify',
|
|
3704
|
-
['replacements',
|
|
3705
|
-
['smartquotes',
|
|
3691
|
+
['normalize', normalize],
|
|
3692
|
+
['block', block],
|
|
3693
|
+
['inline', inline],
|
|
3694
|
+
['linkify', linkify$1],
|
|
3695
|
+
['replacements', replace],
|
|
3696
|
+
['smartquotes', smartquotes],
|
|
3706
3697
|
// `text_join` finds `text_special` tokens (for escape sequences)
|
|
3707
3698
|
// and joins them with the rest of the text
|
|
3708
|
-
['text_join',
|
|
3699
|
+
['text_join', text_join]
|
|
3709
3700
|
];
|
|
3710
3701
|
|
|
3711
3702
|
/**
|
|
@@ -3746,7 +3737,7 @@ function StateBlock (src, md, env, tokens) {
|
|
|
3746
3737
|
this.src = src;
|
|
3747
3738
|
|
|
3748
3739
|
// link to parser instance
|
|
3749
|
-
this.md
|
|
3740
|
+
this.md = md;
|
|
3750
3741
|
|
|
3751
3742
|
this.env = env;
|
|
3752
3743
|
|
|
@@ -3777,11 +3768,11 @@ function StateBlock (src, md, env, tokens) {
|
|
|
3777
3768
|
|
|
3778
3769
|
// required block content indent (for example, if we are
|
|
3779
3770
|
// inside a list, it would be positioned after list marker)
|
|
3780
|
-
this.blkIndent
|
|
3781
|
-
this.line
|
|
3782
|
-
this.lineMax
|
|
3783
|
-
this.tight
|
|
3784
|
-
this.ddIndent
|
|
3771
|
+
this.blkIndent = 0;
|
|
3772
|
+
this.line = 0; // line index in src
|
|
3773
|
+
this.lineMax = 0; // lines count
|
|
3774
|
+
this.tight = false; // loose/tight mode for lists
|
|
3775
|
+
this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
|
|
3785
3776
|
this.listIndent = -1; // indent of the current list block (-1 if there isn't any)
|
|
3786
3777
|
|
|
3787
3778
|
// can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
|
|
@@ -4108,11 +4099,11 @@ function table (state, startLine, endLine, silent) {
|
|
|
4108
4099
|
for (let i = 0; i < columns.length; i++) {
|
|
4109
4100
|
const token_ho = state.push('th_open', 'th', 1);
|
|
4110
4101
|
if (aligns[i]) {
|
|
4111
|
-
token_ho.attrs
|
|
4102
|
+
token_ho.attrs = [['style', 'text-align:' + aligns[i]]];
|
|
4112
4103
|
}
|
|
4113
4104
|
|
|
4114
4105
|
const token_il = state.push('inline', '', 0);
|
|
4115
|
-
token_il.content
|
|
4106
|
+
token_il.content = columns[i].trim();
|
|
4116
4107
|
token_il.children = [];
|
|
4117
4108
|
|
|
4118
4109
|
state.push('th_close', 'th', -1);
|
|
@@ -4159,11 +4150,11 @@ function table (state, startLine, endLine, silent) {
|
|
|
4159
4150
|
for (let i = 0; i < columnCount; i++) {
|
|
4160
4151
|
const token_tdo = state.push('td_open', 'td', 1);
|
|
4161
4152
|
if (aligns[i]) {
|
|
4162
|
-
token_tdo.attrs
|
|
4153
|
+
token_tdo.attrs = [['style', 'text-align:' + aligns[i]]];
|
|
4163
4154
|
}
|
|
4164
4155
|
|
|
4165
4156
|
const token_il = state.push('inline', '', 0);
|
|
4166
|
-
token_il.content
|
|
4157
|
+
token_il.content = columns[i] ? columns[i].trim() : '';
|
|
4167
4158
|
token_il.children = [];
|
|
4168
4159
|
|
|
4169
4160
|
state.push('td_close', 'td', -1);
|
|
@@ -4208,9 +4199,9 @@ function code (state, startLine, endLine/*, silent */) {
|
|
|
4208
4199
|
|
|
4209
4200
|
state.line = last;
|
|
4210
4201
|
|
|
4211
|
-
const token
|
|
4202
|
+
const token = state.push('code_block', 'code', 0);
|
|
4212
4203
|
token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\n';
|
|
4213
|
-
token.map
|
|
4204
|
+
token.map = [startLine, state.line];
|
|
4214
4205
|
|
|
4215
4206
|
return true
|
|
4216
4207
|
}
|
|
@@ -4301,11 +4292,11 @@ function fence (state, startLine, endLine, silent) {
|
|
|
4301
4292
|
|
|
4302
4293
|
state.line = nextLine + (haveEndMarker ? 1 : 0);
|
|
4303
4294
|
|
|
4304
|
-
const token
|
|
4305
|
-
token.info
|
|
4295
|
+
const token = state.push('fence', 'code', 0);
|
|
4296
|
+
token.info = params;
|
|
4306
4297
|
token.content = state.getLines(startLine + 1, nextLine, len, true);
|
|
4307
|
-
token.markup
|
|
4308
|
-
token.map
|
|
4298
|
+
token.markup = markup;
|
|
4299
|
+
token.map = [startLine, state.line];
|
|
4309
4300
|
|
|
4310
4301
|
return true
|
|
4311
4302
|
}
|
|
@@ -4329,10 +4320,10 @@ function blockquote (state, startLine, endLine, silent) {
|
|
|
4329
4320
|
// so no point trying to find the end of it in silent mode
|
|
4330
4321
|
if (silent) { return true }
|
|
4331
4322
|
|
|
4332
|
-
const oldBMarks
|
|
4323
|
+
const oldBMarks = [];
|
|
4333
4324
|
const oldBSCount = [];
|
|
4334
|
-
const oldSCount
|
|
4335
|
-
const oldTShift
|
|
4325
|
+
const oldSCount = [];
|
|
4326
|
+
const oldTShift = [];
|
|
4336
4327
|
|
|
4337
4328
|
const terminatorRules = state.md.block.ruler.getRules('blockquote');
|
|
4338
4329
|
|
|
@@ -4492,14 +4483,14 @@ function blockquote (state, startLine, endLine, silent) {
|
|
|
4492
4483
|
const oldIndent = state.blkIndent;
|
|
4493
4484
|
state.blkIndent = 0;
|
|
4494
4485
|
|
|
4495
|
-
const token_o
|
|
4486
|
+
const token_o = state.push('blockquote_open', 'blockquote', 1);
|
|
4496
4487
|
token_o.markup = '>';
|
|
4497
4488
|
const lines = [startLine, 0];
|
|
4498
|
-
token_o.map
|
|
4489
|
+
token_o.map = lines;
|
|
4499
4490
|
|
|
4500
4491
|
state.md.block.tokenize(state, startLine, nextLine);
|
|
4501
4492
|
|
|
4502
|
-
const token_c
|
|
4493
|
+
const token_c = state.push('blockquote_close', 'blockquote', -1);
|
|
4503
4494
|
token_c.markup = '>';
|
|
4504
4495
|
|
|
4505
4496
|
state.lineMax = oldLineMax;
|
|
@@ -4552,8 +4543,8 @@ function hr$8 (state, startLine, endLine, silent) {
|
|
|
4552
4543
|
|
|
4553
4544
|
state.line = startLine + 1;
|
|
4554
4545
|
|
|
4555
|
-
const token
|
|
4556
|
-
token.map
|
|
4546
|
+
const token = state.push('hr', 'hr', 0);
|
|
4547
|
+
token.map = [startLine, state.line];
|
|
4557
4548
|
token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
|
|
4558
4549
|
|
|
4559
4550
|
return true
|
|
@@ -4716,16 +4707,16 @@ function list (state, startLine, endLine, silent) {
|
|
|
4716
4707
|
const listTokIdx = state.tokens.length;
|
|
4717
4708
|
|
|
4718
4709
|
if (isOrdered) {
|
|
4719
|
-
token
|
|
4710
|
+
token = state.push('ordered_list_open', 'ol', 1);
|
|
4720
4711
|
if (markerValue !== 1) {
|
|
4721
4712
|
token.attrs = [['start', markerValue]];
|
|
4722
4713
|
}
|
|
4723
4714
|
} else {
|
|
4724
|
-
token
|
|
4715
|
+
token = state.push('bullet_list_open', 'ul', 1);
|
|
4725
4716
|
}
|
|
4726
4717
|
|
|
4727
4718
|
const listLines = [nextLine, 0];
|
|
4728
|
-
token.map
|
|
4719
|
+
token.map = listLines;
|
|
4729
4720
|
token.markup = String.fromCharCode(markerCharCode);
|
|
4730
4721
|
|
|
4731
4722
|
//
|
|
@@ -4778,10 +4769,10 @@ function list (state, startLine, endLine, silent) {
|
|
|
4778
4769
|
const indent = initial + indentAfterMarker;
|
|
4779
4770
|
|
|
4780
4771
|
// Run subparser & write tokens
|
|
4781
|
-
token
|
|
4772
|
+
token = state.push('list_item_open', 'li', 1);
|
|
4782
4773
|
token.markup = String.fromCharCode(markerCharCode);
|
|
4783
4774
|
const itemLines = [nextLine, 0];
|
|
4784
|
-
token.map
|
|
4775
|
+
token.map = itemLines;
|
|
4785
4776
|
if (isOrdered) {
|
|
4786
4777
|
token.info = state.src.slice(start, posAfterMarker - 1);
|
|
4787
4778
|
}
|
|
@@ -4830,7 +4821,7 @@ function list (state, startLine, endLine, silent) {
|
|
|
4830
4821
|
state.sCount[nextLine] = oldSCount;
|
|
4831
4822
|
state.tight = oldTight;
|
|
4832
4823
|
|
|
4833
|
-
token
|
|
4824
|
+
token = state.push('list_item_close', 'li', -1);
|
|
4834
4825
|
token.markup = String.fromCharCode(markerCharCode);
|
|
4835
4826
|
|
|
4836
4827
|
nextLine = state.line;
|
|
@@ -5167,23 +5158,23 @@ var block_names = [
|
|
|
5167
5158
|
|
|
5168
5159
|
// Regexps to match html elements
|
|
5169
5160
|
|
|
5170
|
-
const attr_name
|
|
5161
|
+
const attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
|
|
5171
5162
|
|
|
5172
|
-
const unquoted
|
|
5163
|
+
const unquoted = '[^"\'=<>`\\x00-\\x20]+';
|
|
5173
5164
|
const single_quoted = "'[^']*'";
|
|
5174
5165
|
const double_quoted = '"[^"]*"';
|
|
5175
5166
|
|
|
5176
|
-
const attr_value
|
|
5167
|
+
const attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
|
|
5177
5168
|
|
|
5178
|
-
const attribute
|
|
5169
|
+
const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
|
|
5179
5170
|
|
|
5180
|
-
const open_tag
|
|
5171
|
+
const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
|
|
5181
5172
|
|
|
5182
|
-
const close_tag
|
|
5183
|
-
const comment
|
|
5184
|
-
const processing
|
|
5173
|
+
const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
|
|
5174
|
+
const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->';
|
|
5175
|
+
const processing = '<[?][\\s\\S]*?[?]>';
|
|
5185
5176
|
const declaration = '<![A-Za-z][^>]*>';
|
|
5186
|
-
const cdata
|
|
5177
|
+
const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
|
|
5187
5178
|
|
|
5188
5179
|
const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
|
|
5189
5180
|
'|' + processing + '|' + declaration + '|' + cdata + ')');
|
|
@@ -5197,12 +5188,12 @@ const HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag +
|
|
|
5197
5188
|
//
|
|
5198
5189
|
const HTML_SEQUENCES = [
|
|
5199
5190
|
[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true],
|
|
5200
|
-
[/^<!--/,
|
|
5201
|
-
[/^<\?/,
|
|
5202
|
-
[/^<![A-Z]/,
|
|
5191
|
+
[/^<!--/, /-->/, true],
|
|
5192
|
+
[/^<\?/, /\?>/, true],
|
|
5193
|
+
[/^<![A-Z]/, />/, true],
|
|
5203
5194
|
[/^<!\[CDATA\[/, /\]\]>/, true],
|
|
5204
5195
|
[new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true],
|
|
5205
|
-
[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'),
|
|
5196
|
+
[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false]
|
|
5206
5197
|
];
|
|
5207
5198
|
|
|
5208
5199
|
function html_block (state, startLine, endLine, silent) {
|
|
@@ -5261,8 +5252,8 @@ function html_block (state, startLine, endLine, silent) {
|
|
|
5261
5252
|
|
|
5262
5253
|
state.line = nextLine;
|
|
5263
5254
|
|
|
5264
|
-
const token
|
|
5265
|
-
token.map
|
|
5255
|
+
const token = state.push('html_block', '', 0);
|
|
5256
|
+
token.map = [startLine, nextLine];
|
|
5266
5257
|
token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
|
|
5267
5258
|
|
|
5268
5259
|
return true
|
|
@@ -5278,7 +5269,7 @@ function heading (state, startLine, endLine, silent) {
|
|
|
5278
5269
|
// if it's indented more than 3 spaces, it should be a code block
|
|
5279
5270
|
if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
|
|
5280
5271
|
|
|
5281
|
-
let ch
|
|
5272
|
+
let ch = state.src.charCodeAt(pos);
|
|
5282
5273
|
|
|
5283
5274
|
if (ch !== 0x23/* # */ || pos >= max) { return false }
|
|
5284
5275
|
|
|
@@ -5304,16 +5295,16 @@ function heading (state, startLine, endLine, silent) {
|
|
|
5304
5295
|
|
|
5305
5296
|
state.line = startLine + 1;
|
|
5306
5297
|
|
|
5307
|
-
const token_o
|
|
5298
|
+
const token_o = state.push('heading_open', 'h' + String(level), 1);
|
|
5308
5299
|
token_o.markup = '########'.slice(0, level);
|
|
5309
|
-
token_o.map
|
|
5300
|
+
token_o.map = [startLine, state.line];
|
|
5310
5301
|
|
|
5311
|
-
const token_i
|
|
5312
|
-
token_i.content
|
|
5313
|
-
token_i.map
|
|
5302
|
+
const token_i = state.push('inline', '', 0);
|
|
5303
|
+
token_i.content = asciiTrim(state.src.slice(pos, max));
|
|
5304
|
+
token_i.map = [startLine, state.line];
|
|
5314
5305
|
token_i.children = [];
|
|
5315
5306
|
|
|
5316
|
-
const token_c
|
|
5307
|
+
const token_c = state.push('heading_close', 'h' + String(level), -1);
|
|
5317
5308
|
token_c.markup = '########'.slice(0, level);
|
|
5318
5309
|
|
|
5319
5310
|
return true
|
|
@@ -5387,17 +5378,17 @@ function lheading (state, startLine, endLine/*, silent */) {
|
|
|
5387
5378
|
|
|
5388
5379
|
state.line = nextLine + 1;
|
|
5389
5380
|
|
|
5390
|
-
const token_o
|
|
5391
|
-
token_o.markup
|
|
5392
|
-
token_o.map
|
|
5381
|
+
const token_o = state.push('heading_open', 'h' + String(level), 1);
|
|
5382
|
+
token_o.markup = String.fromCharCode(marker);
|
|
5383
|
+
token_o.map = [startLine, state.line];
|
|
5393
5384
|
|
|
5394
|
-
const token_i
|
|
5395
|
-
token_i.content
|
|
5396
|
-
token_i.map
|
|
5385
|
+
const token_i = state.push('inline', '', 0);
|
|
5386
|
+
token_i.content = content;
|
|
5387
|
+
token_i.map = [startLine, state.line - 1];
|
|
5397
5388
|
token_i.children = [];
|
|
5398
5389
|
|
|
5399
|
-
const token_c
|
|
5400
|
-
token_c.markup
|
|
5390
|
+
const token_c = state.push('heading_close', 'h' + String(level), -1);
|
|
5391
|
+
token_c.markup = String.fromCharCode(marker);
|
|
5401
5392
|
|
|
5402
5393
|
state.parentType = oldParentType;
|
|
5403
5394
|
|
|
@@ -5437,12 +5428,12 @@ function paragraph (state, startLine, endLine) {
|
|
|
5437
5428
|
|
|
5438
5429
|
state.line = nextLine;
|
|
5439
5430
|
|
|
5440
|
-
const token_o
|
|
5441
|
-
token_o.map
|
|
5431
|
+
const token_o = state.push('paragraph_open', 'p', 1);
|
|
5432
|
+
token_o.map = [startLine, state.line];
|
|
5442
5433
|
|
|
5443
|
-
const token_i
|
|
5444
|
-
token_i.content
|
|
5445
|
-
token_i.map
|
|
5434
|
+
const token_i = state.push('inline', '', 0);
|
|
5435
|
+
token_i.content = content;
|
|
5436
|
+
token_i.map = [startLine, state.line];
|
|
5446
5437
|
token_i.children = [];
|
|
5447
5438
|
|
|
5448
5439
|
state.push('paragraph_close', 'p', -1);
|
|
@@ -5462,17 +5453,17 @@ function paragraph (state, startLine, endLine) {
|
|
|
5462
5453
|
const _rules$1 = [
|
|
5463
5454
|
// First 2 params - rule name & source. Secondary array - list of rules,
|
|
5464
5455
|
// which can be terminated by this one.
|
|
5465
|
-
['table',
|
|
5466
|
-
['code',
|
|
5467
|
-
['fence',
|
|
5456
|
+
['table', table, ['paragraph', 'reference']],
|
|
5457
|
+
['code', code],
|
|
5458
|
+
['fence', fence, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
5468
5459
|
['blockquote', blockquote, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
5469
|
-
['hr',
|
|
5470
|
-
['list',
|
|
5471
|
-
['reference',
|
|
5460
|
+
['hr', hr$8, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
5461
|
+
['list', list, ['paragraph', 'reference', 'blockquote']],
|
|
5462
|
+
['reference', reference],
|
|
5472
5463
|
['html_block', html_block, ['paragraph', 'reference', 'blockquote']],
|
|
5473
|
-
['heading',
|
|
5474
|
-
['lheading',
|
|
5475
|
-
['paragraph',
|
|
5464
|
+
['heading', heading, ['paragraph', 'reference', 'blockquote']],
|
|
5465
|
+
['lheading', lheading],
|
|
5466
|
+
['paragraph', paragraph]
|
|
5476
5467
|
];
|
|
5477
5468
|
|
|
5478
5469
|
/**
|
|
@@ -5713,8 +5704,8 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
|
|
|
5713
5704
|
const right_flanking =
|
|
5714
5705
|
!isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
|
|
5715
5706
|
|
|
5716
|
-
const can_open
|
|
5717
|
-
const can_close = right_flanking && (canSplitWord || !left_flanking
|
|
5707
|
+
const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
|
|
5708
|
+
const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
|
|
5718
5709
|
|
|
5719
5710
|
return { can_open, can_close, length: count }
|
|
5720
5711
|
};
|
|
@@ -5954,6 +5945,20 @@ function escape$3 (state, silent) {
|
|
|
5954
5945
|
return true
|
|
5955
5946
|
}
|
|
5956
5947
|
|
|
5948
|
+
// '\' before a space is a literal backslash. Don't consume the space, so a
|
|
5949
|
+
// trailing two-space hard line break is still detected by the newline rule.
|
|
5950
|
+
if (ch1 === 0x20) {
|
|
5951
|
+
if (!silent) {
|
|
5952
|
+
const token = state.push('text_special', '', 0);
|
|
5953
|
+
token.content = '\\';
|
|
5954
|
+
token.markup = '\\';
|
|
5955
|
+
token.info = 'escape';
|
|
5956
|
+
}
|
|
5957
|
+
|
|
5958
|
+
state.pos = pos;
|
|
5959
|
+
return true
|
|
5960
|
+
}
|
|
5961
|
+
|
|
5957
5962
|
let escapedStr = state.src[pos];
|
|
5958
5963
|
|
|
5959
5964
|
if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {
|
|
@@ -5977,7 +5982,7 @@ function escape$3 (state, silent) {
|
|
|
5977
5982
|
}
|
|
5978
5983
|
|
|
5979
5984
|
token.markup = origStr;
|
|
5980
|
-
token.info
|
|
5985
|
+
token.info = 'escape';
|
|
5981
5986
|
}
|
|
5982
5987
|
|
|
5983
5988
|
state.pos = pos + 1;
|
|
@@ -6067,13 +6072,13 @@ function strikethrough_tokenize (state, silent) {
|
|
|
6067
6072
|
let token;
|
|
6068
6073
|
|
|
6069
6074
|
if (len % 2) {
|
|
6070
|
-
token
|
|
6075
|
+
token = state.push('text', '', 0);
|
|
6071
6076
|
token.content = ch;
|
|
6072
6077
|
len--;
|
|
6073
6078
|
}
|
|
6074
6079
|
|
|
6075
6080
|
for (let i = 0; i < len; i += 2) {
|
|
6076
|
-
token
|
|
6081
|
+
token = state.push('text', '', 0);
|
|
6077
6082
|
token.content = ch + ch;
|
|
6078
6083
|
|
|
6079
6084
|
state.delimiters.push({
|
|
@@ -6109,18 +6114,18 @@ function postProcess$1 (state, delimiters) {
|
|
|
6109
6114
|
|
|
6110
6115
|
const endDelim = delimiters[startDelim.end];
|
|
6111
6116
|
|
|
6112
|
-
token
|
|
6113
|
-
token.type
|
|
6114
|
-
token.tag
|
|
6117
|
+
token = state.tokens[startDelim.token];
|
|
6118
|
+
token.type = 's_open';
|
|
6119
|
+
token.tag = 's';
|
|
6115
6120
|
token.nesting = 1;
|
|
6116
|
-
token.markup
|
|
6121
|
+
token.markup = '~~';
|
|
6117
6122
|
token.content = '';
|
|
6118
6123
|
|
|
6119
|
-
token
|
|
6120
|
-
token.type
|
|
6121
|
-
token.tag
|
|
6124
|
+
token = state.tokens[endDelim.token];
|
|
6125
|
+
token.type = 's_close';
|
|
6126
|
+
token.tag = 's';
|
|
6122
6127
|
token.nesting = -1;
|
|
6123
|
-
token.markup
|
|
6128
|
+
token.markup = '~~';
|
|
6124
6129
|
token.content = '';
|
|
6125
6130
|
|
|
6126
6131
|
if (state.tokens[endDelim.token - 1].type === 'text' &&
|
|
@@ -6255,18 +6260,18 @@ function postProcess (state, delimiters) {
|
|
|
6255
6260
|
|
|
6256
6261
|
const ch = String.fromCharCode(startDelim.marker);
|
|
6257
6262
|
|
|
6258
|
-
const token_o
|
|
6259
|
-
token_o.type
|
|
6260
|
-
token_o.tag
|
|
6263
|
+
const token_o = state.tokens[startDelim.token];
|
|
6264
|
+
token_o.type = isStrong ? 'strong_open' : 'em_open';
|
|
6265
|
+
token_o.tag = isStrong ? 'strong' : 'em';
|
|
6261
6266
|
token_o.nesting = 1;
|
|
6262
|
-
token_o.markup
|
|
6267
|
+
token_o.markup = isStrong ? ch + ch : ch;
|
|
6263
6268
|
token_o.content = '';
|
|
6264
6269
|
|
|
6265
|
-
const token_c
|
|
6266
|
-
token_c.type
|
|
6267
|
-
token_c.tag
|
|
6270
|
+
const token_c = state.tokens[endDelim.token];
|
|
6271
|
+
token_c.type = isStrong ? 'strong_close' : 'em_close';
|
|
6272
|
+
token_c.tag = isStrong ? 'strong' : 'em';
|
|
6268
6273
|
token_c.nesting = -1;
|
|
6269
|
-
token_c.markup
|
|
6274
|
+
token_c.markup = isStrong ? ch + ch : ch;
|
|
6270
6275
|
token_c.content = '';
|
|
6271
6276
|
|
|
6272
6277
|
if (isStrong) {
|
|
@@ -6419,7 +6424,7 @@ function link$1 (state, silent) {
|
|
|
6419
6424
|
|
|
6420
6425
|
const token_o = state.push('link_open', 'a', 1);
|
|
6421
6426
|
const attrs = [['href', href]];
|
|
6422
|
-
token_o.attrs
|
|
6427
|
+
token_o.attrs = attrs;
|
|
6423
6428
|
if (title) {
|
|
6424
6429
|
attrs.push(['title', title]);
|
|
6425
6430
|
}
|
|
@@ -6577,7 +6582,7 @@ function image (state, silent) {
|
|
|
6577
6582
|
// Process autolinks '<protocol:...>'
|
|
6578
6583
|
|
|
6579
6584
|
/* eslint max-len:0 */
|
|
6580
|
-
const EMAIL_RE
|
|
6585
|
+
const 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])?)*)$/;
|
|
6581
6586
|
/* eslint-disable-next-line no-control-regex */
|
|
6582
6587
|
const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
|
|
6583
6588
|
|
|
@@ -6605,17 +6610,17 @@ function autolink (state, silent) {
|
|
|
6605
6610
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
6606
6611
|
|
|
6607
6612
|
if (!silent) {
|
|
6608
|
-
const token_o
|
|
6609
|
-
token_o.attrs
|
|
6610
|
-
token_o.markup
|
|
6611
|
-
token_o.info
|
|
6613
|
+
const token_o = state.push('link_open', 'a', 1);
|
|
6614
|
+
token_o.attrs = [['href', fullUrl]];
|
|
6615
|
+
token_o.markup = 'autolink';
|
|
6616
|
+
token_o.info = 'auto';
|
|
6612
6617
|
|
|
6613
|
-
const token_t
|
|
6618
|
+
const token_t = state.push('text', '', 0);
|
|
6614
6619
|
token_t.content = state.md.normalizeLinkText(url);
|
|
6615
6620
|
|
|
6616
|
-
const token_c
|
|
6617
|
-
token_c.markup
|
|
6618
|
-
token_c.info
|
|
6621
|
+
const token_c = state.push('link_close', 'a', -1);
|
|
6622
|
+
token_c.markup = 'autolink';
|
|
6623
|
+
token_c.info = 'auto';
|
|
6619
6624
|
}
|
|
6620
6625
|
|
|
6621
6626
|
state.pos += url.length + 2;
|
|
@@ -6627,17 +6632,17 @@ function autolink (state, silent) {
|
|
|
6627
6632
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
6628
6633
|
|
|
6629
6634
|
if (!silent) {
|
|
6630
|
-
const token_o
|
|
6631
|
-
token_o.attrs
|
|
6632
|
-
token_o.markup
|
|
6633
|
-
token_o.info
|
|
6635
|
+
const token_o = state.push('link_open', 'a', 1);
|
|
6636
|
+
token_o.attrs = [['href', fullUrl]];
|
|
6637
|
+
token_o.markup = 'autolink';
|
|
6638
|
+
token_o.info = 'auto';
|
|
6634
6639
|
|
|
6635
|
-
const token_t
|
|
6640
|
+
const token_t = state.push('text', '', 0);
|
|
6636
6641
|
token_t.content = state.md.normalizeLinkText(url);
|
|
6637
6642
|
|
|
6638
|
-
const token_c
|
|
6639
|
-
token_c.markup
|
|
6640
|
-
token_c.info
|
|
6643
|
+
const token_c = state.push('link_close', 'a', -1);
|
|
6644
|
+
token_c.markup = 'autolink';
|
|
6645
|
+
token_c.info = 'auto';
|
|
6641
6646
|
}
|
|
6642
6647
|
|
|
6643
6648
|
state.pos += url.length + 2;
|
|
@@ -6690,7 +6695,7 @@ function html_inline (state, silent) {
|
|
|
6690
6695
|
const token = state.push('html_inline', '', 0);
|
|
6691
6696
|
token.content = match[0];
|
|
6692
6697
|
|
|
6693
|
-
if (isLinkOpen(token.content))
|
|
6698
|
+
if (isLinkOpen(token.content)) state.linkLevel++;
|
|
6694
6699
|
if (isLinkClose(token.content)) state.linkLevel--;
|
|
6695
6700
|
}
|
|
6696
6701
|
state.pos += match[0].length;
|
|
@@ -6701,7 +6706,7 @@ function html_inline (state, silent) {
|
|
|
6701
6706
|
|
|
6702
6707
|
|
|
6703
6708
|
const DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
|
|
6704
|
-
const NAMED_RE
|
|
6709
|
+
const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
|
|
6705
6710
|
|
|
6706
6711
|
function entity (state, silent) {
|
|
6707
6712
|
const pos = state.pos;
|
|
@@ -6719,10 +6724,10 @@ function entity (state, silent) {
|
|
|
6719
6724
|
if (!silent) {
|
|
6720
6725
|
const code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
|
|
6721
6726
|
|
|
6722
|
-
const token
|
|
6727
|
+
const token = state.push('text_special', '', 0);
|
|
6723
6728
|
token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
|
|
6724
|
-
token.markup
|
|
6725
|
-
token.info
|
|
6729
|
+
token.markup = match[0];
|
|
6730
|
+
token.info = 'entity';
|
|
6726
6731
|
}
|
|
6727
6732
|
state.pos += match[0].length;
|
|
6728
6733
|
return true
|
|
@@ -6733,10 +6738,10 @@ function entity (state, silent) {
|
|
|
6733
6738
|
const decoded = decodeHTMLStrict(match[0]);
|
|
6734
6739
|
if (decoded !== match[0]) {
|
|
6735
6740
|
if (!silent) {
|
|
6736
|
-
const token
|
|
6741
|
+
const token = state.push('text_special', '', 0);
|
|
6737
6742
|
token.content = decoded;
|
|
6738
|
-
token.markup
|
|
6739
|
-
token.info
|
|
6743
|
+
token.markup = match[0];
|
|
6744
|
+
token.info = 'entity';
|
|
6740
6745
|
}
|
|
6741
6746
|
state.pos += match[0].length;
|
|
6742
6747
|
return true
|
|
@@ -6834,8 +6839,8 @@ function processDelimiters (delimiters) {
|
|
|
6834
6839
|
jumps[closerIdx] = closerIdx - openerIdx + lastJump;
|
|
6835
6840
|
jumps[openerIdx] = lastJump;
|
|
6836
6841
|
|
|
6837
|
-
closer.open
|
|
6838
|
-
opener.end
|
|
6842
|
+
closer.open = false;
|
|
6843
|
+
opener.end = closerIdx;
|
|
6839
6844
|
opener.close = false;
|
|
6840
6845
|
newMinOpenerIdx = -1;
|
|
6841
6846
|
// treat next token as start of run,
|
|
@@ -6921,18 +6926,18 @@ function fragments_join (state) {
|
|
|
6921
6926
|
// Parser rules
|
|
6922
6927
|
|
|
6923
6928
|
const _rules = [
|
|
6924
|
-
['text',
|
|
6925
|
-
['linkify',
|
|
6926
|
-
['newline',
|
|
6927
|
-
['escape',
|
|
6928
|
-
['backticks',
|
|
6929
|
-
['strikethrough',
|
|
6930
|
-
['emphasis',
|
|
6931
|
-
['link',
|
|
6932
|
-
['image',
|
|
6933
|
-
['autolink',
|
|
6934
|
-
['html_inline',
|
|
6935
|
-
['entity',
|
|
6929
|
+
['text', text],
|
|
6930
|
+
['linkify', linkify],
|
|
6931
|
+
['newline', newline],
|
|
6932
|
+
['escape', escape$3],
|
|
6933
|
+
['backticks', backtick],
|
|
6934
|
+
['strikethrough', r_strikethrough.tokenize],
|
|
6935
|
+
['emphasis', r_emphasis.tokenize],
|
|
6936
|
+
['link', link$1],
|
|
6937
|
+
['image', image],
|
|
6938
|
+
['autolink', autolink],
|
|
6939
|
+
['html_inline', html_inline],
|
|
6940
|
+
['entity', entity]
|
|
6936
6941
|
];
|
|
6937
6942
|
|
|
6938
6943
|
// `rule2` ruleset was created specifically for emphasis/strikethrough
|
|
@@ -6941,12 +6946,12 @@ const _rules = [
|
|
|
6941
6946
|
// Don't use this for anything except pairs (plugins working with `balance_pairs`).
|
|
6942
6947
|
//
|
|
6943
6948
|
const _rules2 = [
|
|
6944
|
-
['balance_pairs',
|
|
6945
|
-
['strikethrough',
|
|
6946
|
-
['emphasis',
|
|
6949
|
+
['balance_pairs', link_pairs],
|
|
6950
|
+
['strikethrough', r_strikethrough.postProcess],
|
|
6951
|
+
['emphasis', r_emphasis.postProcess],
|
|
6947
6952
|
// rules for pairs separate '**' into its own text tokens, which may be left unused,
|
|
6948
6953
|
// rule below merges unused segments back with the rest of the text
|
|
6949
|
-
['fragments_join',
|
|
6954
|
+
['fragments_join', fragments_join]
|
|
6950
6955
|
];
|
|
6951
6956
|
|
|
6952
6957
|
/**
|
|
@@ -7111,7 +7116,7 @@ function reFactory (opts) {
|
|
|
7111
7116
|
// All possible word characters (everything without punctuation, spaces & controls)
|
|
7112
7117
|
// Defined via punctuation & spaces to save space
|
|
7113
7118
|
// Should be something like \p{\L\N\S\M} (\w but without `_`)
|
|
7114
|
-
re.src_pseudo_letter =
|
|
7119
|
+
re.src_pseudo_letter = `(?:(?!${text_separators}|${re.src_ZPCc})${re.src_Any})`;
|
|
7115
7120
|
// The same as abothe but without [0-9]
|
|
7116
7121
|
// var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';
|
|
7117
7122
|
|
|
@@ -7120,7 +7125,9 @@ function reFactory (opts) {
|
|
|
7120
7125
|
'(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
|
|
7121
7126
|
|
|
7122
7127
|
// Prohibit any of "@/[]()" in user/pass to avoid wrong domain fetch.
|
|
7123
|
-
|
|
7128
|
+
// Length is capped to exclude possible rescans till the end and avoid O(n^2)
|
|
7129
|
+
// DoS. No standard limit, just take something reasonable.
|
|
7130
|
+
re.src_auth = `(?:(?:(?!${re.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`;
|
|
7124
7131
|
|
|
7125
7132
|
re.src_port =
|
|
7126
7133
|
|
|
@@ -7128,23 +7135,23 @@ function reFactory (opts) {
|
|
|
7128
7135
|
|
|
7129
7136
|
re.src_host_terminator =
|
|
7130
7137
|
|
|
7131
|
-
|
|
7132
|
-
|
|
7138
|
+
`(?=$|${text_separators}|${re.src_ZPCc})` +
|
|
7139
|
+
`(?!${opts['---'] ? '-(?!--)|' : '-|'}_|:\\d|\\.-|\\.(?!$|${re.src_ZPCc}))`;
|
|
7133
7140
|
|
|
7134
7141
|
re.src_path =
|
|
7135
7142
|
|
|
7136
7143
|
'(?:' +
|
|
7137
7144
|
'[/?#]' +
|
|
7138
7145
|
'(?:' +
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7146
|
+
`(?!${re.src_ZCc}|${text_separators}|[()[\\]{}.,"'?!\\-;]).|` +
|
|
7147
|
+
`\\[(?:(?!${re.src_ZCc}|\\]).)*\\]|` +
|
|
7148
|
+
`\\((?:(?!${re.src_ZCc}|[)]).)*\\)|` +
|
|
7149
|
+
`\\{(?:(?!${re.src_ZCc}|[}]).)*\\}|` +
|
|
7150
|
+
`\\"(?:(?!${re.src_ZCc}|["]).)+\\"|` +
|
|
7151
|
+
`\\'(?:(?!${re.src_ZCc}|[']).)+\\'|` +
|
|
7145
7152
|
|
|
7146
7153
|
// allow `I'm_king` if no pair found
|
|
7147
|
-
|
|
7154
|
+
`\\'(?=${re.src_pseudo_letter}|[-])|` +
|
|
7148
7155
|
|
|
7149
7156
|
// google has many dots in "google search" links (#66, #81).
|
|
7150
7157
|
// github has ... in commit range links,
|
|
@@ -7156,30 +7163,32 @@ function reFactory (opts) {
|
|
|
7156
7163
|
// until more examples found.
|
|
7157
7164
|
'\\.{2,}[a-zA-Z0-9%/&]|' +
|
|
7158
7165
|
|
|
7159
|
-
|
|
7166
|
+
`\\.(?!${re.src_ZCc}|[.]|$)|` +
|
|
7160
7167
|
(opts['---']
|
|
7161
7168
|
? '\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate
|
|
7162
7169
|
: '\\-+|'
|
|
7163
7170
|
) +
|
|
7164
7171
|
// allow `,,,` in paths
|
|
7165
|
-
|
|
7172
|
+
`,(?!${re.src_ZCc}|$)|` +
|
|
7166
7173
|
|
|
7167
7174
|
// allow `;` if not followed by space-like char
|
|
7168
|
-
|
|
7175
|
+
`;(?!${re.src_ZCc}|$)|` +
|
|
7169
7176
|
|
|
7170
7177
|
// allow `!!!` in paths, but not at the end
|
|
7171
|
-
|
|
7178
|
+
`\\!+(?!${re.src_ZCc}|[!]|$)|` +
|
|
7172
7179
|
|
|
7173
|
-
|
|
7180
|
+
`\\?(?!${re.src_ZCc}|[?]|$)` +
|
|
7174
7181
|
')+' +
|
|
7175
7182
|
'|\\/' +
|
|
7176
7183
|
')?';
|
|
7177
7184
|
|
|
7178
7185
|
// Allow anything in markdown spec, forbid quote (") at the first position
|
|
7179
7186
|
// because emails enclosed in quotes are far more common
|
|
7187
|
+
// Max name length capped to 64 chars (RFC 5321). This also prevents O(n^2)
|
|
7188
|
+
// rescans to the end on inputs like `mailto:mailto:...`
|
|
7180
7189
|
re.src_email_name =
|
|
7181
7190
|
|
|
7182
|
-
'[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]
|
|
7191
|
+
'[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}';
|
|
7183
7192
|
|
|
7184
7193
|
re.src_xn =
|
|
7185
7194
|
|
|
@@ -7194,7 +7203,7 @@ function reFactory (opts) {
|
|
|
7194
7203
|
'(?:' +
|
|
7195
7204
|
re.src_xn +
|
|
7196
7205
|
'|' +
|
|
7197
|
-
re.src_pseudo_letter
|
|
7206
|
+
`${re.src_pseudo_letter}{1,63}` +
|
|
7198
7207
|
')';
|
|
7199
7208
|
|
|
7200
7209
|
re.src_domain =
|
|
@@ -7202,9 +7211,9 @@ function reFactory (opts) {
|
|
|
7202
7211
|
'(?:' +
|
|
7203
7212
|
re.src_xn +
|
|
7204
7213
|
'|' +
|
|
7205
|
-
|
|
7214
|
+
`(?:${re.src_pseudo_letter})` +
|
|
7206
7215
|
'|' +
|
|
7207
|
-
|
|
7216
|
+
`(?:${re.src_pseudo_letter}(?:-|${re.src_pseudo_letter}){0,61}${re.src_pseudo_letter})` +
|
|
7208
7217
|
')';
|
|
7209
7218
|
|
|
7210
7219
|
re.src_host =
|
|
@@ -7213,7 +7222,7 @@ function reFactory (opts) {
|
|
|
7213
7222
|
// Don't need IP check, because digits are already allowed in normal domain names
|
|
7214
7223
|
// src_ip4 +
|
|
7215
7224
|
// '|' +
|
|
7216
|
-
|
|
7225
|
+
`(?:(?:(?:${re.src_domain})\\.)*${re.src_domain})`/* _root */ +
|
|
7217
7226
|
')';
|
|
7218
7227
|
|
|
7219
7228
|
re.tpl_host_fuzzy =
|
|
@@ -7221,12 +7230,12 @@ function reFactory (opts) {
|
|
|
7221
7230
|
'(?:' +
|
|
7222
7231
|
re.src_ip4 +
|
|
7223
7232
|
'|' +
|
|
7224
|
-
|
|
7233
|
+
`(?:(?:(?:${re.src_domain})\\.)+(?:%TLDS%))` +
|
|
7225
7234
|
')';
|
|
7226
7235
|
|
|
7227
7236
|
re.tpl_host_no_ip_fuzzy =
|
|
7228
7237
|
|
|
7229
|
-
|
|
7238
|
+
`(?:(?:(?:${re.src_domain})\\.)+(?:%TLDS%))`;
|
|
7230
7239
|
|
|
7231
7240
|
re.src_host_strict =
|
|
7232
7241
|
|
|
@@ -7255,24 +7264,24 @@ function reFactory (opts) {
|
|
|
7255
7264
|
// Rude test fuzzy links by host, for quick deny
|
|
7256
7265
|
re.tpl_host_fuzzy_test =
|
|
7257
7266
|
|
|
7258
|
-
|
|
7267
|
+
`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${re.src_ZPCc}|>|$))`;
|
|
7259
7268
|
|
|
7260
7269
|
re.tpl_email_fuzzy =
|
|
7261
7270
|
|
|
7262
|
-
|
|
7263
|
-
|
|
7271
|
+
`(^|${text_separators}|"|\\(|${re.src_ZCc})` +
|
|
7272
|
+
`(${re.src_email_name}@${re.tpl_host_fuzzy_strict})`;
|
|
7264
7273
|
|
|
7265
7274
|
re.tpl_link_fuzzy =
|
|
7266
7275
|
// Fuzzy link can't be prepended with .:/\- and non punctuation.
|
|
7267
7276
|
// but can start with > (markdown blockquote)
|
|
7268
|
-
|
|
7269
|
-
|
|
7277
|
+
`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${re.src_ZPCc}))` +
|
|
7278
|
+
`((?![$+<=>^\`|\uff5c])${re.tpl_host_port_fuzzy_strict}${re.src_path})`;
|
|
7270
7279
|
|
|
7271
7280
|
re.tpl_link_no_ip_fuzzy =
|
|
7272
7281
|
// Fuzzy link can't be prepended with .:/\- and non punctuation.
|
|
7273
7282
|
// but can start with > (markdown blockquote)
|
|
7274
|
-
|
|
7275
|
-
|
|
7283
|
+
`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${re.src_ZPCc}))` +
|
|
7284
|
+
`((?![$+<=>^\`|\uff5c])${re.tpl_host_port_no_ip_fuzzy_strict}${re.src_path})`;
|
|
7276
7285
|
|
|
7277
7286
|
return re
|
|
7278
7287
|
}
|
|
@@ -7328,7 +7337,7 @@ const defaultSchemas = {
|
|
|
7328
7337
|
if (!self.re.http) {
|
|
7329
7338
|
// compile lazily, because "host"-containing variables can change on tlds update.
|
|
7330
7339
|
self.re.http = new RegExp(
|
|
7331
|
-
|
|
7340
|
+
`^\\/\\/${self.re.src_auth}${self.re.src_host_port_strict}${self.re.src_path}`, 'i'
|
|
7332
7341
|
);
|
|
7333
7342
|
}
|
|
7334
7343
|
if (self.re.http.test(tail)) {
|
|
@@ -7350,7 +7359,7 @@ const defaultSchemas = {
|
|
|
7350
7359
|
self.re.src_auth +
|
|
7351
7360
|
// Don't allow single-level domains, because of false positives like '//test'
|
|
7352
7361
|
// with code comments
|
|
7353
|
-
|
|
7362
|
+
`(?:localhost|(?:(?:${self.re.src_domain})\\.)+${self.re.src_domain_root})` +
|
|
7354
7363
|
self.re.src_port +
|
|
7355
7364
|
self.re.src_host_terminator +
|
|
7356
7365
|
self.re.src_path,
|
|
@@ -7374,7 +7383,7 @@ const defaultSchemas = {
|
|
|
7374
7383
|
|
|
7375
7384
|
if (!self.re.mailto) {
|
|
7376
7385
|
self.re.mailto = new RegExp(
|
|
7377
|
-
|
|
7386
|
+
`^${self.re.src_email_name}@${self.re.src_host_strict}`, 'i'
|
|
7378
7387
|
);
|
|
7379
7388
|
}
|
|
7380
7389
|
if (self.re.mailto.test(tail)) {
|
|
@@ -7386,7 +7395,6 @@ const defaultSchemas = {
|
|
|
7386
7395
|
};
|
|
7387
7396
|
|
|
7388
7397
|
// RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)
|
|
7389
|
-
/* eslint-disable-next-line max-len */
|
|
7390
7398
|
const tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
|
|
7391
7399
|
|
|
7392
7400
|
// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
|
|
@@ -7446,7 +7454,7 @@ function compile (self) {
|
|
|
7446
7454
|
self.__compiled__ = {}; // Reset compiled data
|
|
7447
7455
|
|
|
7448
7456
|
function schemaError (name, val) {
|
|
7449
|
-
throw new Error(
|
|
7457
|
+
throw new Error(`(LinkifyIt) Invalid schema "${name}": ${val}`)
|
|
7450
7458
|
}
|
|
7451
7459
|
|
|
7452
7460
|
Object.keys(self.__schemas__).forEach(function (name) {
|
|
@@ -7520,12 +7528,12 @@ function compile (self) {
|
|
|
7520
7528
|
.map(escapeRE)
|
|
7521
7529
|
.join('|');
|
|
7522
7530
|
// (?!_) cause 1.5x slowdown
|
|
7523
|
-
self.re.schema_test = RegExp(
|
|
7524
|
-
self.re.schema_search = RegExp(
|
|
7525
|
-
self.re.schema_at_start = RegExp(
|
|
7531
|
+
self.re.schema_test = RegExp(`(^|(?!_)(?:[><\uff5c]|${re.src_ZPCc}))(${slist})`, 'i');
|
|
7532
|
+
self.re.schema_search = RegExp(`(^|(?!_)(?:[><\uff5c]|${re.src_ZPCc}))(${slist})`, 'ig');
|
|
7533
|
+
self.re.schema_at_start = RegExp(`^${self.re.schema_search.source}`, 'i');
|
|
7526
7534
|
|
|
7527
7535
|
self.re.pretest = RegExp(
|
|
7528
|
-
|
|
7536
|
+
`(${self.re.schema_test.source})|(${self.re.host_fuzzy_test.source})|@`,
|
|
7529
7537
|
'i'
|
|
7530
7538
|
);
|
|
7531
7539
|
}
|
|
@@ -7906,10 +7914,10 @@ LinkifyIt.prototype.normalize = function normalize (match) {
|
|
|
7906
7914
|
// Do minimal possible changes by default. Need to collect feedback prior
|
|
7907
7915
|
// to move forward https://github.com/markdown-it/linkify-it/issues/1
|
|
7908
7916
|
|
|
7909
|
-
if (!match.schema) { match.url =
|
|
7917
|
+
if (!match.schema) { match.url = `http://${match.url}`; }
|
|
7910
7918
|
|
|
7911
7919
|
if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {
|
|
7912
|
-
match.url =
|
|
7920
|
+
match.url = `mailto:${match.url}`;
|
|
7913
7921
|
}
|
|
7914
7922
|
};
|
|
7915
7923
|
|
|
@@ -15562,7 +15570,10 @@ function requireStat () {
|
|
|
15562
15570
|
try {
|
|
15563
15571
|
destStat = await fs.stat(destParent, { bigint: true });
|
|
15564
15572
|
} catch (err) {
|
|
15565
|
-
|
|
15573
|
+
// The destination parent does not exist yet, but a deeper ancestor might
|
|
15574
|
+
// (e.g. when it is a symlink into the source tree). Keep walking up so the
|
|
15575
|
+
// self-subdirectory check is not bypassed.
|
|
15576
|
+
if (err.code === 'ENOENT') return checkParentPaths(src, srcStat, destParent, funcName)
|
|
15566
15577
|
throw err
|
|
15567
15578
|
}
|
|
15568
15579
|
|
|
@@ -15581,7 +15592,10 @@ function requireStat () {
|
|
|
15581
15592
|
try {
|
|
15582
15593
|
destStat = fs.statSync(destParent, { bigint: true });
|
|
15583
15594
|
} catch (err) {
|
|
15584
|
-
|
|
15595
|
+
// The destination parent does not exist yet, but a deeper ancestor might
|
|
15596
|
+
// (e.g. when it is a symlink into the source tree). Keep walking up so the
|
|
15597
|
+
// self-subdirectory check is not bypassed.
|
|
15598
|
+
if (err.code === 'ENOENT') return checkParentPathsSync(src, srcStat, destParent, funcName)
|
|
15585
15599
|
throw err
|
|
15586
15600
|
}
|
|
15587
15601
|
if (areIdentical(srcStat, destStat)) {
|
|
@@ -17056,7 +17070,7 @@ const getPathWithDefaults = (data, defaultData, key) => {
|
|
|
17056
17070
|
const deepExtend = (target, source, overwrite) => {
|
|
17057
17071
|
for (const prop in source) {
|
|
17058
17072
|
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
17059
|
-
if (prop
|
|
17073
|
+
if (Object.prototype.hasOwnProperty.call(target, prop)) {
|
|
17060
17074
|
if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
|
|
17061
17075
|
if (overwrite) target[prop] = source[prop];
|
|
17062
17076
|
} else {
|
|
@@ -70497,4 +70511,4 @@ var yaml = /*#__PURE__*/Object.freeze({
|
|
|
70497
70511
|
});
|
|
70498
70512
|
|
|
70499
70513
|
export { HighlightJS as H, MarkdownIt as M, Ze$b as Z, resolveConfig as a, createTwoFilesPatch$1 as b, createSyncFn as c, dedent$1 as d, deflist_plugin as e, format2 as f, closest as g, distance as h, fm$3 as i, isCI as j, cliProgress as k, tinylr as l, moduleImporter as m, createInstance as n, fse as o, inter as p, runAsWorker as r, ts$9 as t, watch$1 as w };
|
|
70500
|
-
//# sourceMappingURL=vendor-
|
|
70514
|
+
//# sourceMappingURL=vendor-B2TWdfAe.mjs.map
|