@subiz/widget-v4 4.1.41 → 4.1.43
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/compiled_src/call/css.js +1 -2
- package/compiled_src/chatbox/css.js +1 -2
- package/compiled_src/common.js +1 -2
- package/compiled_src/contact/contact.js +2 -3
- package/compiled_src/contact/css.js +1 -2
- package/compiled_src/lib.js +1 -2
- package/compiled_src/notif/css.js +1 -2
- package/compiled_src/popup/css.js +1 -2
- package/compiled_src/popup/tick.core.commonjs.js +1 -2
- package/compiled_src/store/api.js +2 -3
- package/compiled_src/store/store.js +2 -4
- package/compiled_src/util/common.js +11 -21
- package/compiled_src/util/index.js +1 -2
- package/dist/{18a3a577516.362.js → 18afb30d167.362.js} +1 -1
- package/dist/18afb30d167.441.js +1 -0
- package/dist/{18a3a577516.782.js → 18afb30d167.782.js} +1 -1
- package/dist/18afb30d167.app.js +1 -0
- package/dist/{18a3a577516.index.html → 18afb30d167.index.html} +1 -1
- package/dist/{18a3a577516.library.html → 18afb30d167.library.html} +1 -1
- package/dist/18afb30d167.library.js +1 -0
- package/dist/{18a3a577516.preview.html → 18afb30d167.preview.html} +1 -1
- package/dist/18afb30d167.preview.js +1 -0
- package/dist/18afb30d167.screenshoot.js +1 -0
- package/dist/18afb30d167.webview.js +1 -0
- package/dist/362.js +1 -1
- package/dist/441.js +46 -325
- package/dist/782.js +1 -1
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +36 -14
- package/package.json +8 -8
- package/src/store/api.js +4 -2
- package/src/store/store.js +2 -6
- package/src/util/common.js +1 -1
- package/dist/18a3a577516.441.js +0 -1
- package/dist/18a3a577516.app.js +0 -1
- package/dist/18a3a577516.library.js +0 -1
- package/dist/18a3a577516.preview.js +0 -1
- package/dist/18a3a577516.screenshoot.js +0 -1
- package/dist/18a3a577516.webview.js +0 -1
- /package/dist/{18a3a577516.132.js → 18afb30d167.132.js} +0 -0
- /package/dist/{18a3a577516.178.js → 18afb30d167.178.js} +0 -0
- /package/dist/{18a3a577516.213.js → 18afb30d167.213.js} +0 -0
- /package/dist/{18a3a577516.335.js → 18afb30d167.335.js} +0 -0
- /package/dist/{18a3a577516.605.js → 18afb30d167.605.js} +0 -0
- /package/dist/{18a3a577516.678.js → 18afb30d167.678.js} +0 -0
package/dist/441.js
CHANGED
|
@@ -11,7 +11,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11
11
|
/* harmony export */ Marked: () => (/* binding */ Marked),
|
|
12
12
|
/* harmony export */ Parser: () => (/* binding */ _Parser),
|
|
13
13
|
/* harmony export */ Renderer: () => (/* binding */ _Renderer),
|
|
14
|
-
/* harmony export */ Slugger: () => (/* binding */ _Slugger),
|
|
15
14
|
/* harmony export */ TextRenderer: () => (/* binding */ _TextRenderer),
|
|
16
15
|
/* harmony export */ Tokenizer: () => (/* binding */ _Tokenizer),
|
|
17
16
|
/* harmony export */ defaults: () => (/* binding */ _defaults),
|
|
@@ -27,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27
26
|
/* harmony export */ walkTokens: () => (/* binding */ walkTokens)
|
|
28
27
|
/* harmony export */ });
|
|
29
28
|
/**
|
|
30
|
-
* marked
|
|
29
|
+
* marked v9.0.3 - a markdown parser
|
|
31
30
|
* Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
|
|
32
31
|
* https://github.com/markedjs/marked
|
|
33
32
|
*/
|
|
@@ -43,25 +42,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43
42
|
function _getDefaults() {
|
|
44
43
|
return {
|
|
45
44
|
async: false,
|
|
46
|
-
baseUrl: null,
|
|
47
45
|
breaks: false,
|
|
48
46
|
extensions: null,
|
|
49
47
|
gfm: true,
|
|
50
|
-
headerIds: false,
|
|
51
|
-
headerPrefix: '',
|
|
52
|
-
highlight: null,
|
|
53
48
|
hooks: null,
|
|
54
|
-
langPrefix: 'language-',
|
|
55
|
-
mangle: false,
|
|
56
49
|
pedantic: false,
|
|
57
50
|
renderer: null,
|
|
58
|
-
sanitize: false,
|
|
59
|
-
sanitizer: null,
|
|
60
51
|
silent: false,
|
|
61
|
-
smartypants: false,
|
|
62
52
|
tokenizer: null,
|
|
63
|
-
walkTokens: null
|
|
64
|
-
xhtml: false
|
|
53
|
+
walkTokens: null
|
|
65
54
|
};
|
|
66
55
|
}
|
|
67
56
|
let _defaults = _getDefaults();
|
|
@@ -129,26 +118,7 @@ function edit(regex, opt) {
|
|
|
129
118
|
};
|
|
130
119
|
return obj;
|
|
131
120
|
}
|
|
132
|
-
|
|
133
|
-
const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
|
134
|
-
function cleanUrl(sanitize, base, href) {
|
|
135
|
-
if (sanitize) {
|
|
136
|
-
let prot;
|
|
137
|
-
try {
|
|
138
|
-
prot = decodeURIComponent(unescape(href))
|
|
139
|
-
.replace(nonWordAndColonTest, '')
|
|
140
|
-
.toLowerCase();
|
|
141
|
-
}
|
|
142
|
-
catch (e) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (base && !originIndependentUrl.test(href)) {
|
|
150
|
-
href = resolveUrl(base, href);
|
|
151
|
-
}
|
|
121
|
+
function cleanUrl(href) {
|
|
152
122
|
try {
|
|
153
123
|
href = encodeURI(href).replace(/%25/g, '%');
|
|
154
124
|
}
|
|
@@ -157,40 +127,6 @@ function cleanUrl(sanitize, base, href) {
|
|
|
157
127
|
}
|
|
158
128
|
return href;
|
|
159
129
|
}
|
|
160
|
-
const baseUrls = {};
|
|
161
|
-
const justDomain = /^[^:]+:\/*[^/]*$/;
|
|
162
|
-
const protocol = /^([^:]+:)[\s\S]*$/;
|
|
163
|
-
const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
|
|
164
|
-
function resolveUrl(base, href) {
|
|
165
|
-
if (!baseUrls[' ' + base]) {
|
|
166
|
-
// we can ignore everything in base after the last slash of its path component,
|
|
167
|
-
// but we might need to add _that_
|
|
168
|
-
// https://tools.ietf.org/html/rfc3986#section-3
|
|
169
|
-
if (justDomain.test(base)) {
|
|
170
|
-
baseUrls[' ' + base] = base + '/';
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
baseUrls[' ' + base] = rtrim(base, '/', true);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
base = baseUrls[' ' + base];
|
|
177
|
-
const relativeBase = base.indexOf(':') === -1;
|
|
178
|
-
if (href.substring(0, 2) === '//') {
|
|
179
|
-
if (relativeBase) {
|
|
180
|
-
return href;
|
|
181
|
-
}
|
|
182
|
-
return base.replace(protocol, '$1') + href;
|
|
183
|
-
}
|
|
184
|
-
else if (href.charAt(0) === '/') {
|
|
185
|
-
if (relativeBase) {
|
|
186
|
-
return href;
|
|
187
|
-
}
|
|
188
|
-
return base.replace(domain, '$1') + href;
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
return base + href;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
130
|
const noopTest = { exec: () => null };
|
|
195
131
|
function splitCells(tableRow, count) {
|
|
196
132
|
// ensure that every cell-delimiting pipe has a space
|
|
@@ -284,35 +220,6 @@ function findClosingBracket(str, b) {
|
|
|
284
220
|
}
|
|
285
221
|
return -1;
|
|
286
222
|
}
|
|
287
|
-
function checkDeprecations(opt, callback) {
|
|
288
|
-
if (!opt || opt.silent) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
if (callback) {
|
|
292
|
-
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');
|
|
293
|
-
}
|
|
294
|
-
if (opt.sanitize || opt.sanitizer) {
|
|
295
|
-
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');
|
|
296
|
-
}
|
|
297
|
-
if (opt.highlight || opt.langPrefix !== 'language-') {
|
|
298
|
-
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.');
|
|
299
|
-
}
|
|
300
|
-
if (opt.mangle) {
|
|
301
|
-
console.warn('marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.');
|
|
302
|
-
}
|
|
303
|
-
if (opt.baseUrl) {
|
|
304
|
-
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.');
|
|
305
|
-
}
|
|
306
|
-
if (opt.smartypants) {
|
|
307
|
-
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.');
|
|
308
|
-
}
|
|
309
|
-
if (opt.xhtml) {
|
|
310
|
-
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.');
|
|
311
|
-
}
|
|
312
|
-
if (opt.headerIds || opt.headerPrefix) {
|
|
313
|
-
console.warn('marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.');
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
223
|
|
|
317
224
|
function outputLink(cap, link, raw, lexer) {
|
|
318
225
|
const href = link.href;
|
|
@@ -494,7 +401,7 @@ class _Tokenizer {
|
|
|
494
401
|
let indent = 0;
|
|
495
402
|
if (this.options.pedantic) {
|
|
496
403
|
indent = 2;
|
|
497
|
-
itemContents = line.
|
|
404
|
+
itemContents = line.trimStart();
|
|
498
405
|
}
|
|
499
406
|
else {
|
|
500
407
|
indent = cap[2].search(/[^ ]/); // Find first non-space char
|
|
@@ -599,9 +506,9 @@ class _Tokenizer {
|
|
|
599
506
|
list.raw += raw;
|
|
600
507
|
}
|
|
601
508
|
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
602
|
-
list.items[list.items.length - 1].raw = raw.
|
|
603
|
-
list.items[list.items.length - 1].text = itemContents.
|
|
604
|
-
list.raw = list.raw.
|
|
509
|
+
list.items[list.items.length - 1].raw = raw.trimEnd();
|
|
510
|
+
list.items[list.items.length - 1].text = itemContents.trimEnd();
|
|
511
|
+
list.raw = list.raw.trimEnd();
|
|
605
512
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
606
513
|
for (let i = 0; i < list.items.length; i++) {
|
|
607
514
|
this.lexer.state.top = false;
|
|
@@ -629,17 +536,9 @@ class _Tokenizer {
|
|
|
629
536
|
type: 'html',
|
|
630
537
|
block: true,
|
|
631
538
|
raw: cap[0],
|
|
632
|
-
pre:
|
|
633
|
-
&& (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
|
539
|
+
pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
|
|
634
540
|
text: cap[0]
|
|
635
541
|
};
|
|
636
|
-
if (this.options.sanitize) {
|
|
637
|
-
const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
|
|
638
|
-
const paragraph = token;
|
|
639
|
-
paragraph.type = 'paragraph';
|
|
640
|
-
paragraph.text = text;
|
|
641
|
-
paragraph.tokens = this.lexer.inline(text);
|
|
642
|
-
}
|
|
643
542
|
return token;
|
|
644
543
|
}
|
|
645
544
|
}
|
|
@@ -661,13 +560,17 @@ class _Tokenizer {
|
|
|
661
560
|
table(src) {
|
|
662
561
|
const cap = this.rules.block.table.exec(src);
|
|
663
562
|
if (cap) {
|
|
563
|
+
if (!/[:|]/.test(cap[2])) {
|
|
564
|
+
// delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
664
567
|
const item = {
|
|
665
568
|
type: 'table',
|
|
666
569
|
raw: cap[0],
|
|
667
570
|
header: splitCells(cap[1]).map(c => {
|
|
668
571
|
return { text: c, tokens: [] };
|
|
669
572
|
}),
|
|
670
|
-
align: cap[2].replace(
|
|
573
|
+
align: cap[2].replace(/^\||\| *$/g, '').split('|'),
|
|
671
574
|
rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
|
|
672
575
|
};
|
|
673
576
|
if (item.header.length === item.align.length) {
|
|
@@ -777,18 +680,12 @@ class _Tokenizer {
|
|
|
777
680
|
this.lexer.state.inRawBlock = false;
|
|
778
681
|
}
|
|
779
682
|
return {
|
|
780
|
-
type:
|
|
781
|
-
? 'text'
|
|
782
|
-
: 'html',
|
|
683
|
+
type: 'html',
|
|
783
684
|
raw: cap[0],
|
|
784
685
|
inLink: this.lexer.state.inLink,
|
|
785
686
|
inRawBlock: this.lexer.state.inRawBlock,
|
|
786
687
|
block: false,
|
|
787
|
-
text:
|
|
788
|
-
? (this.options.sanitizer
|
|
789
|
-
? this.options.sanitizer(cap[0])
|
|
790
|
-
: escape(cap[0]))
|
|
791
|
-
: cap[0]
|
|
688
|
+
text: cap[0]
|
|
792
689
|
};
|
|
793
690
|
}
|
|
794
691
|
}
|
|
@@ -879,7 +776,7 @@ class _Tokenizer {
|
|
|
879
776
|
const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
|
880
777
|
endReg.lastIndex = 0;
|
|
881
778
|
// Clip maskedSrc to same section of string as src (move to lexer?)
|
|
882
|
-
maskedSrc = maskedSrc.slice(-1 * src.length +
|
|
779
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + match[0].length - 1);
|
|
883
780
|
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
884
781
|
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
885
782
|
if (!rDelim)
|
|
@@ -959,12 +856,12 @@ class _Tokenizer {
|
|
|
959
856
|
};
|
|
960
857
|
}
|
|
961
858
|
}
|
|
962
|
-
autolink(src
|
|
859
|
+
autolink(src) {
|
|
963
860
|
const cap = this.rules.inline.autolink.exec(src);
|
|
964
861
|
if (cap) {
|
|
965
862
|
let text, href;
|
|
966
863
|
if (cap[2] === '@') {
|
|
967
|
-
text = escape(
|
|
864
|
+
text = escape(cap[1]);
|
|
968
865
|
href = 'mailto:' + text;
|
|
969
866
|
}
|
|
970
867
|
else {
|
|
@@ -986,12 +883,12 @@ class _Tokenizer {
|
|
|
986
883
|
};
|
|
987
884
|
}
|
|
988
885
|
}
|
|
989
|
-
url(src
|
|
886
|
+
url(src) {
|
|
990
887
|
let cap;
|
|
991
888
|
if (cap = this.rules.inline.url.exec(src)) {
|
|
992
889
|
let text, href;
|
|
993
890
|
if (cap[2] === '@') {
|
|
994
|
-
text = escape(
|
|
891
|
+
text = escape(cap[0]);
|
|
995
892
|
href = 'mailto:' + text;
|
|
996
893
|
}
|
|
997
894
|
else {
|
|
@@ -1024,15 +921,15 @@ class _Tokenizer {
|
|
|
1024
921
|
};
|
|
1025
922
|
}
|
|
1026
923
|
}
|
|
1027
|
-
inlineText(src
|
|
924
|
+
inlineText(src) {
|
|
1028
925
|
const cap = this.rules.inline.text.exec(src);
|
|
1029
926
|
if (cap) {
|
|
1030
927
|
let text;
|
|
1031
928
|
if (this.lexer.state.inRawBlock) {
|
|
1032
|
-
text =
|
|
929
|
+
text = cap[0];
|
|
1033
930
|
}
|
|
1034
931
|
else {
|
|
1035
|
-
text = escape(
|
|
932
|
+
text = escape(cap[0]);
|
|
1036
933
|
}
|
|
1037
934
|
return {
|
|
1038
935
|
type: 'text',
|
|
@@ -1068,7 +965,7 @@ const block = {
|
|
|
1068
965
|
+ ')',
|
|
1069
966
|
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
|
1070
967
|
table: noopTest,
|
|
1071
|
-
lheading: /^(
|
|
968
|
+
lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1072
969
|
// regex template, placeholders will be replaced according to different paragraph
|
|
1073
970
|
// interruption rules of commonmark and the original markdown spec:
|
|
1074
971
|
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
@@ -1127,8 +1024,8 @@ block.normal = { ...block };
|
|
|
1127
1024
|
*/
|
|
1128
1025
|
block.gfm = {
|
|
1129
1026
|
...block.normal,
|
|
1130
|
-
table: '^ *([^\\n ]
|
|
1131
|
-
+ ' {0,3}(?:\\| *)
|
|
1027
|
+
table: '^ *([^\\n ].*)\\n' // Header
|
|
1028
|
+
+ ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
|
|
1132
1029
|
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
1133
1030
|
};
|
|
1134
1031
|
block.gfm.table = edit(block.gfm.table)
|
|
@@ -1320,39 +1217,6 @@ inline.breaks = {
|
|
|
1320
1217
|
.getRegex()
|
|
1321
1218
|
};
|
|
1322
1219
|
|
|
1323
|
-
/**
|
|
1324
|
-
* smartypants text replacement
|
|
1325
|
-
*/
|
|
1326
|
-
function smartypants(text) {
|
|
1327
|
-
return text
|
|
1328
|
-
// em-dashes
|
|
1329
|
-
.replace(/---/g, '\u2014')
|
|
1330
|
-
// en-dashes
|
|
1331
|
-
.replace(/--/g, '\u2013')
|
|
1332
|
-
// opening singles
|
|
1333
|
-
.replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
|
|
1334
|
-
// closing singles & apostrophes
|
|
1335
|
-
.replace(/'/g, '\u2019')
|
|
1336
|
-
// opening doubles
|
|
1337
|
-
.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
|
|
1338
|
-
// closing doubles
|
|
1339
|
-
.replace(/"/g, '\u201d')
|
|
1340
|
-
// ellipses
|
|
1341
|
-
.replace(/\.{3}/g, '\u2026');
|
|
1342
|
-
}
|
|
1343
|
-
/**
|
|
1344
|
-
* mangle email addresses
|
|
1345
|
-
*/
|
|
1346
|
-
function mangle(text) {
|
|
1347
|
-
let out = '';
|
|
1348
|
-
for (let i = 0; i < text.length; i++) {
|
|
1349
|
-
const ch = Math.random() > 0.5
|
|
1350
|
-
? 'x' + text.charCodeAt(i).toString(16)
|
|
1351
|
-
: text.charCodeAt(i).toString();
|
|
1352
|
-
out += '&#' + ch + ';';
|
|
1353
|
-
}
|
|
1354
|
-
return out;
|
|
1355
|
-
}
|
|
1356
1220
|
/**
|
|
1357
1221
|
* Block Lexer
|
|
1358
1222
|
*/
|
|
@@ -1726,13 +1590,13 @@ class _Lexer {
|
|
|
1726
1590
|
continue;
|
|
1727
1591
|
}
|
|
1728
1592
|
// autolink
|
|
1729
|
-
if (token = this.tokenizer.autolink(src
|
|
1593
|
+
if (token = this.tokenizer.autolink(src)) {
|
|
1730
1594
|
src = src.substring(token.raw.length);
|
|
1731
1595
|
tokens.push(token);
|
|
1732
1596
|
continue;
|
|
1733
1597
|
}
|
|
1734
1598
|
// url (gfm)
|
|
1735
|
-
if (!this.state.inLink && (token = this.tokenizer.url(src
|
|
1599
|
+
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
|
1736
1600
|
src = src.substring(token.raw.length);
|
|
1737
1601
|
tokens.push(token);
|
|
1738
1602
|
continue;
|
|
@@ -1754,7 +1618,7 @@ class _Lexer {
|
|
|
1754
1618
|
cutSrc = src.substring(0, startIndex + 1);
|
|
1755
1619
|
}
|
|
1756
1620
|
}
|
|
1757
|
-
if (token = this.tokenizer.inlineText(cutSrc
|
|
1621
|
+
if (token = this.tokenizer.inlineText(cutSrc)) {
|
|
1758
1622
|
src = src.substring(token.raw.length);
|
|
1759
1623
|
if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started
|
|
1760
1624
|
prevChar = token.raw.slice(-1);
|
|
@@ -1795,21 +1659,13 @@ class _Renderer {
|
|
|
1795
1659
|
}
|
|
1796
1660
|
code(code, infostring, escaped) {
|
|
1797
1661
|
const lang = (infostring || '').match(/^\S*/)?.[0];
|
|
1798
|
-
if (this.options.highlight) {
|
|
1799
|
-
const out = this.options.highlight(code, lang);
|
|
1800
|
-
if (out != null && out !== code) {
|
|
1801
|
-
escaped = true;
|
|
1802
|
-
code = out;
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
1662
|
code = code.replace(/\n$/, '') + '\n';
|
|
1806
1663
|
if (!lang) {
|
|
1807
1664
|
return '<pre><code>'
|
|
1808
1665
|
+ (escaped ? code : escape(code, true))
|
|
1809
1666
|
+ '</code></pre>\n';
|
|
1810
1667
|
}
|
|
1811
|
-
return '<pre><code class="'
|
|
1812
|
-
+ this.options.langPrefix
|
|
1668
|
+
return '<pre><code class="language-'
|
|
1813
1669
|
+ escape(lang)
|
|
1814
1670
|
+ '">'
|
|
1815
1671
|
+ (escaped ? code : escape(code, true))
|
|
@@ -1821,16 +1677,12 @@ class _Renderer {
|
|
|
1821
1677
|
html(html, block) {
|
|
1822
1678
|
return html;
|
|
1823
1679
|
}
|
|
1824
|
-
heading(text, level, raw
|
|
1825
|
-
if (this.options.headerIds) {
|
|
1826
|
-
const id = this.options.headerPrefix + slugger.slug(raw);
|
|
1827
|
-
return `<h${level} id="${id}">${text}</h${level}>\n`;
|
|
1828
|
-
}
|
|
1680
|
+
heading(text, level, raw) {
|
|
1829
1681
|
// ignore IDs
|
|
1830
1682
|
return `<h${level}>${text}</h${level}>\n`;
|
|
1831
1683
|
}
|
|
1832
1684
|
hr() {
|
|
1833
|
-
return
|
|
1685
|
+
return '<hr>\n';
|
|
1834
1686
|
}
|
|
1835
1687
|
list(body, ordered, start) {
|
|
1836
1688
|
const type = ordered ? 'ol' : 'ul';
|
|
@@ -1843,9 +1695,7 @@ class _Renderer {
|
|
|
1843
1695
|
checkbox(checked) {
|
|
1844
1696
|
return '<input '
|
|
1845
1697
|
+ (checked ? 'checked="" ' : '')
|
|
1846
|
-
+ 'disabled="" type="checkbox"'
|
|
1847
|
-
+ (this.options.xhtml ? ' /' : '')
|
|
1848
|
-
+ '> ';
|
|
1698
|
+
+ 'disabled="" type="checkbox">';
|
|
1849
1699
|
}
|
|
1850
1700
|
paragraph(text) {
|
|
1851
1701
|
return `<p>${text}</p>\n`;
|
|
@@ -1883,13 +1733,13 @@ class _Renderer {
|
|
|
1883
1733
|
return `<code>${text}</code>`;
|
|
1884
1734
|
}
|
|
1885
1735
|
br() {
|
|
1886
|
-
return
|
|
1736
|
+
return '<br>';
|
|
1887
1737
|
}
|
|
1888
1738
|
del(text) {
|
|
1889
1739
|
return `<del>${text}</del>`;
|
|
1890
1740
|
}
|
|
1891
1741
|
link(href, title, text) {
|
|
1892
|
-
const cleanHref = cleanUrl(
|
|
1742
|
+
const cleanHref = cleanUrl(href);
|
|
1893
1743
|
if (cleanHref === null) {
|
|
1894
1744
|
return text;
|
|
1895
1745
|
}
|
|
@@ -1902,7 +1752,7 @@ class _Renderer {
|
|
|
1902
1752
|
return out;
|
|
1903
1753
|
}
|
|
1904
1754
|
image(href, title, text) {
|
|
1905
|
-
const cleanHref = cleanUrl(
|
|
1755
|
+
const cleanHref = cleanUrl(href);
|
|
1906
1756
|
if (cleanHref === null) {
|
|
1907
1757
|
return text;
|
|
1908
1758
|
}
|
|
@@ -1911,7 +1761,7 @@ class _Renderer {
|
|
|
1911
1761
|
if (title) {
|
|
1912
1762
|
out += ` title="${title}"`;
|
|
1913
1763
|
}
|
|
1914
|
-
out +=
|
|
1764
|
+
out += '>';
|
|
1915
1765
|
return out;
|
|
1916
1766
|
}
|
|
1917
1767
|
text(text) {
|
|
@@ -1954,52 +1804,6 @@ class _TextRenderer {
|
|
|
1954
1804
|
}
|
|
1955
1805
|
}
|
|
1956
1806
|
|
|
1957
|
-
/**
|
|
1958
|
-
* Slugger generates header id
|
|
1959
|
-
*/
|
|
1960
|
-
class _Slugger {
|
|
1961
|
-
seen;
|
|
1962
|
-
constructor() {
|
|
1963
|
-
this.seen = {};
|
|
1964
|
-
}
|
|
1965
|
-
serialize(value) {
|
|
1966
|
-
return value
|
|
1967
|
-
.toLowerCase()
|
|
1968
|
-
.trim()
|
|
1969
|
-
// remove html tags
|
|
1970
|
-
.replace(/<[!\/a-z].*?>/ig, '')
|
|
1971
|
-
// remove unwanted chars
|
|
1972
|
-
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
|
|
1973
|
-
.replace(/\s/g, '-');
|
|
1974
|
-
}
|
|
1975
|
-
/**
|
|
1976
|
-
* Finds the next safe (unique) slug to use
|
|
1977
|
-
*/
|
|
1978
|
-
getNextSafeSlug(originalSlug, isDryRun) {
|
|
1979
|
-
let slug = originalSlug;
|
|
1980
|
-
let occurenceAccumulator = 0;
|
|
1981
|
-
if (this.seen.hasOwnProperty(slug)) {
|
|
1982
|
-
occurenceAccumulator = this.seen[originalSlug];
|
|
1983
|
-
do {
|
|
1984
|
-
occurenceAccumulator++;
|
|
1985
|
-
slug = originalSlug + '-' + occurenceAccumulator;
|
|
1986
|
-
} while (this.seen.hasOwnProperty(slug));
|
|
1987
|
-
}
|
|
1988
|
-
if (!isDryRun) {
|
|
1989
|
-
this.seen[originalSlug] = occurenceAccumulator;
|
|
1990
|
-
this.seen[slug] = 0;
|
|
1991
|
-
}
|
|
1992
|
-
return slug;
|
|
1993
|
-
}
|
|
1994
|
-
/**
|
|
1995
|
-
* Convert string to unique id
|
|
1996
|
-
*/
|
|
1997
|
-
slug(value, options = {}) {
|
|
1998
|
-
const slug = this.serialize(value);
|
|
1999
|
-
return this.getNextSafeSlug(slug, options.dryrun);
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
1807
|
/**
|
|
2004
1808
|
* Parsing & Compiling
|
|
2005
1809
|
*/
|
|
@@ -2007,14 +1811,12 @@ class _Parser {
|
|
|
2007
1811
|
options;
|
|
2008
1812
|
renderer;
|
|
2009
1813
|
textRenderer;
|
|
2010
|
-
slugger;
|
|
2011
1814
|
constructor(options) {
|
|
2012
1815
|
this.options = options || _defaults;
|
|
2013
1816
|
this.options.renderer = this.options.renderer || new _Renderer();
|
|
2014
1817
|
this.renderer = this.options.renderer;
|
|
2015
1818
|
this.renderer.options = this.options;
|
|
2016
1819
|
this.textRenderer = new _TextRenderer();
|
|
2017
|
-
this.slugger = new _Slugger();
|
|
2018
1820
|
}
|
|
2019
1821
|
/**
|
|
2020
1822
|
* Static Parse Method
|
|
@@ -2056,7 +1858,7 @@ class _Parser {
|
|
|
2056
1858
|
}
|
|
2057
1859
|
case 'heading': {
|
|
2058
1860
|
const headingToken = token;
|
|
2059
|
-
out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer))
|
|
1861
|
+
out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)));
|
|
2060
1862
|
continue;
|
|
2061
1863
|
}
|
|
2062
1864
|
case 'code': {
|
|
@@ -2114,12 +1916,12 @@ class _Parser {
|
|
|
2114
1916
|
else {
|
|
2115
1917
|
item.tokens.unshift({
|
|
2116
1918
|
type: 'text',
|
|
2117
|
-
text: checkbox
|
|
1919
|
+
text: checkbox + ' '
|
|
2118
1920
|
});
|
|
2119
1921
|
}
|
|
2120
1922
|
}
|
|
2121
1923
|
else {
|
|
2122
|
-
itemBody += checkbox;
|
|
1924
|
+
itemBody += checkbox + ' ';
|
|
2123
1925
|
}
|
|
2124
1926
|
}
|
|
2125
1927
|
itemBody += this.parse(item.tokens, loose);
|
|
@@ -2279,7 +2081,6 @@ class Marked {
|
|
|
2279
2081
|
Lexer = _Lexer;
|
|
2280
2082
|
lexer = _Lexer.lex;
|
|
2281
2083
|
Tokenizer = _Tokenizer;
|
|
2282
|
-
Slugger = _Slugger;
|
|
2283
2084
|
Hooks = _Hooks;
|
|
2284
2085
|
constructor(...args) {
|
|
2285
2086
|
this.use(...args);
|
|
@@ -2476,12 +2277,8 @@ class Marked {
|
|
|
2476
2277
|
return this;
|
|
2477
2278
|
}
|
|
2478
2279
|
#parseMarkdown(lexer, parser) {
|
|
2479
|
-
return (src,
|
|
2480
|
-
|
|
2481
|
-
callback = optOrCallback;
|
|
2482
|
-
optOrCallback = null;
|
|
2483
|
-
}
|
|
2484
|
-
const origOpt = { ...optOrCallback };
|
|
2280
|
+
return (src, options) => {
|
|
2281
|
+
const origOpt = { ...options };
|
|
2485
2282
|
const opt = { ...this.defaults, ...origOpt };
|
|
2486
2283
|
// Show warning if an extension set async to true but the parse was called with async: false
|
|
2487
2284
|
if (this.defaults.async === true && origOpt.async === false) {
|
|
@@ -2490,7 +2287,7 @@ class Marked {
|
|
|
2490
2287
|
}
|
|
2491
2288
|
opt.async = true;
|
|
2492
2289
|
}
|
|
2493
|
-
const throwError = this.#onError(!!opt.silent, !!opt.async
|
|
2290
|
+
const throwError = this.#onError(!!opt.silent, !!opt.async);
|
|
2494
2291
|
// throw error in case of non string input
|
|
2495
2292
|
if (typeof src === 'undefined' || src === null) {
|
|
2496
2293
|
return throwError(new Error('marked(): input parameter is undefined or null'));
|
|
@@ -2499,76 +2296,9 @@ class Marked {
|
|
|
2499
2296
|
return throwError(new Error('marked(): input parameter is of type '
|
|
2500
2297
|
+ Object.prototype.toString.call(src) + ', string expected'));
|
|
2501
2298
|
}
|
|
2502
|
-
checkDeprecations(opt, callback);
|
|
2503
2299
|
if (opt.hooks) {
|
|
2504
2300
|
opt.hooks.options = opt;
|
|
2505
2301
|
}
|
|
2506
|
-
if (callback) {
|
|
2507
|
-
const resultCallback = callback;
|
|
2508
|
-
const highlight = opt.highlight;
|
|
2509
|
-
let tokens;
|
|
2510
|
-
try {
|
|
2511
|
-
if (opt.hooks) {
|
|
2512
|
-
src = opt.hooks.preprocess(src);
|
|
2513
|
-
}
|
|
2514
|
-
tokens = lexer(src, opt);
|
|
2515
|
-
}
|
|
2516
|
-
catch (e) {
|
|
2517
|
-
return throwError(e);
|
|
2518
|
-
}
|
|
2519
|
-
const done = (err) => {
|
|
2520
|
-
let out;
|
|
2521
|
-
if (!err) {
|
|
2522
|
-
try {
|
|
2523
|
-
if (opt.walkTokens) {
|
|
2524
|
-
this.walkTokens(tokens, opt.walkTokens);
|
|
2525
|
-
}
|
|
2526
|
-
out = parser(tokens, opt);
|
|
2527
|
-
if (opt.hooks) {
|
|
2528
|
-
out = opt.hooks.postprocess(out);
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
catch (e) {
|
|
2532
|
-
err = e;
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
opt.highlight = highlight;
|
|
2536
|
-
return err
|
|
2537
|
-
? throwError(err)
|
|
2538
|
-
: resultCallback(null, out);
|
|
2539
|
-
};
|
|
2540
|
-
if (!highlight || highlight.length < 3) {
|
|
2541
|
-
return done();
|
|
2542
|
-
}
|
|
2543
|
-
delete opt.highlight;
|
|
2544
|
-
if (!tokens.length)
|
|
2545
|
-
return done();
|
|
2546
|
-
let pending = 0;
|
|
2547
|
-
this.walkTokens(tokens, (token) => {
|
|
2548
|
-
if (token.type === 'code') {
|
|
2549
|
-
pending++;
|
|
2550
|
-
setTimeout(() => {
|
|
2551
|
-
highlight(token.text, token.lang, (err, code) => {
|
|
2552
|
-
if (err) {
|
|
2553
|
-
return done(err);
|
|
2554
|
-
}
|
|
2555
|
-
if (code != null && code !== token.text) {
|
|
2556
|
-
token.text = code;
|
|
2557
|
-
token.escaped = true;
|
|
2558
|
-
}
|
|
2559
|
-
pending--;
|
|
2560
|
-
if (pending === 0) {
|
|
2561
|
-
done();
|
|
2562
|
-
}
|
|
2563
|
-
});
|
|
2564
|
-
}, 0);
|
|
2565
|
-
}
|
|
2566
|
-
});
|
|
2567
|
-
if (pending === 0) {
|
|
2568
|
-
done();
|
|
2569
|
-
}
|
|
2570
|
-
return;
|
|
2571
|
-
}
|
|
2572
2302
|
if (opt.async) {
|
|
2573
2303
|
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)
|
|
2574
2304
|
.then(src => lexer(src, opt))
|
|
@@ -2596,7 +2326,7 @@ class Marked {
|
|
|
2596
2326
|
}
|
|
2597
2327
|
};
|
|
2598
2328
|
}
|
|
2599
|
-
#onError(silent, async
|
|
2329
|
+
#onError(silent, async) {
|
|
2600
2330
|
return (e) => {
|
|
2601
2331
|
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
2602
2332
|
if (silent) {
|
|
@@ -2606,27 +2336,19 @@ class Marked {
|
|
|
2606
2336
|
if (async) {
|
|
2607
2337
|
return Promise.resolve(msg);
|
|
2608
2338
|
}
|
|
2609
|
-
if (callback) {
|
|
2610
|
-
callback(null, msg);
|
|
2611
|
-
return;
|
|
2612
|
-
}
|
|
2613
2339
|
return msg;
|
|
2614
2340
|
}
|
|
2615
2341
|
if (async) {
|
|
2616
2342
|
return Promise.reject(e);
|
|
2617
2343
|
}
|
|
2618
|
-
if (callback) {
|
|
2619
|
-
callback(e);
|
|
2620
|
-
return;
|
|
2621
|
-
}
|
|
2622
2344
|
throw e;
|
|
2623
2345
|
};
|
|
2624
2346
|
}
|
|
2625
2347
|
}
|
|
2626
2348
|
|
|
2627
2349
|
const markedInstance = new Marked();
|
|
2628
|
-
function marked(src, opt
|
|
2629
|
-
return markedInstance.parse(src, opt
|
|
2350
|
+
function marked(src, opt) {
|
|
2351
|
+
return markedInstance.parse(src, opt);
|
|
2630
2352
|
}
|
|
2631
2353
|
/**
|
|
2632
2354
|
* Sets the default options.
|
|
@@ -2678,7 +2400,6 @@ marked.TextRenderer = _TextRenderer;
|
|
|
2678
2400
|
marked.Lexer = _Lexer;
|
|
2679
2401
|
marked.lexer = _Lexer.lex;
|
|
2680
2402
|
marked.Tokenizer = _Tokenizer;
|
|
2681
|
-
marked.Slugger = _Slugger;
|
|
2682
2403
|
marked.Hooks = _Hooks;
|
|
2683
2404
|
marked.parse = marked;
|
|
2684
2405
|
const options = marked.options;
|