satorigear 0.0.13 → 0.0.14
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/README.md +3 -3
- package/dist/index.mjs +188 -303
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { htmlBlockNames, htmlRawNames } from "micromark-util-html-tag-name";
|
|
2
2
|
// src/profile/utils.ts
|
|
3
|
-
const inlineColonBoundary = /[ \t\n\r\p{sc=Han}\p{sc=Hira}\p{sc=Kana}\p{sc=Hang}\p{P}]/
|
|
3
|
+
const inlineColonBoundary = /(?<=[ \t\n\r\p{sc=Han}\p{sc=Hira}\p{sc=Kana}\p{sc=Hang}\p{P}])/uy;
|
|
4
4
|
const nonSpaceAndLineEnding = /[^ \r\n]/;
|
|
5
|
+
const maximumLabelUnits = 1998;
|
|
6
|
+
const labelCharacters = /^.{1,999}$/su;
|
|
7
|
+
function referenceIdentifier(label) {
|
|
8
|
+
if (label.length > 999 && (label.length > 1998 || !labelCharacters.test(label.replaceAll("\r\n", "\n")))) return "";
|
|
9
|
+
return normalizeIdentifier(label);
|
|
10
|
+
}
|
|
5
11
|
function isAsciiDigit(code) {
|
|
6
12
|
return code >= 48 && code <= 57;
|
|
7
13
|
}
|
|
@@ -22,32 +28,28 @@ function isSpaceTabOrLineEnding(code) {
|
|
|
22
28
|
}
|
|
23
29
|
function hasInlineColonBoundary(source, start) {
|
|
24
30
|
if (start <= 0) return true;
|
|
25
|
-
|
|
26
|
-
return
|
|
31
|
+
inlineColonBoundary.lastIndex = start;
|
|
32
|
+
return source.charCodeAt(start - 1) !== 58 && inlineColonBoundary.test(source);
|
|
27
33
|
}
|
|
28
34
|
function hasInlinePadding(value) {
|
|
29
35
|
return isSpaceOrLineEnding(value.charCodeAt(0)) && isSpaceOrLineEnding(value.charCodeAt(value.length - 1)) && nonSpaceAndLineEnding.test(value);
|
|
30
36
|
}
|
|
31
37
|
const identifierNeedsCleanup = /[^\x20-\x7E]|^ | $| {2}/;
|
|
32
38
|
const identifierWhitespace = /[ \t\r\n]+/g;
|
|
39
|
+
const identifierPadding = /^ | $/g;
|
|
33
40
|
function normalizeIdentifier(identifier) {
|
|
34
|
-
return identifierNeedsCleanup.test(identifier) ? identifier.
|
|
41
|
+
return (identifierNeedsCleanup.test(identifier) ? identifier.replace(identifierWhitespace, " ").replace(identifierPadding, "").toLowerCase().toUpperCase() : identifier).toLowerCase();
|
|
35
42
|
}
|
|
36
43
|
// src/inline/entities.ts
|
|
37
44
|
const entities = {
|
|
38
45
|
__proto__: null,
|
|
39
|
-
AEli: "Æ",
|
|
40
46
|
AElig: "Æ",
|
|
41
|
-
AM: "&",
|
|
42
47
|
AMP: "&",
|
|
43
|
-
Aacut: "Á",
|
|
44
48
|
Aacute: "Á",
|
|
45
49
|
Abreve: "Ă",
|
|
46
|
-
Acir: "Â",
|
|
47
50
|
Acirc: "Â",
|
|
48
51
|
Acy: "А",
|
|
49
52
|
Afr: "𝔄",
|
|
50
|
-
Agrav: "À",
|
|
51
53
|
Agrave: "À",
|
|
52
54
|
Alpha: "Α",
|
|
53
55
|
Amacr: "Ā",
|
|
@@ -55,13 +57,10 @@ const entities = {
|
|
|
55
57
|
Aogon: "Ą",
|
|
56
58
|
Aopf: "𝔸",
|
|
57
59
|
ApplyFunction: "",
|
|
58
|
-
Arin: "Å",
|
|
59
60
|
Aring: "Å",
|
|
60
61
|
Ascr: "𝒜",
|
|
61
62
|
Assign: "≔",
|
|
62
|
-
Atild: "Ã",
|
|
63
63
|
Atilde: "Ã",
|
|
64
|
-
Aum: "Ä",
|
|
65
64
|
Auml: "Ä",
|
|
66
65
|
Backslash: "∖",
|
|
67
66
|
Barv: "⫧",
|
|
@@ -76,14 +75,12 @@ const entities = {
|
|
|
76
75
|
Bscr: "ℬ",
|
|
77
76
|
Bumpeq: "≎",
|
|
78
77
|
CHcy: "Ч",
|
|
79
|
-
COP: "©",
|
|
80
78
|
COPY: "©",
|
|
81
79
|
Cacute: "Ć",
|
|
82
80
|
Cap: "⋒",
|
|
83
81
|
CapitalDifferentialD: "ⅅ",
|
|
84
82
|
Cayleys: "ℭ",
|
|
85
83
|
Ccaron: "Č",
|
|
86
|
-
Ccedi: "Ç",
|
|
87
84
|
Ccedil: "Ç",
|
|
88
85
|
Ccirc: "Ĉ",
|
|
89
86
|
Cconint: "∰",
|
|
@@ -166,17 +163,13 @@ const entities = {
|
|
|
166
163
|
Dscr: "𝒟",
|
|
167
164
|
Dstrok: "Đ",
|
|
168
165
|
ENG: "Ŋ",
|
|
169
|
-
ET: "Ð",
|
|
170
166
|
ETH: "Ð",
|
|
171
|
-
Eacut: "É",
|
|
172
167
|
Eacute: "É",
|
|
173
168
|
Ecaron: "Ě",
|
|
174
|
-
Ecir: "Ê",
|
|
175
169
|
Ecirc: "Ê",
|
|
176
170
|
Ecy: "Э",
|
|
177
171
|
Edot: "Ė",
|
|
178
172
|
Efr: "𝔈",
|
|
179
|
-
Egrav: "È",
|
|
180
173
|
Egrave: "È",
|
|
181
174
|
Element: "∈",
|
|
182
175
|
Emacr: "Ē",
|
|
@@ -191,7 +184,6 @@ const entities = {
|
|
|
191
184
|
Escr: "ℰ",
|
|
192
185
|
Esim: "⩳",
|
|
193
186
|
Eta: "Η",
|
|
194
|
-
Eum: "Ë",
|
|
195
187
|
Euml: "Ë",
|
|
196
188
|
Exists: "∃",
|
|
197
189
|
ExponentialE: "ⅇ",
|
|
@@ -204,7 +196,6 @@ const entities = {
|
|
|
204
196
|
Fouriertrf: "ℱ",
|
|
205
197
|
Fscr: "ℱ",
|
|
206
198
|
GJcy: "Ѓ",
|
|
207
|
-
G: ">",
|
|
208
199
|
GT: ">",
|
|
209
200
|
Gamma: "Γ",
|
|
210
201
|
Gammad: "Ϝ",
|
|
@@ -240,14 +231,11 @@ const entities = {
|
|
|
240
231
|
IEcy: "Е",
|
|
241
232
|
IJlig: "IJ",
|
|
242
233
|
IOcy: "Ё",
|
|
243
|
-
Iacut: "Í",
|
|
244
234
|
Iacute: "Í",
|
|
245
|
-
Icir: "Î",
|
|
246
235
|
Icirc: "Î",
|
|
247
236
|
Icy: "И",
|
|
248
237
|
Idot: "İ",
|
|
249
238
|
Ifr: "ℑ",
|
|
250
|
-
Igrav: "Ì",
|
|
251
239
|
Igrave: "Ì",
|
|
252
240
|
Im: "ℑ",
|
|
253
241
|
Imacr: "Ī",
|
|
@@ -264,7 +252,6 @@ const entities = {
|
|
|
264
252
|
Iscr: "ℐ",
|
|
265
253
|
Itilde: "Ĩ",
|
|
266
254
|
Iukcy: "І",
|
|
267
|
-
Ium: "Ï",
|
|
268
255
|
Iuml: "Ï",
|
|
269
256
|
Jcirc: "Ĵ",
|
|
270
257
|
Jcy: "Й",
|
|
@@ -282,7 +269,6 @@ const entities = {
|
|
|
282
269
|
Kopf: "𝕂",
|
|
283
270
|
Kscr: "𝒦",
|
|
284
271
|
LJcy: "Љ",
|
|
285
|
-
L: "<",
|
|
286
272
|
LT: "<",
|
|
287
273
|
Lacute: "Ĺ",
|
|
288
274
|
Lambda: "Λ",
|
|
@@ -419,18 +405,14 @@ const entities = {
|
|
|
419
405
|
NotTildeTilde: "≉",
|
|
420
406
|
NotVerticalBar: "∤",
|
|
421
407
|
Nscr: "𝒩",
|
|
422
|
-
Ntild: "Ñ",
|
|
423
408
|
Ntilde: "Ñ",
|
|
424
409
|
Nu: "Ν",
|
|
425
410
|
OElig: "Œ",
|
|
426
|
-
Oacut: "Ó",
|
|
427
411
|
Oacute: "Ó",
|
|
428
|
-
Ocir: "Ô",
|
|
429
412
|
Ocirc: "Ô",
|
|
430
413
|
Ocy: "О",
|
|
431
414
|
Odblac: "Ő",
|
|
432
415
|
Ofr: "𝔒",
|
|
433
|
-
Ograv: "Ò",
|
|
434
416
|
Ograve: "Ò",
|
|
435
417
|
Omacr: "Ō",
|
|
436
418
|
Omega: "Ω",
|
|
@@ -440,12 +422,9 @@ const entities = {
|
|
|
440
422
|
OpenCurlyQuote: "‘",
|
|
441
423
|
Or: "⩔",
|
|
442
424
|
Oscr: "𝒪",
|
|
443
|
-
Oslas: "Ø",
|
|
444
425
|
Oslash: "Ø",
|
|
445
|
-
Otild: "Õ",
|
|
446
426
|
Otilde: "Õ",
|
|
447
427
|
Otimes: "⨷",
|
|
448
|
-
Oum: "Ö",
|
|
449
428
|
Ouml: "Ö",
|
|
450
429
|
OverBar: "‾",
|
|
451
430
|
OverBrace: "⏞",
|
|
@@ -470,13 +449,11 @@ const entities = {
|
|
|
470
449
|
Proportional: "∝",
|
|
471
450
|
Pscr: "𝒫",
|
|
472
451
|
Psi: "Ψ",
|
|
473
|
-
QUO: "\"",
|
|
474
452
|
QUOT: "\"",
|
|
475
453
|
Qfr: "𝔔",
|
|
476
454
|
Qopf: "ℚ",
|
|
477
455
|
Qscr: "𝒬",
|
|
478
456
|
RBarr: "⤐",
|
|
479
|
-
RE: "®",
|
|
480
457
|
REG: "®",
|
|
481
458
|
Racute: "Ŕ",
|
|
482
459
|
Rang: "⟫",
|
|
@@ -560,7 +537,6 @@ const entities = {
|
|
|
560
537
|
Superset: "⊃",
|
|
561
538
|
SupersetEqual: "⊇",
|
|
562
539
|
Supset: "⋑",
|
|
563
|
-
THOR: "Þ",
|
|
564
540
|
THORN: "Þ",
|
|
565
541
|
TRADE: "™",
|
|
566
542
|
TSHcy: "Ћ",
|
|
@@ -583,18 +559,15 @@ const entities = {
|
|
|
583
559
|
TripleDot: "⃛",
|
|
584
560
|
Tscr: "𝒯",
|
|
585
561
|
Tstrok: "Ŧ",
|
|
586
|
-
Uacut: "Ú",
|
|
587
562
|
Uacute: "Ú",
|
|
588
563
|
Uarr: "↟",
|
|
589
564
|
Uarrocir: "⥉",
|
|
590
565
|
Ubrcy: "Ў",
|
|
591
566
|
Ubreve: "Ŭ",
|
|
592
|
-
Ucir: "Û",
|
|
593
567
|
Ucirc: "Û",
|
|
594
568
|
Ucy: "У",
|
|
595
569
|
Udblac: "Ű",
|
|
596
570
|
Ufr: "𝔘",
|
|
597
|
-
Ugrav: "Ù",
|
|
598
571
|
Ugrave: "Ù",
|
|
599
572
|
Umacr: "Ū",
|
|
600
573
|
UnderBar: "_",
|
|
@@ -621,7 +594,6 @@ const entities = {
|
|
|
621
594
|
Uring: "Ů",
|
|
622
595
|
Uscr: "𝒰",
|
|
623
596
|
Utilde: "Ũ",
|
|
624
|
-
Uum: "Ü",
|
|
625
597
|
Uuml: "Ü",
|
|
626
598
|
VDash: "⊫",
|
|
627
599
|
Vbar: "⫫",
|
|
@@ -652,7 +624,6 @@ const entities = {
|
|
|
652
624
|
YAcy: "Я",
|
|
653
625
|
YIcy: "Ї",
|
|
654
626
|
YUcy: "Ю",
|
|
655
|
-
Yacut: "Ý",
|
|
656
627
|
Yacute: "Ý",
|
|
657
628
|
Ycirc: "Ŷ",
|
|
658
629
|
Ycy: "Ы",
|
|
@@ -670,29 +641,23 @@ const entities = {
|
|
|
670
641
|
Zfr: "ℨ",
|
|
671
642
|
Zopf: "ℤ",
|
|
672
643
|
Zscr: "𝒵",
|
|
673
|
-
aacut: "á",
|
|
674
644
|
aacute: "á",
|
|
675
645
|
abreve: "ă",
|
|
676
646
|
ac: "∾",
|
|
677
647
|
acE: "∾̳",
|
|
678
648
|
acd: "∿",
|
|
679
|
-
acir: "â",
|
|
680
649
|
acirc: "â",
|
|
681
|
-
acut: "´",
|
|
682
650
|
acute: "´",
|
|
683
651
|
acy: "а",
|
|
684
|
-
aeli: "æ",
|
|
685
652
|
aelig: "æ",
|
|
686
653
|
af: "",
|
|
687
654
|
afr: "𝔞",
|
|
688
|
-
agrav: "à",
|
|
689
655
|
agrave: "à",
|
|
690
656
|
alefsym: "ℵ",
|
|
691
657
|
aleph: "ℵ",
|
|
692
658
|
alpha: "α",
|
|
693
659
|
amacr: "ā",
|
|
694
660
|
amalg: "⨿",
|
|
695
|
-
am: "&",
|
|
696
661
|
amp: "&",
|
|
697
662
|
and: "∧",
|
|
698
663
|
andand: "⩕",
|
|
@@ -727,15 +692,12 @@ const entities = {
|
|
|
727
692
|
apos: "'",
|
|
728
693
|
approx: "≈",
|
|
729
694
|
approxeq: "≊",
|
|
730
|
-
arin: "å",
|
|
731
695
|
aring: "å",
|
|
732
696
|
ascr: "𝒶",
|
|
733
697
|
ast: "*",
|
|
734
698
|
asymp: "≈",
|
|
735
699
|
asympeq: "≍",
|
|
736
|
-
atild: "ã",
|
|
737
700
|
atilde: "ã",
|
|
738
|
-
aum: "ä",
|
|
739
701
|
auml: "ä",
|
|
740
702
|
awconint: "∳",
|
|
741
703
|
awint: "⨑",
|
|
@@ -840,7 +802,6 @@ const entities = {
|
|
|
840
802
|
boxvr: "├",
|
|
841
803
|
bprime: "‵",
|
|
842
804
|
breve: "˘",
|
|
843
|
-
brvba: "¦",
|
|
844
805
|
brvbar: "¦",
|
|
845
806
|
bscr: "𝒷",
|
|
846
807
|
bsemi: "⁏",
|
|
@@ -867,16 +828,13 @@ const entities = {
|
|
|
867
828
|
caron: "ˇ",
|
|
868
829
|
ccaps: "⩍",
|
|
869
830
|
ccaron: "č",
|
|
870
|
-
ccedi: "ç",
|
|
871
831
|
ccedil: "ç",
|
|
872
832
|
ccirc: "ĉ",
|
|
873
833
|
ccups: "⩌",
|
|
874
834
|
ccupssm: "⩐",
|
|
875
835
|
cdot: "ċ",
|
|
876
|
-
cedi: "¸",
|
|
877
836
|
cedil: "¸",
|
|
878
837
|
cemptyv: "⦲",
|
|
879
|
-
cen: "¢",
|
|
880
838
|
cent: "¢",
|
|
881
839
|
centerdot: "·",
|
|
882
840
|
cfr: "𝔠",
|
|
@@ -915,7 +873,6 @@ const entities = {
|
|
|
915
873
|
conint: "∮",
|
|
916
874
|
copf: "𝕔",
|
|
917
875
|
coprod: "∐",
|
|
918
|
-
cop: "©",
|
|
919
876
|
copy: "©",
|
|
920
877
|
copysr: "℗",
|
|
921
878
|
crarr: "↵",
|
|
@@ -945,7 +902,6 @@ const entities = {
|
|
|
945
902
|
curlyeqsucc: "⋟",
|
|
946
903
|
curlyvee: "⋎",
|
|
947
904
|
curlywedge: "⋏",
|
|
948
|
-
curre: "¤",
|
|
949
905
|
curren: "¤",
|
|
950
906
|
curvearrowleft: "↶",
|
|
951
907
|
curvearrowright: "↷",
|
|
@@ -969,7 +925,6 @@ const entities = {
|
|
|
969
925
|
ddagger: "‡",
|
|
970
926
|
ddarr: "⇊",
|
|
971
927
|
ddotseq: "⩷",
|
|
972
|
-
de: "°",
|
|
973
928
|
deg: "°",
|
|
974
929
|
delta: "δ",
|
|
975
930
|
demptyv: "⦱",
|
|
@@ -985,7 +940,6 @@ const entities = {
|
|
|
985
940
|
digamma: "ϝ",
|
|
986
941
|
disin: "⋲",
|
|
987
942
|
div: "÷",
|
|
988
|
-
divid: "÷",
|
|
989
943
|
divide: "÷",
|
|
990
944
|
divideontimes: "⋇",
|
|
991
945
|
divonx: "⋇",
|
|
@@ -1022,11 +976,10 @@ const entities = {
|
|
|
1022
976
|
dzigrarr: "⟿",
|
|
1023
977
|
eDDot: "⩷",
|
|
1024
978
|
eDot: "≑",
|
|
1025
|
-
eacut: "é",
|
|
1026
979
|
eacute: "é",
|
|
1027
980
|
easter: "⩮",
|
|
1028
981
|
ecaron: "ě",
|
|
1029
|
-
ecir: "
|
|
982
|
+
ecir: "≖",
|
|
1030
983
|
ecirc: "ê",
|
|
1031
984
|
ecolon: "≕",
|
|
1032
985
|
ecy: "э",
|
|
@@ -1035,7 +988,6 @@ const entities = {
|
|
|
1035
988
|
efDot: "≒",
|
|
1036
989
|
efr: "𝔢",
|
|
1037
990
|
eg: "⪚",
|
|
1038
|
-
egrav: "è",
|
|
1039
991
|
egrave: "è",
|
|
1040
992
|
egs: "⪖",
|
|
1041
993
|
egsdot: "⪘",
|
|
@@ -1077,9 +1029,7 @@ const entities = {
|
|
|
1077
1029
|
esdot: "≐",
|
|
1078
1030
|
esim: "≂",
|
|
1079
1031
|
eta: "η",
|
|
1080
|
-
et: "ð",
|
|
1081
1032
|
eth: "ð",
|
|
1082
|
-
eum: "ë",
|
|
1083
1033
|
euml: "ë",
|
|
1084
1034
|
euro: "€",
|
|
1085
1035
|
excl: "!",
|
|
@@ -1104,7 +1054,6 @@ const entities = {
|
|
|
1104
1054
|
fork: "⋔",
|
|
1105
1055
|
forkv: "⫙",
|
|
1106
1056
|
fpartint: "⨍",
|
|
1107
|
-
frac1: "¼",
|
|
1108
1057
|
frac12: "½",
|
|
1109
1058
|
frac13: "⅓",
|
|
1110
1059
|
frac14: "¼",
|
|
@@ -1113,7 +1062,6 @@ const entities = {
|
|
|
1113
1062
|
frac18: "⅛",
|
|
1114
1063
|
frac23: "⅔",
|
|
1115
1064
|
frac25: "⅖",
|
|
1116
|
-
frac3: "¾",
|
|
1117
1065
|
frac34: "¾",
|
|
1118
1066
|
frac35: "⅗",
|
|
1119
1067
|
frac38: "⅜",
|
|
@@ -1168,7 +1116,6 @@ const entities = {
|
|
|
1168
1116
|
gsim: "≳",
|
|
1169
1117
|
gsime: "⪎",
|
|
1170
1118
|
gsiml: "⪐",
|
|
1171
|
-
g: ">",
|
|
1172
1119
|
gt: ">",
|
|
1173
1120
|
gtcc: "⪧",
|
|
1174
1121
|
gtcir: "⩺",
|
|
@@ -1212,18 +1159,14 @@ const entities = {
|
|
|
1212
1159
|
hstrok: "ħ",
|
|
1213
1160
|
hybull: "⁃",
|
|
1214
1161
|
hyphen: "‐",
|
|
1215
|
-
iacut: "í",
|
|
1216
1162
|
iacute: "í",
|
|
1217
1163
|
ic: "",
|
|
1218
|
-
icir: "î",
|
|
1219
1164
|
icirc: "î",
|
|
1220
1165
|
icy: "и",
|
|
1221
1166
|
iecy: "е",
|
|
1222
|
-
iexc: "¡",
|
|
1223
1167
|
iexcl: "¡",
|
|
1224
1168
|
iff: "⇔",
|
|
1225
1169
|
ifr: "𝔦",
|
|
1226
|
-
igrav: "ì",
|
|
1227
1170
|
igrave: "ì",
|
|
1228
1171
|
ii: "ⅈ",
|
|
1229
1172
|
iiiint: "⨌",
|
|
@@ -1254,7 +1197,6 @@ const entities = {
|
|
|
1254
1197
|
iopf: "𝕚",
|
|
1255
1198
|
iota: "ι",
|
|
1256
1199
|
iprod: "⨼",
|
|
1257
|
-
iques: "¿",
|
|
1258
1200
|
iquest: "¿",
|
|
1259
1201
|
iscr: "𝒾",
|
|
1260
1202
|
isin: "∈",
|
|
@@ -1266,7 +1208,6 @@ const entities = {
|
|
|
1266
1208
|
it: "",
|
|
1267
1209
|
itilde: "ĩ",
|
|
1268
1210
|
iukcy: "і",
|
|
1269
|
-
ium: "ï",
|
|
1270
1211
|
iuml: "ï",
|
|
1271
1212
|
jcirc: "ĵ",
|
|
1272
1213
|
jcy: "й",
|
|
@@ -1301,7 +1242,6 @@ const entities = {
|
|
|
1301
1242
|
langd: "⦑",
|
|
1302
1243
|
langle: "⟨",
|
|
1303
1244
|
lap: "⪅",
|
|
1304
|
-
laqu: "«",
|
|
1305
1245
|
laquo: "«",
|
|
1306
1246
|
larr: "←",
|
|
1307
1247
|
larrb: "⇤",
|
|
@@ -1423,7 +1363,6 @@ const entities = {
|
|
|
1423
1363
|
lsquo: "‘",
|
|
1424
1364
|
lsquor: "‚",
|
|
1425
1365
|
lstrok: "ł",
|
|
1426
|
-
l: "<",
|
|
1427
1366
|
lt: "<",
|
|
1428
1367
|
ltcc: "⪦",
|
|
1429
1368
|
ltcir: "⩹",
|
|
@@ -1441,7 +1380,6 @@ const entities = {
|
|
|
1441
1380
|
lvertneqq: "≨︀",
|
|
1442
1381
|
lvnE: "≨︀",
|
|
1443
1382
|
mDDot: "∺",
|
|
1444
|
-
mac: "¯",
|
|
1445
1383
|
macr: "¯",
|
|
1446
1384
|
male: "♂",
|
|
1447
1385
|
malt: "✠",
|
|
@@ -1458,12 +1396,10 @@ const entities = {
|
|
|
1458
1396
|
measuredangle: "∡",
|
|
1459
1397
|
mfr: "𝔪",
|
|
1460
1398
|
mho: "℧",
|
|
1461
|
-
micr: "µ",
|
|
1462
1399
|
micro: "µ",
|
|
1463
1400
|
mid: "∣",
|
|
1464
1401
|
midast: "*",
|
|
1465
1402
|
midcir: "⫰",
|
|
1466
|
-
middo: "·",
|
|
1467
1403
|
middot: "·",
|
|
1468
1404
|
minus: "−",
|
|
1469
1405
|
minusb: "⊟",
|
|
@@ -1502,7 +1438,6 @@ const entities = {
|
|
|
1502
1438
|
natur: "♮",
|
|
1503
1439
|
natural: "♮",
|
|
1504
1440
|
naturals: "ℕ",
|
|
1505
|
-
nbs: "\xA0",
|
|
1506
1441
|
nbsp: "\xA0",
|
|
1507
1442
|
nbump: "≎̸",
|
|
1508
1443
|
nbumpe: "≏̸",
|
|
@@ -1561,7 +1496,6 @@ const entities = {
|
|
|
1561
1496
|
nltrie: "⋬",
|
|
1562
1497
|
nmid: "∤",
|
|
1563
1498
|
nopf: "𝕟",
|
|
1564
|
-
no: "¬",
|
|
1565
1499
|
not: "¬",
|
|
1566
1500
|
notin: "∉",
|
|
1567
1501
|
notinE: "⋹̸",
|
|
@@ -1618,7 +1552,6 @@ const entities = {
|
|
|
1618
1552
|
nsupseteq: "⊉",
|
|
1619
1553
|
nsupseteqq: "⫆̸",
|
|
1620
1554
|
ntgl: "≹",
|
|
1621
|
-
ntild: "ñ",
|
|
1622
1555
|
ntilde: "ñ",
|
|
1623
1556
|
ntlg: "≸",
|
|
1624
1557
|
ntriangleleft: "⋪",
|
|
@@ -1649,10 +1582,9 @@ const entities = {
|
|
|
1649
1582
|
nwarrow: "↖",
|
|
1650
1583
|
nwnear: "⤧",
|
|
1651
1584
|
oS: "Ⓢ",
|
|
1652
|
-
oacut: "ó",
|
|
1653
1585
|
oacute: "ó",
|
|
1654
1586
|
oast: "⊛",
|
|
1655
|
-
ocir: "
|
|
1587
|
+
ocir: "⊚",
|
|
1656
1588
|
ocirc: "ô",
|
|
1657
1589
|
ocy: "о",
|
|
1658
1590
|
odash: "⊝",
|
|
@@ -1664,7 +1596,6 @@ const entities = {
|
|
|
1664
1596
|
ofcir: "⦿",
|
|
1665
1597
|
ofr: "𝔬",
|
|
1666
1598
|
ogon: "˛",
|
|
1667
|
-
ograv: "ò",
|
|
1668
1599
|
ograve: "ò",
|
|
1669
1600
|
ogt: "⧁",
|
|
1670
1601
|
ohbar: "⦵",
|
|
@@ -1686,7 +1617,7 @@ const entities = {
|
|
|
1686
1617
|
oplus: "⊕",
|
|
1687
1618
|
or: "∨",
|
|
1688
1619
|
orarr: "↻",
|
|
1689
|
-
ord: "
|
|
1620
|
+
ord: "⩝",
|
|
1690
1621
|
order: "ℴ",
|
|
1691
1622
|
orderof: "ℴ",
|
|
1692
1623
|
ordf: "ª",
|
|
@@ -1696,17 +1627,14 @@ const entities = {
|
|
|
1696
1627
|
orslope: "⩗",
|
|
1697
1628
|
orv: "⩛",
|
|
1698
1629
|
oscr: "ℴ",
|
|
1699
|
-
oslas: "ø",
|
|
1700
1630
|
oslash: "ø",
|
|
1701
1631
|
osol: "⊘",
|
|
1702
|
-
otild: "õ",
|
|
1703
1632
|
otilde: "õ",
|
|
1704
1633
|
otimes: "⊗",
|
|
1705
1634
|
otimesas: "⨶",
|
|
1706
|
-
oum: "ö",
|
|
1707
1635
|
ouml: "ö",
|
|
1708
1636
|
ovbar: "⌽",
|
|
1709
|
-
par: "
|
|
1637
|
+
par: "∥",
|
|
1710
1638
|
para: "¶",
|
|
1711
1639
|
parallel: "∥",
|
|
1712
1640
|
parsim: "⫳",
|
|
@@ -1736,14 +1664,12 @@ const entities = {
|
|
|
1736
1664
|
plusdo: "∔",
|
|
1737
1665
|
plusdu: "⨥",
|
|
1738
1666
|
pluse: "⩲",
|
|
1739
|
-
plusm: "±",
|
|
1740
1667
|
plusmn: "±",
|
|
1741
1668
|
plussim: "⨦",
|
|
1742
1669
|
plustwo: "⨧",
|
|
1743
1670
|
pm: "±",
|
|
1744
1671
|
pointint: "⨕",
|
|
1745
1672
|
popf: "𝕡",
|
|
1746
|
-
poun: "£",
|
|
1747
1673
|
pound: "£",
|
|
1748
1674
|
pr: "≺",
|
|
1749
1675
|
prE: "⪳",
|
|
@@ -1783,7 +1709,6 @@ const entities = {
|
|
|
1783
1709
|
quatint: "⨖",
|
|
1784
1710
|
quest: "?",
|
|
1785
1711
|
questeq: "≟",
|
|
1786
|
-
quo: "\"",
|
|
1787
1712
|
quot: "\"",
|
|
1788
1713
|
rAarr: "⇛",
|
|
1789
1714
|
rArr: "⇒",
|
|
@@ -1798,7 +1723,6 @@ const entities = {
|
|
|
1798
1723
|
rangd: "⦒",
|
|
1799
1724
|
range: "⦥",
|
|
1800
1725
|
rangle: "⟩",
|
|
1801
|
-
raqu: "»",
|
|
1802
1726
|
raquo: "»",
|
|
1803
1727
|
rarr: "→",
|
|
1804
1728
|
rarrap: "⥵",
|
|
@@ -1837,7 +1761,6 @@ const entities = {
|
|
|
1837
1761
|
realpart: "ℜ",
|
|
1838
1762
|
reals: "ℝ",
|
|
1839
1763
|
rect: "▭",
|
|
1840
|
-
re: "®",
|
|
1841
1764
|
reg: "®",
|
|
1842
1765
|
rfisht: "⥽",
|
|
1843
1766
|
rfloor: "⌋",
|
|
@@ -1912,7 +1835,6 @@ const entities = {
|
|
|
1912
1835
|
searhk: "⤥",
|
|
1913
1836
|
searr: "↘",
|
|
1914
1837
|
searrow: "↘",
|
|
1915
|
-
sec: "§",
|
|
1916
1838
|
sect: "§",
|
|
1917
1839
|
semi: ";",
|
|
1918
1840
|
seswar: "⤩",
|
|
@@ -1926,7 +1848,6 @@ const entities = {
|
|
|
1926
1848
|
shcy: "ш",
|
|
1927
1849
|
shortmid: "∣",
|
|
1928
1850
|
shortparallel: "∥",
|
|
1929
|
-
sh: "",
|
|
1930
1851
|
shy: "",
|
|
1931
1852
|
sigma: "σ",
|
|
1932
1853
|
sigmaf: "ς",
|
|
@@ -2013,10 +1934,10 @@ const entities = {
|
|
|
2013
1934
|
succsim: "≿",
|
|
2014
1935
|
sum: "∑",
|
|
2015
1936
|
sung: "♪",
|
|
2016
|
-
sup: "⊃",
|
|
2017
1937
|
sup1: "¹",
|
|
2018
1938
|
sup2: "²",
|
|
2019
1939
|
sup3: "³",
|
|
1940
|
+
sup: "⊃",
|
|
2020
1941
|
supE: "⫆",
|
|
2021
1942
|
supdot: "⪾",
|
|
2022
1943
|
supdsub: "⫘",
|
|
@@ -2042,7 +1963,6 @@ const entities = {
|
|
|
2042
1963
|
swarr: "↙",
|
|
2043
1964
|
swarrow: "↙",
|
|
2044
1965
|
swnwar: "⤪",
|
|
2045
|
-
szli: "ß",
|
|
2046
1966
|
szlig: "ß",
|
|
2047
1967
|
target: "⌖",
|
|
2048
1968
|
tau: "τ",
|
|
@@ -2063,10 +1983,8 @@ const entities = {
|
|
|
2063
1983
|
thinsp: " ",
|
|
2064
1984
|
thkap: "≈",
|
|
2065
1985
|
thksim: "∼",
|
|
2066
|
-
thor: "þ",
|
|
2067
1986
|
thorn: "þ",
|
|
2068
1987
|
tilde: "˜",
|
|
2069
|
-
time: "×",
|
|
2070
1988
|
times: "×",
|
|
2071
1989
|
timesb: "⊠",
|
|
2072
1990
|
timesbar: "⨱",
|
|
@@ -2104,12 +2022,10 @@ const entities = {
|
|
|
2104
2022
|
twoheadrightarrow: "↠",
|
|
2105
2023
|
uArr: "⇑",
|
|
2106
2024
|
uHar: "⥣",
|
|
2107
|
-
uacut: "ú",
|
|
2108
2025
|
uacute: "ú",
|
|
2109
2026
|
uarr: "↑",
|
|
2110
2027
|
ubrcy: "ў",
|
|
2111
2028
|
ubreve: "ŭ",
|
|
2112
|
-
ucir: "û",
|
|
2113
2029
|
ucirc: "û",
|
|
2114
2030
|
ucy: "у",
|
|
2115
2031
|
udarr: "⇅",
|
|
@@ -2117,7 +2033,6 @@ const entities = {
|
|
|
2117
2033
|
udhar: "⥮",
|
|
2118
2034
|
ufisht: "⥾",
|
|
2119
2035
|
ufr: "𝔲",
|
|
2120
|
-
ugrav: "ù",
|
|
2121
2036
|
ugrave: "ù",
|
|
2122
2037
|
uharl: "↿",
|
|
2123
2038
|
uharr: "↾",
|
|
@@ -2127,7 +2042,6 @@ const entities = {
|
|
|
2127
2042
|
ulcrop: "⌏",
|
|
2128
2043
|
ultri: "◸",
|
|
2129
2044
|
umacr: "ū",
|
|
2130
|
-
um: "¨",
|
|
2131
2045
|
uml: "¨",
|
|
2132
2046
|
uogon: "ų",
|
|
2133
2047
|
uopf: "𝕦",
|
|
@@ -2151,7 +2065,6 @@ const entities = {
|
|
|
2151
2065
|
utri: "▵",
|
|
2152
2066
|
utrif: "▴",
|
|
2153
2067
|
uuarr: "⇈",
|
|
2154
|
-
uum: "ü",
|
|
2155
2068
|
uuml: "ü",
|
|
2156
2069
|
uwangle: "⦧",
|
|
2157
2070
|
vArr: "⇕",
|
|
@@ -2231,19 +2144,16 @@ const entities = {
|
|
|
2231
2144
|
xutri: "△",
|
|
2232
2145
|
xvee: "⋁",
|
|
2233
2146
|
xwedge: "⋀",
|
|
2234
|
-
yacut: "ý",
|
|
2235
2147
|
yacute: "ý",
|
|
2236
2148
|
yacy: "я",
|
|
2237
2149
|
ycirc: "ŷ",
|
|
2238
2150
|
ycy: "ы",
|
|
2239
|
-
ye: "¥",
|
|
2240
2151
|
yen: "¥",
|
|
2241
2152
|
yfr: "𝔶",
|
|
2242
2153
|
yicy: "ї",
|
|
2243
2154
|
yopf: "𝕪",
|
|
2244
2155
|
yscr: "𝓎",
|
|
2245
2156
|
yucy: "ю",
|
|
2246
|
-
yum: "ÿ",
|
|
2247
2157
|
yuml: "ÿ",
|
|
2248
2158
|
zacute: "ź",
|
|
2249
2159
|
zcaron: "ž",
|
|
@@ -2281,7 +2191,7 @@ function decodeReference(source, start, end) {
|
|
|
2281
2191
|
let point = 0;
|
|
2282
2192
|
for (let offset = start + (hex ? 3 : 2); offset < end - 1; offset++) {
|
|
2283
2193
|
const digit = source.charCodeAt(offset);
|
|
2284
|
-
point = point * radix + (digit <= 57 ? digit - 48 : (digit | 32) -
|
|
2194
|
+
point = point * radix + (digit <= 57 ? digit - 48 : (digit | 32) - 87);
|
|
2285
2195
|
}
|
|
2286
2196
|
if (point < 9 || point === 11 || point > 13 && point < 32 || point >= 127 && point <= 159 || point >= 55296 && point <= 57343 || point >= 64976 && point <= 65007 || (point & 65535) >= 65534 || point > 1114111) point = 65533;
|
|
2287
2197
|
return String.fromCodePoint(point);
|
|
@@ -2333,6 +2243,22 @@ function shiftTail(items, oldEnd, newEnd) {
|
|
|
2333
2243
|
items.length = length + delta;
|
|
2334
2244
|
}
|
|
2335
2245
|
}
|
|
2246
|
+
// src/block/scratch.ts
|
|
2247
|
+
const allocate = globalThis.Buffer?.allocUnsafeSlow;
|
|
2248
|
+
var ScratchView = class {
|
|
2249
|
+
static bytes;
|
|
2250
|
+
static words;
|
|
2251
|
+
static supports = allocate !== void 0;
|
|
2252
|
+
static prepare(sourceLength) {
|
|
2253
|
+
const wordLimit = sourceLength + 31 & -32;
|
|
2254
|
+
if (!this.bytes || this.bytes.length < wordLimit) {
|
|
2255
|
+
this.bytes = allocate(wordLimit);
|
|
2256
|
+
this.words = new Uint32Array(this.bytes.buffer, this.bytes.byteOffset, wordLimit >>> 2);
|
|
2257
|
+
}
|
|
2258
|
+
for (let i = 1; i <= 8; i++) this.words[(wordLimit >>> 2) - i] = 538976288;
|
|
2259
|
+
return wordLimit;
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2336
2262
|
// src/source-view.ts
|
|
2337
2263
|
function cloneLocation(location) {
|
|
2338
2264
|
return {
|
|
@@ -2379,7 +2305,7 @@ var SourceView = class {
|
|
|
2379
2305
|
this.text = parts.join("");
|
|
2380
2306
|
}
|
|
2381
2307
|
tokenize(tokenize, scratch = false) {
|
|
2382
|
-
return tokenize(this.text, this.#withBoundaryBreak, !scratch
|
|
2308
|
+
return tokenize(this.text, this.#withBoundaryBreak, this.#withBoundaryBreak || !(scratch && ScratchView.supports) ? void 0 : this.#mappings);
|
|
2383
2309
|
}
|
|
2384
2310
|
mapOffset(offset) {
|
|
2385
2311
|
const mappings = this.#mappings;
|
|
@@ -2434,22 +2360,6 @@ function buildBlockChildren(tokenStart, context) {
|
|
|
2434
2360
|
}
|
|
2435
2361
|
return children ?? [];
|
|
2436
2362
|
}
|
|
2437
|
-
// src/block/scratch.ts
|
|
2438
|
-
const allocate = globalThis.Buffer?.allocUnsafeSlow;
|
|
2439
|
-
var ScratchView = class {
|
|
2440
|
-
static bytes;
|
|
2441
|
-
static words;
|
|
2442
|
-
static supports = allocate !== void 0;
|
|
2443
|
-
static prepare(sourceLength) {
|
|
2444
|
-
const wordLimit = sourceLength + 31 & -32;
|
|
2445
|
-
if (!this.bytes || this.bytes.length < wordLimit) {
|
|
2446
|
-
this.bytes = allocate(wordLimit);
|
|
2447
|
-
this.words = new Uint32Array(this.bytes.buffer, this.bytes.byteOffset, wordLimit >>> 2);
|
|
2448
|
-
}
|
|
2449
|
-
for (let i = 1; i <= 8; i++) this.words[(wordLimit >>> 2) - i] = 538976288;
|
|
2450
|
-
return wordLimit;
|
|
2451
|
-
}
|
|
2452
|
-
};
|
|
2453
2363
|
// src/block/lines.ts
|
|
2454
2364
|
function getLineCapacity(sourceLength) {
|
|
2455
2365
|
return Math.min(sourceLength + 15 >>> 4, 16384);
|
|
@@ -2487,14 +2397,14 @@ var Latin1 = class {
|
|
|
2487
2397
|
const word5 = words[offset | 5];
|
|
2488
2398
|
const word6 = words[offset | 6];
|
|
2489
2399
|
const word7 = words[offset | 7];
|
|
2490
|
-
const hits0 = word0 - 269488144 & ~word0 &
|
|
2491
|
-
const hits1 = word1 - 269488144 & ~word1 &
|
|
2492
|
-
const hits2 = word2 - 269488144 & ~word2 &
|
|
2493
|
-
const hits3 = word3 - 269488144 & ~word3 &
|
|
2494
|
-
const hits4 = word4 - 269488144 & ~word4 &
|
|
2495
|
-
const hits5 = word5 - 269488144 & ~word5 &
|
|
2496
|
-
const hits6 = word6 - 269488144 & ~word6 &
|
|
2497
|
-
const hits7 = word7 - 269488144 & ~word7 &
|
|
2400
|
+
const hits0 = word0 - 269488144 & ~word0 & 0x80808080;
|
|
2401
|
+
const hits1 = word1 - 269488144 & ~word1 & 0x80808080;
|
|
2402
|
+
const hits2 = word2 - 269488144 & ~word2 & 0x80808080;
|
|
2403
|
+
const hits3 = word3 - 269488144 & ~word3 & 0x80808080;
|
|
2404
|
+
const hits4 = word4 - 269488144 & ~word4 & 0x80808080;
|
|
2405
|
+
const hits5 = word5 - 269488144 & ~word5 & 0x80808080;
|
|
2406
|
+
const hits6 = word6 - 269488144 & ~word6 & 0x80808080;
|
|
2407
|
+
const hits7 = word7 - 269488144 & ~word7 & 0x80808080;
|
|
2498
2408
|
if (hits0 | hits1 | hits2 | hits3 | hits4 | hits5 | hits6 | hits7) {
|
|
2499
2409
|
let events = Math.imul(hits0 >>> 4 | hits1, 2113665) >>> 24 | Math.imul(hits2 >>> 4 | hits3, 2113665) >>> 24 << 8 | Math.imul(hits4 >>> 4 | hits5, 2113665) >>> 24 << 16 | Math.imul(hits6 >>> 4 | hits7, 2113665) >>> 24 << 24;
|
|
2500
2410
|
const last = cursor + 31;
|
|
@@ -3037,8 +2947,7 @@ var BlockScanContext = class {
|
|
|
3037
2947
|
while (true) {
|
|
3038
2948
|
const contentOffset = lineIndentOffset(source, contentLines, contentIndex);
|
|
3039
2949
|
if (contentOffset < 0) return false;
|
|
3040
|
-
|
|
3041
|
-
if (unwrap?.(source, contentLines, contentIndex, contentOffset, this.#unwrappedLine)) {
|
|
2950
|
+
if ((0, this.#profile.unwraps[source.charCodeAt(contentOffset)])?.(source, contentLines, contentIndex, contentOffset, this.#unwrappedLine)) {
|
|
3042
2951
|
contentLines = this.#unwrappedLine;
|
|
3043
2952
|
contentIndex = 0;
|
|
3044
2953
|
continue;
|
|
@@ -3272,14 +3181,14 @@ var InlineRegionResolver = class {
|
|
|
3272
3181
|
if (!hasAny) this.#dependencies = definitionAny;
|
|
3273
3182
|
return hasAny;
|
|
3274
3183
|
}
|
|
3275
|
-
update(previous, tokenStart, view, changes) {
|
|
3184
|
+
update(previous, tokenStart, view, changes, initial) {
|
|
3276
3185
|
if (previous && previous.view.text === view.text) {
|
|
3277
3186
|
previous.tokenStart = tokenStart;
|
|
3278
3187
|
previous.view = view;
|
|
3279
3188
|
this.updateDefinitions(previous, changes);
|
|
3280
3189
|
return previous;
|
|
3281
3190
|
}
|
|
3282
|
-
const rawTokens = view.tokenize(this.#profile.tokenize);
|
|
3191
|
+
const rawTokens = view.tokenize(this.#profile.tokenize, initial);
|
|
3283
3192
|
return {
|
|
3284
3193
|
tokenStart,
|
|
3285
3194
|
view,
|
|
@@ -3337,12 +3246,11 @@ var InlineRegionState = class {
|
|
|
3337
3246
|
regionsByBlock[blockIndex] = emptyArray;
|
|
3338
3247
|
continue;
|
|
3339
3248
|
}
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
for (let token = tokenStart; token < tokenEnd; token++) {
|
|
3249
|
+
let regions;
|
|
3250
|
+
for (let token = tokenStart; token < tokenStart + blockLength; token++) {
|
|
3343
3251
|
const nodeLength = tokens.nodeLength(token);
|
|
3344
3252
|
if (nodeLength <= 1 || tokens.kind(token + 1) !== 1) continue;
|
|
3345
|
-
const regionIndex = regions
|
|
3253
|
+
const regionIndex = regions?.length ?? 0;
|
|
3346
3254
|
let candidate = previousRegions?.[regionIndex];
|
|
3347
3255
|
if (!candidate && tokenChange && blockIndex >= oldRecordStart) {
|
|
3348
3256
|
const previousTokenStart = token < tokenChange.oldStart ? token : token >= tokenChange.newEnd ? token - suffixTokenDelta : -1;
|
|
@@ -3351,10 +3259,11 @@ var InlineRegionState = class {
|
|
|
3351
3259
|
}
|
|
3352
3260
|
const view = new SourceView();
|
|
3353
3261
|
view.reset(source, tokens, token, nodeLength);
|
|
3354
|
-
|
|
3262
|
+
const region = this.#resolver.update(candidate, token, view, definitionMembershipChanges, change === void 0);
|
|
3263
|
+
regions?.push(region) ?? (regions = [region]);
|
|
3355
3264
|
token += nodeLength - 1;
|
|
3356
3265
|
}
|
|
3357
|
-
regionsByBlock[blockIndex] = regions;
|
|
3266
|
+
regionsByBlock[blockIndex] = regions ?? emptyArray;
|
|
3358
3267
|
}
|
|
3359
3268
|
if (offsetDelta !== 0 || suffixTokenDelta !== 0) for (let index = newRecordEnd; index < regionsByBlock.length; index++) for (const region of regionsByBlock[index]) {
|
|
3360
3269
|
region.tokenStart += suffixTokenDelta;
|
|
@@ -3466,8 +3375,8 @@ var DocumentImpl = class {
|
|
|
3466
3375
|
const root = this.#tree;
|
|
3467
3376
|
const children = root.children;
|
|
3468
3377
|
const rebuildStart = change?.stableBlockCount ?? 0;
|
|
3469
|
-
const
|
|
3470
|
-
const locator = this.#blockScanner.locator(
|
|
3378
|
+
const startLine = children[Math.min(rebuildStart, invalidatedBlocks[0] ?? rebuildStart) - 1]?.position?.end.line ?? 1;
|
|
3379
|
+
const locator = this.#blockScanner.locator(startLine - 1);
|
|
3471
3380
|
const context = createBuildContext(this.#source, this.#blockScanner, this.#profile.inline, locator, new InlineRegionCursor());
|
|
3472
3381
|
const oldRebuildEnd = change?.oldRecordEnd ?? 0;
|
|
3473
3382
|
const newRebuildEnd = change?.newRecordEnd ?? records.length;
|
|
@@ -3764,21 +3673,14 @@ const brackets = {
|
|
|
3764
3673
|
[123]: 125,
|
|
3765
3674
|
[40]: 41
|
|
3766
3675
|
};
|
|
3767
|
-
const stops1 = new Set([
|
|
3768
|
-
32,
|
|
3769
|
-
35,
|
|
3770
|
-
46,
|
|
3771
|
-
125
|
|
3772
|
-
]);
|
|
3773
|
-
const stops2 = new Set([32, 125]);
|
|
3774
3676
|
function assignAttribute(attributes, name, value) {
|
|
3775
3677
|
if (name === "class" && typeof value === "string" && typeof attributes.class === "string") attributes.class += ` ${value}`;
|
|
3776
3678
|
else attributes[name] = value;
|
|
3777
3679
|
}
|
|
3778
|
-
function scanUntil(source, offset, limit,
|
|
3680
|
+
function scanUntil(source, offset, limit, shorthand) {
|
|
3779
3681
|
while (offset < limit) {
|
|
3780
3682
|
const code = source.charCodeAt(offset);
|
|
3781
|
-
if (code ===
|
|
3683
|
+
if (isSpaceTabOrLineEnding(code) || code === 125 || shorthand && (code === 35 || code === 46)) break;
|
|
3782
3684
|
offset += code === 92 && offset + 1 < limit ? 2 : 1;
|
|
3783
3685
|
}
|
|
3784
3686
|
return offset;
|
|
@@ -3827,7 +3729,7 @@ function scanAttributes(source, start, attributes, limit = source.length) {
|
|
|
3827
3729
|
if (marker === 46 || marker === 35) {
|
|
3828
3730
|
offset++;
|
|
3829
3731
|
const valueStart = offset;
|
|
3830
|
-
offset = scanUntil(source, offset, limit,
|
|
3732
|
+
offset = scanUntil(source, offset, limit, true);
|
|
3831
3733
|
if (offset === valueStart) return;
|
|
3832
3734
|
if (attributes) assignAttribute(attributes, marker === 46 ? "class" : "id", source.slice(valueStart, offset));
|
|
3833
3735
|
continue;
|
|
@@ -3866,7 +3768,7 @@ function scanAttributes(source, start, attributes, limit = source.length) {
|
|
|
3866
3768
|
if (offset < 0) return;
|
|
3867
3769
|
valueEnd = offset;
|
|
3868
3770
|
} else {
|
|
3869
|
-
offset = scanUntil(source, offset, limit,
|
|
3771
|
+
offset = scanUntil(source, offset, limit, false);
|
|
3870
3772
|
valueEnd = offset;
|
|
3871
3773
|
if (valueEnd === valueStart) return;
|
|
3872
3774
|
}
|
|
@@ -3911,33 +3813,7 @@ function footnoteLabelAt(source, start, limit) {
|
|
|
3911
3813
|
}
|
|
3912
3814
|
}
|
|
3913
3815
|
// src/profile/resolve.ts
|
|
3914
|
-
|
|
3915
|
-
if (source.charCodeAt(start) !== 91) return -1;
|
|
3916
|
-
let offset = start + 1;
|
|
3917
|
-
if (source.charCodeAt(offset) === 93) return offset + 1;
|
|
3918
|
-
let characters = 0;
|
|
3919
|
-
let hasContent = false;
|
|
3920
|
-
while (offset < source.length && characters < 999) {
|
|
3921
|
-
const code = source.charCodeAt(offset);
|
|
3922
|
-
if (code === 93) return hasContent ? offset + 1 : -1;
|
|
3923
|
-
if (code === 91) return -1;
|
|
3924
|
-
if (code === 92) {
|
|
3925
|
-
if (offset + 1 >= source.length) return -1;
|
|
3926
|
-
hasContent = true;
|
|
3927
|
-
offset += 2;
|
|
3928
|
-
} else {
|
|
3929
|
-
hasContent ||= !isSpaceTabOrLineEnding(code);
|
|
3930
|
-
offset++;
|
|
3931
|
-
}
|
|
3932
|
-
characters++;
|
|
3933
|
-
}
|
|
3934
|
-
return -1;
|
|
3935
|
-
}
|
|
3936
|
-
const withinLabelLimit = /^.{1,999}$/su;
|
|
3937
|
-
const acceptedLabel = /[^ \t\r\n]/;
|
|
3938
|
-
function acceptsShortcutLabel(label) {
|
|
3939
|
-
return label.length > 999 ? label.length <= 1998 && withinLabelLimit.test(label) : acceptedLabel.test(label);
|
|
3940
|
-
}
|
|
3816
|
+
const referenceTail = /\[(?:[^[\]\\]|\\[\s\S])*\]/y;
|
|
3941
3817
|
function opensComponentLabel(tokens, open) {
|
|
3942
3818
|
return open > 0 && inlineTokenKind(tokens, open - 1) === 136 && inlineTokenEnd(tokens, open - 1) === inlineTokenStart(tokens, open);
|
|
3943
3819
|
}
|
|
@@ -3969,16 +3845,17 @@ function matchedLinkEnd(source, tokens, definitions, open, close, lastVisibleOpe
|
|
|
3969
3845
|
const end = inlineTokenEnd(tokens, close);
|
|
3970
3846
|
if (inlineTokenKind(tokens, close) === 68) return end;
|
|
3971
3847
|
if (!definitions.hasDefinitions()) return -1;
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
if (
|
|
3976
|
-
|
|
3977
|
-
|
|
3848
|
+
referenceTail.lastIndex = end;
|
|
3849
|
+
let suffixEnd = referenceTail.test(source) ? referenceTail.lastIndex : -1;
|
|
3850
|
+
let identifier = suffixEnd > end + 2 ? referenceIdentifier(source.slice(end + 1, suffixEnd - 1)) : "";
|
|
3851
|
+
if (!identifier) {
|
|
3852
|
+
if (suffixEnd !== end + 2) {
|
|
3853
|
+
if (lastVisibleOpener > open) return -1;
|
|
3854
|
+
suffixEnd = end;
|
|
3855
|
+
}
|
|
3856
|
+
identifier = referenceIdentifier(source.slice(inlineTokenEnd(tokens, open), inlineTokenStart(tokens, close)));
|
|
3978
3857
|
}
|
|
3979
|
-
|
|
3980
|
-
const label = source.slice(contentStart, contentEnd);
|
|
3981
|
-
return acceptsShortcutLabel(label) && definitions.hasDefinition(normalizeIdentifier(label)) ? end : -1;
|
|
3858
|
+
return definitions.hasDefinition(identifier) ? suffixEnd : -1;
|
|
3982
3859
|
}
|
|
3983
3860
|
function setBoundary(tokens, index, kind, end) {
|
|
3984
3861
|
const field = index * 4;
|
|
@@ -4198,8 +4075,7 @@ function tokenizeLatin1(scanners, masks, source, mapping) {
|
|
|
4198
4075
|
do {
|
|
4199
4076
|
const markerOffset = group + 31 - Math.clz32(bits & -bits) - base;
|
|
4200
4077
|
if (markerOffset >= end) break groups;
|
|
4201
|
-
const
|
|
4202
|
-
const next = scan?.(source, markerOffset, tokens ??= []) ?? markerOffset;
|
|
4078
|
+
const next = (0, scanners[source.charCodeAt(markerOffset)])?.(source, markerOffset, tokens ??= []) ?? markerOffset;
|
|
4203
4079
|
offset = next > markerOffset ? next : markerOffset + 1;
|
|
4204
4080
|
cursor = base + offset;
|
|
4205
4081
|
if (cursor >= groupEnd) break;
|
|
@@ -4222,8 +4098,7 @@ function createInlineTokenizer(boundaryFast, boundarySlow, scanners, masks) {
|
|
|
4222
4098
|
for (let cursor = 0; cursor < source.length;) {
|
|
4223
4099
|
const offset = findPatternEnd(source, cursor, boundary) - 1;
|
|
4224
4100
|
if (offset < 0) break;
|
|
4225
|
-
const
|
|
4226
|
-
const end = scan?.(source, offset, tokens ??= []) ?? offset;
|
|
4101
|
+
const end = (0, scanners[source.charCodeAt(offset)])?.(source, offset, tokens ??= []) ?? offset;
|
|
4227
4102
|
cursor = end > offset ? end : offset + 1;
|
|
4228
4103
|
}
|
|
4229
4104
|
return tokens ?? emptyArray;
|
|
@@ -4489,12 +4364,13 @@ const feature$16 = { block: {
|
|
|
4489
4364
|
const tokens = context.structure.tokens;
|
|
4490
4365
|
const close = tokenStart + tokens.nodeLength(tokenStart) - 1;
|
|
4491
4366
|
const start = context.locator.locationAt(tokens.start(tokenStart));
|
|
4367
|
+
const children = buildBlockChildren(tokenStart, context);
|
|
4492
4368
|
return {
|
|
4493
4369
|
type: "blockquote",
|
|
4494
|
-
children
|
|
4370
|
+
children,
|
|
4495
4371
|
position: {
|
|
4496
4372
|
start,
|
|
4497
|
-
end: context.locator.locationAt(tokens.end(close))
|
|
4373
|
+
end: context.locator.locationAt(Math.max(tokens.end(close), children.at(-1)?.position?.end.offset ?? 0))
|
|
4498
4374
|
}
|
|
4499
4375
|
};
|
|
4500
4376
|
}
|
|
@@ -4679,26 +4555,25 @@ function logicalFenceContent(source, lines, start, last, closed, indent, normali
|
|
|
4679
4555
|
return parts.join(normalizeEndings ? "\n" : "");
|
|
4680
4556
|
}
|
|
4681
4557
|
// src/profile/features/code.ts
|
|
4682
|
-
const complexInfo = /[\\& \t]
|
|
4683
|
-
const separator = /[ \t]
|
|
4558
|
+
const complexInfo = /[\\& \t]/;
|
|
4559
|
+
const separator = /[ \t]+/;
|
|
4684
4560
|
function buildFencedCode(info, value) {
|
|
4685
|
-
|
|
4686
|
-
let langEnd = complexInfo.test(info) ? complexInfo.lastIndex - 1 : -1;
|
|
4687
|
-
if (langEnd >= 0) {
|
|
4688
|
-
const code = info.charCodeAt(langEnd);
|
|
4689
|
-
info = decodeString(info);
|
|
4690
|
-
if (code !== 32 && code !== 9) {
|
|
4691
|
-
separator.lastIndex = langEnd;
|
|
4692
|
-
langEnd = separator.test(info) ? separator.lastIndex - 1 : -1;
|
|
4693
|
-
}
|
|
4694
|
-
}
|
|
4695
|
-
return {
|
|
4561
|
+
const node = {
|
|
4696
4562
|
type: "code",
|
|
4697
|
-
lang:
|
|
4698
|
-
meta:
|
|
4563
|
+
lang: info || null,
|
|
4564
|
+
meta: null,
|
|
4699
4565
|
value,
|
|
4700
4566
|
position: void 0
|
|
4701
4567
|
};
|
|
4568
|
+
if (info && complexInfo.test(info)) {
|
|
4569
|
+
const match = separator.exec(info);
|
|
4570
|
+
if (match) {
|
|
4571
|
+
node.meta = decodeString(info.slice(match.index + match[0].length)) || null;
|
|
4572
|
+
info = info.slice(0, match.index);
|
|
4573
|
+
}
|
|
4574
|
+
node.lang = decodeString(info) || null;
|
|
4575
|
+
}
|
|
4576
|
+
return node;
|
|
4702
4577
|
}
|
|
4703
4578
|
const backtickFence = createFence({
|
|
4704
4579
|
marker: 96,
|
|
@@ -4847,8 +4722,7 @@ function appendTextRange(context, output, trimEnd) {
|
|
|
4847
4722
|
appendText(context, output, "\n", childStart, childEnd, false);
|
|
4848
4723
|
} else {
|
|
4849
4724
|
if (childStart > output.end) appendGap(context, output, output.end, childStart);
|
|
4850
|
-
|
|
4851
|
-
appendText(context, output, build(index, context), childStart, childEnd, kind === 64);
|
|
4725
|
+
appendText(context, output, (0, context.profile.builders[kind])(index, context), childStart, childEnd, kind === 64);
|
|
4852
4726
|
}
|
|
4853
4727
|
index++;
|
|
4854
4728
|
continue;
|
|
@@ -4860,8 +4734,7 @@ function appendTextRange(context, output, trimEnd) {
|
|
|
4860
4734
|
start: sourceStart,
|
|
4861
4735
|
end: childStart === childEnd ? sourceStart : context.view.mapEnd(childEnd)
|
|
4862
4736
|
};
|
|
4863
|
-
|
|
4864
|
-
if (decorate(index, sourceSpan, context, output)) {
|
|
4737
|
+
if ((0, context.profile.builders[kind])(index, sourceSpan, context, output)) {
|
|
4865
4738
|
const previous = output.children.at(-1);
|
|
4866
4739
|
output.pendingText = previous?.type === "text" ? previous : void 0;
|
|
4867
4740
|
output.end = childEnd;
|
|
@@ -4886,9 +4759,9 @@ function buildLiteral(context, start, end) {
|
|
|
4886
4759
|
}
|
|
4887
4760
|
function buildFragment(context, cursor, closer) {
|
|
4888
4761
|
const trimEnd = closer === 0;
|
|
4889
|
-
const children = [];
|
|
4890
4762
|
const tokens = context.tokens;
|
|
4891
4763
|
const end = inlineTokenCount(tokens);
|
|
4764
|
+
let children;
|
|
4892
4765
|
let output;
|
|
4893
4766
|
while (context.tokenIndex < end) {
|
|
4894
4767
|
const index = context.tokenIndex;
|
|
@@ -4900,7 +4773,7 @@ function buildFragment(context, cursor, closer) {
|
|
|
4900
4773
|
output.pendingText = void 0;
|
|
4901
4774
|
output.literalStart = 0;
|
|
4902
4775
|
} else output = {
|
|
4903
|
-
children,
|
|
4776
|
+
children: children ??= [],
|
|
4904
4777
|
end: cursor,
|
|
4905
4778
|
pendingText: void 0,
|
|
4906
4779
|
literalStart: 0
|
|
@@ -4910,7 +4783,10 @@ function buildFragment(context, cursor, closer) {
|
|
|
4910
4783
|
continue;
|
|
4911
4784
|
}
|
|
4912
4785
|
const startOffset = inlineTokenStart(tokens, index);
|
|
4913
|
-
if (cursor < startOffset)
|
|
4786
|
+
if (cursor < startOffset) {
|
|
4787
|
+
const node = buildLiteral(context, cursor, startOffset);
|
|
4788
|
+
children?.push(node) ?? (children = [node]);
|
|
4789
|
+
}
|
|
4914
4790
|
const sourceStart = context.view.mapOffset(startOffset);
|
|
4915
4791
|
const start = context.locator.locationAt(sourceStart);
|
|
4916
4792
|
let nested;
|
|
@@ -4931,13 +4807,16 @@ function buildFragment(context, cursor, closer) {
|
|
|
4931
4807
|
};
|
|
4932
4808
|
const build = context.profile.builders[kind];
|
|
4933
4809
|
const node = nested ? build(index, close, position, nested, context) : build(index, position, context);
|
|
4934
|
-
children
|
|
4810
|
+
children?.push(node) ?? (children = [node]);
|
|
4935
4811
|
cursor = endOffset;
|
|
4936
4812
|
}
|
|
4937
4813
|
let tail = context.tokenIndex < end ? inlineTokenStart(tokens, context.tokenIndex) : context.view.text.length;
|
|
4938
4814
|
if (cursor < tail && trimEnd) tail = trimLineWhitespaceEnd(context.view.text, cursor, tail);
|
|
4939
|
-
if (cursor < tail)
|
|
4940
|
-
|
|
4815
|
+
if (cursor < tail) {
|
|
4816
|
+
const node = buildLiteral(context, cursor, tail);
|
|
4817
|
+
children?.push(node) ?? (children = [node]);
|
|
4818
|
+
}
|
|
4819
|
+
return output ?? { children: children ??= [] };
|
|
4941
4820
|
}
|
|
4942
4821
|
function buildInlineFragment(tokenStart, tableCell, context) {
|
|
4943
4822
|
let tokens;
|
|
@@ -4953,7 +4832,7 @@ function buildInlineFragment(tokenStart, tableCell, context) {
|
|
|
4953
4832
|
if (nodeLength <= 1 || blockTokens.kind(tokenStart + 1) !== 1) return { children: [] };
|
|
4954
4833
|
view = context.view;
|
|
4955
4834
|
view.reset(context.source, blockTokens, tokenStart, nodeLength);
|
|
4956
|
-
tokens = view.tokenize(context.profile.tokenize,
|
|
4835
|
+
tokens = view.tokenize(context.profile.tokenize, true);
|
|
4957
4836
|
if (tokens.length) tokens = context.profile.resolve(view.text, tokens, blockTokens, true);
|
|
4958
4837
|
}
|
|
4959
4838
|
context.tableCell = tableCell;
|
|
@@ -5050,23 +4929,16 @@ function closingBracket(source, start, limit) {
|
|
|
5050
4929
|
}
|
|
5051
4930
|
}
|
|
5052
4931
|
}
|
|
5053
|
-
function lineValue(source, lines, index) {
|
|
5054
|
-
const offset = lineIndentOffset(source, lines, index);
|
|
5055
|
-
return offset < 0 ? void 0 : source.slice(offset, lines.end(index));
|
|
5056
|
-
}
|
|
5057
|
-
function yamlClosingMarker(value) {
|
|
5058
|
-
switch (value) {
|
|
5059
|
-
case "---": return "---";
|
|
5060
|
-
case "```yaml [props]":
|
|
5061
|
-
case "```yml [props]": return "```";
|
|
5062
|
-
case "~~~yaml [props]":
|
|
5063
|
-
case "~~~yml [props]": return "~~~";
|
|
5064
|
-
}
|
|
5065
|
-
}
|
|
5066
4932
|
function yamlPropsEnd(source, lines, start, end) {
|
|
5067
|
-
const
|
|
4933
|
+
const offset = lineIndentOffset(source, lines, start);
|
|
4934
|
+
if (offset < 0) return;
|
|
4935
|
+
const opening = source.slice(offset, lines.end(start));
|
|
4936
|
+
const marker = opening === "---" ? "---" : opening === "```yaml [props]" || opening === "```yml [props]" ? "```" : opening === `~~~yaml [props]` || opening === `~~~yml [props]` ? `~~~` : void 0;
|
|
5068
4937
|
if (!marker) return;
|
|
5069
|
-
for (let index = start + 1; index < end; index++)
|
|
4938
|
+
for (let index = start + 1; index < end; index++) {
|
|
4939
|
+
const lineEnd = lines.end(index);
|
|
4940
|
+
if (source.endsWith(marker, lineEnd) && lineIndentOffset(source, lines, index) === lineEnd - marker.length) return index + 1;
|
|
4941
|
+
}
|
|
5070
4942
|
}
|
|
5071
4943
|
function slotOpeningAt(source, lines, index, contentOffset) {
|
|
5072
4944
|
if (source.charCodeAt(contentOffset) !== 35) return;
|
|
@@ -5129,12 +5001,12 @@ function blockOpeningAt(source, lines, index, contentOffset, shorthand) {
|
|
|
5129
5001
|
nameEnd
|
|
5130
5002
|
};
|
|
5131
5003
|
}
|
|
5132
|
-
function blockClose(source, lines, start, opening) {
|
|
5004
|
+
function blockClose(source, lines, start, end, opening) {
|
|
5133
5005
|
let depth = 0;
|
|
5134
|
-
for (let index = start + 1; index <
|
|
5006
|
+
for (let index = start + 1; index < end; index++) {
|
|
5135
5007
|
const contentOffset = lineIndentOffset(source, lines, index);
|
|
5136
5008
|
if (contentOffset < 0) continue;
|
|
5137
|
-
const close = codeFenceClosingLine(source, lines, index,
|
|
5009
|
+
const close = codeFenceClosingLine(source, lines, index, end, contentOffset);
|
|
5138
5010
|
if (close !== void 0) {
|
|
5139
5011
|
index = close;
|
|
5140
5012
|
continue;
|
|
@@ -5167,7 +5039,7 @@ function nextSlot(source, lines, start, end) {
|
|
|
5167
5039
|
opening: slot
|
|
5168
5040
|
};
|
|
5169
5041
|
const nested = blockOpeningAt(source, lines, index, contentOffset, false);
|
|
5170
|
-
if (nested) index = blockClose(source, lines, index, nested)?.index ?? index;
|
|
5042
|
+
if (nested) index = blockClose(source, lines, index, end, nested)?.index ?? index;
|
|
5171
5043
|
}
|
|
5172
5044
|
}
|
|
5173
5045
|
function emitComponentBody(source, lines, tokens, start, end, closingOffset, context) {
|
|
@@ -5222,7 +5094,7 @@ function createBlockStart(shorthand) {
|
|
|
5222
5094
|
tokens.push(200, lineEnd, lineEnd);
|
|
5223
5095
|
return start + 1;
|
|
5224
5096
|
}
|
|
5225
|
-
const closing = blockClose(source, lines, start, opening);
|
|
5097
|
+
const closing = blockClose(source, lines, start, lines.length, opening);
|
|
5226
5098
|
if (!closing) {
|
|
5227
5099
|
context.retainLookahead(lines.next(lines.length - 1));
|
|
5228
5100
|
return;
|
|
@@ -5652,8 +5524,11 @@ const htmlAttribute = `\\s+[a-z_:][\\w.:-]*(?:\\s*=\\s*(?:[^\\s"'=<>\`]+|'[^']*'
|
|
|
5652
5524
|
const htmlTag = /^<\/?([a-z][a-z0-9-]*)(?=[ \t\n\r/>]|$)/i;
|
|
5653
5525
|
const htmlTagDelimiter = /[ \t>]/;
|
|
5654
5526
|
const completeHtmlTag = new RegExp(`^(?:<${htmlTagName}(?:${htmlAttribute})*\\s*/?>|</${htmlTagName}\\s*>)[ \\t]*$`, "i");
|
|
5655
|
-
const htmlComment = /<!--(
|
|
5656
|
-
const
|
|
5527
|
+
const htmlComment = /<!--(?:-?>|.*?-->)/sy;
|
|
5528
|
+
const uriAutolink = /[A-Z][A-Z0-9+.\-]{1,31}:[^\x00-\x20\x7f<>]*/;
|
|
5529
|
+
const emailLocal = /[\w!#$%&'*+\-/=?^`{|}~.]+/;
|
|
5530
|
+
const domainLabel = /[A-Z0-9][A-Z0-9-]{0,62}\b/;
|
|
5531
|
+
const autolink = new RegExp(`<(?:${uriAutolink.source}|${emailLocal.source}@${domainLabel.source}(?:\\.${domainLabel.source})*)>`, "iy");
|
|
5657
5532
|
const inlineHtml = /<[A-Za-z][A-Za-z0-9-]*(?:[ \t\n\r]+[A-Za-z_:][\w.:-]*(?:[ \t\n\r]*=[ \t\n\r]*(?:[^ \t\n\r"'=<>`]+|'[^']*'|"[^"]*"))?)*[ \t\n\r]*\/?>|<\/[A-Za-z][A-Za-z0-9-]*[ \t\n\r]*>|<\?[\s\S]*?\?>|<![A-Za-z][\s\S]*?>|<!\[CDATA\[[\s\S]*?\]\]>/y;
|
|
5658
5533
|
function htmlTerminator(body, allowCompleteTag) {
|
|
5659
5534
|
switch (body.charCodeAt(1)) {
|
|
@@ -5707,12 +5582,14 @@ const feature$7 = {
|
|
|
5707
5582
|
scans: [{
|
|
5708
5583
|
marker: 60,
|
|
5709
5584
|
scan(source, start, tokens) {
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5585
|
+
if (source.startsWith("<!--", start)) {
|
|
5586
|
+
const end = findPatternEnd(source, start, htmlComment);
|
|
5587
|
+
if (end < 0) return start + 1;
|
|
5588
|
+
appendInlineToken(tokens, 130, start, end);
|
|
5589
|
+
return end;
|
|
5715
5590
|
}
|
|
5591
|
+
let end = findPatternEnd(source, start, autolink);
|
|
5592
|
+
let kind = 131;
|
|
5716
5593
|
if (end < 0) {
|
|
5717
5594
|
end = findPatternEnd(source, start, inlineHtml);
|
|
5718
5595
|
kind = 130;
|
|
@@ -5771,20 +5648,20 @@ function linkDestinationEnd(source, start, end) {
|
|
|
5771
5648
|
}
|
|
5772
5649
|
return end > start && depth === 0 ? end : -1;
|
|
5773
5650
|
}
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
if (marker !== 34 && marker !== 39 && marker !== 40) return -1;
|
|
5778
|
-
let end = start + 1;
|
|
5779
|
-
while (end < source.length) {
|
|
5780
|
-
const code = source.charCodeAt(end);
|
|
5781
|
-
if (code === close) return end + 1;
|
|
5782
|
-
if (code === 10 || code === 13) return -1;
|
|
5783
|
-
end += code === 92 && end + 1 < source.length ? 2 : 1;
|
|
5784
|
-
}
|
|
5785
|
-
return -1;
|
|
5786
|
-
}
|
|
5651
|
+
const titleLineEnding = /[\r\n]/;
|
|
5652
|
+
const titleIndent = /(?<=[\r\n])[ \t]+/g;
|
|
5653
|
+
const titleTail = /(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\((?:[^)\\]|\\.)*\))[ \t\r\n]*/sy;
|
|
5787
5654
|
const destinationTail = /[^<\\()\t\n\r ]*\)?/y;
|
|
5655
|
+
function decodeLinkTitle(source) {
|
|
5656
|
+
return decodeString(titleLineEnding.test(source) ? source.replace(titleIndent, "") : source);
|
|
5657
|
+
}
|
|
5658
|
+
function resourceTail(source, destinationEnd) {
|
|
5659
|
+
const start = skipWhitespace(source, destinationEnd);
|
|
5660
|
+
if (source.charCodeAt(start) === 41) return start;
|
|
5661
|
+
if (start === destinationEnd) return -1;
|
|
5662
|
+
const tail = findPatternEnd(source, start, titleTail);
|
|
5663
|
+
return source.charCodeAt(tail) === 41 ? tail : -1;
|
|
5664
|
+
}
|
|
5788
5665
|
function scanLinkTail(source, start, tokens) {
|
|
5789
5666
|
if (source.charCodeAt(start + 1) !== 40) return -1;
|
|
5790
5667
|
const contentStart = start + 2;
|
|
@@ -5800,14 +5677,8 @@ function scanLinkTail(source, start, tokens) {
|
|
|
5800
5677
|
if (source.charCodeAt(offset) !== 41) {
|
|
5801
5678
|
destinationEnd = linkDestinationEnd(source, offset, Math.max(offset, prefixEnd));
|
|
5802
5679
|
if (destinationEnd < 0) return -1;
|
|
5803
|
-
offset = destinationEnd;
|
|
5804
|
-
|
|
5805
|
-
if (whitespaceEnd > offset && source.charCodeAt(whitespaceEnd) !== 41) {
|
|
5806
|
-
const titleEnd = linkTitleEnd(source, whitespaceEnd);
|
|
5807
|
-
if (titleEnd < 0) return -1;
|
|
5808
|
-
offset = skipWhitespace(source, titleEnd);
|
|
5809
|
-
} else offset = whitespaceEnd;
|
|
5810
|
-
if (source.charCodeAt(offset) !== 41) return -1;
|
|
5680
|
+
offset = resourceTail(source, destinationEnd);
|
|
5681
|
+
if (offset < 0) return -1;
|
|
5811
5682
|
}
|
|
5812
5683
|
const end = offset + 1;
|
|
5813
5684
|
appendInlineToken(tokens, 68, start, end, destinationEnd - start);
|
|
@@ -5869,7 +5740,7 @@ function createBuildMedia(media, resourceKind) {
|
|
|
5869
5740
|
if (titleStart < end) {
|
|
5870
5741
|
let titleEnd = end;
|
|
5871
5742
|
while (isSpaceTabOrLineEnding(source.charCodeAt(titleEnd - 1))) titleEnd--;
|
|
5872
|
-
title =
|
|
5743
|
+
title = decodeLinkTitle(source.slice(titleStart + 1, titleEnd - 1));
|
|
5873
5744
|
}
|
|
5874
5745
|
}
|
|
5875
5746
|
const url = decodeString(source.slice(start, destinationEnd));
|
|
@@ -6107,12 +5978,19 @@ const listStart = (source, lines, tokens, start, contentOffset, context) => {
|
|
|
6107
5978
|
let listEnd = marker.end;
|
|
6108
5979
|
let listSpread = false;
|
|
6109
5980
|
let trailingBlank = false;
|
|
5981
|
+
let itemLines;
|
|
5982
|
+
let itemSpread;
|
|
5983
|
+
let previousEnd;
|
|
5984
|
+
const visit = (lineStart, lineEnd) => {
|
|
5985
|
+
itemSpread ||= previousEnd >= 0 && (lineStart > previousEnd || isBlankLine(source, itemLines, previousEnd - 1));
|
|
5986
|
+
previousEnd = lineEnd;
|
|
5987
|
+
};
|
|
6110
5988
|
while (marker?.delimiter === delimiter) {
|
|
6111
5989
|
let sibling;
|
|
6112
5990
|
listSpread ||= trailingBlank;
|
|
6113
5991
|
trailingBlank = false;
|
|
6114
5992
|
tokens.push(75, marker.offset, marker.end);
|
|
6115
|
-
|
|
5993
|
+
itemLines = context.createLineView(lines, index, marker.contentOffset, marker.contentPrefixColumns);
|
|
6116
5994
|
let hasContent = marker.hasContent;
|
|
6117
5995
|
let paragraphLeaf = hasContent ? 2 : 0;
|
|
6118
5996
|
index++;
|
|
@@ -6148,12 +6026,9 @@ const listStart = (source, lines, tokens, start, contentOffset, context) => {
|
|
|
6148
6026
|
itemLines.pushLazy(lines, index);
|
|
6149
6027
|
index++;
|
|
6150
6028
|
}
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
context.scanBlockLines(source, itemLines, tokens,
|
|
6154
|
-
itemSpread ||= previousEnd >= 0 && (lineStart > previousEnd || isBlankLine(source, itemLines, previousEnd - 1));
|
|
6155
|
-
previousEnd = lineEnd;
|
|
6156
|
-
});
|
|
6029
|
+
previousEnd = -1;
|
|
6030
|
+
itemSpread = false;
|
|
6031
|
+
context.scanBlockLines(source, itemLines, tokens, visit);
|
|
6157
6032
|
const itemEnd = itemLines.length ? itemLines.end(itemLines.length - 1) : marker.end;
|
|
6158
6033
|
tokens.push(itemSpread ? 194 : 193, itemEnd, itemEnd);
|
|
6159
6034
|
listEnd = itemEnd;
|
|
@@ -6361,35 +6236,29 @@ function titleCloser(code) {
|
|
|
6361
6236
|
function scanMultilineLabel(source, lines, startIndex, labelStart, offset, context) {
|
|
6362
6237
|
let lineIndex = startIndex;
|
|
6363
6238
|
let label = "";
|
|
6364
|
-
let labelLength = offset - labelStart;
|
|
6365
|
-
if (labelLength > 999) return;
|
|
6366
|
-
let labelHasContent = trimLineWhitespaceStart(source, labelStart, offset) < offset;
|
|
6367
6239
|
while (true) {
|
|
6368
6240
|
const lineEnd = lines.end(lineIndex);
|
|
6369
|
-
|
|
6241
|
+
const limit = Math.min(lineEnd, labelStart + maximumLabelUnits - label.length + 1);
|
|
6242
|
+
while (offset < limit) {
|
|
6370
6243
|
const code = source.charCodeAt(offset);
|
|
6371
6244
|
if (code === 92 && offset + 1 < lineEnd) {
|
|
6372
|
-
labelHasContent = true;
|
|
6373
|
-
labelLength += 2;
|
|
6374
6245
|
offset += 2;
|
|
6375
6246
|
continue;
|
|
6376
6247
|
}
|
|
6377
6248
|
if (code === 91) return;
|
|
6378
6249
|
if (code === 93) {
|
|
6379
|
-
if (source.charCodeAt(offset + 1) === 58
|
|
6250
|
+
if (source.charCodeAt(offset + 1) === 58) return {
|
|
6380
6251
|
label: label + source.slice(labelStart, offset),
|
|
6381
6252
|
lineIndex,
|
|
6382
6253
|
offset: offset + 2
|
|
6383
6254
|
};
|
|
6384
6255
|
return;
|
|
6385
6256
|
}
|
|
6386
|
-
if (code !== 32 && code !== 9) labelHasContent = true;
|
|
6387
|
-
if (++labelLength > 999) return;
|
|
6388
6257
|
offset++;
|
|
6389
6258
|
}
|
|
6390
6259
|
const nextLine = lineIndex + 1;
|
|
6391
6260
|
context.retainLookahead(nextLine < lines.length ? lines.end(nextLine) : lines.next(lineIndex));
|
|
6392
|
-
if (nextLine >= lines.length || isBlankLine(source, lines, nextLine)
|
|
6261
|
+
if (label.length + lines.next(lineIndex) - labelStart > 1998 || nextLine >= lines.length || isBlankLine(source, lines, nextLine)) return;
|
|
6393
6262
|
label += source.slice(labelStart, lines.next(lineIndex));
|
|
6394
6263
|
lineIndex = nextLine;
|
|
6395
6264
|
offset = lines.start(lineIndex);
|
|
@@ -6480,7 +6349,7 @@ const linkDefinitionStart = (source, lines, tokens, start, contentOffset, contex
|
|
|
6480
6349
|
let offset;
|
|
6481
6350
|
const stopCode = stop < firstLineEnd ? source.charCodeAt(stop) : 0;
|
|
6482
6351
|
if (stopCode === 93) {
|
|
6483
|
-
if (source.charCodeAt(stop + 1) !== 58
|
|
6352
|
+
if (source.charCodeAt(stop + 1) !== 58) return;
|
|
6484
6353
|
label = source.slice(labelStart, stop);
|
|
6485
6354
|
offset = stop + 2;
|
|
6486
6355
|
} else {
|
|
@@ -6491,6 +6360,8 @@ const linkDefinitionStart = (source, lines, tokens, start, contentOffset, contex
|
|
|
6491
6360
|
lineIndex = match.lineIndex;
|
|
6492
6361
|
offset = match.offset;
|
|
6493
6362
|
}
|
|
6363
|
+
const identifier = referenceIdentifier(label);
|
|
6364
|
+
if (!identifier) return;
|
|
6494
6365
|
let lineEnd = lines.end(lineIndex);
|
|
6495
6366
|
offset = trimLineWhitespaceStart(source, offset, lineEnd);
|
|
6496
6367
|
if (offset === lineEnd) {
|
|
@@ -6536,14 +6407,13 @@ const linkDefinitionStart = (source, lines, tokens, start, contentOffset, contex
|
|
|
6536
6407
|
title = match.title;
|
|
6537
6408
|
endLine = match.endLine;
|
|
6538
6409
|
}
|
|
6539
|
-
const identifier = normalizeIdentifier(label);
|
|
6540
6410
|
return {
|
|
6541
6411
|
node: {
|
|
6542
6412
|
type: "definition",
|
|
6543
6413
|
identifier,
|
|
6544
6414
|
label: decodeString(label),
|
|
6545
6415
|
url: decodeString(destination),
|
|
6546
|
-
title: title === void 0 ? null :
|
|
6416
|
+
title: title === void 0 ? null : decodeLinkTitle(title),
|
|
6547
6417
|
position: void 0
|
|
6548
6418
|
},
|
|
6549
6419
|
nextLine: endLine,
|
|
@@ -6637,27 +6507,42 @@ function emitTableRow(source, tokens, contentOffset, lineEnd, visibleEnd, nextPi
|
|
|
6637
6507
|
function buildTableRow(tokenStart, context) {
|
|
6638
6508
|
const tokens = context.structure.tokens;
|
|
6639
6509
|
const close = tokenStart + tokens.nodeLength(tokenStart) - 1;
|
|
6640
|
-
const
|
|
6641
|
-
const
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6510
|
+
const offset = tokens.start(tokenStart);
|
|
6511
|
+
const start = context.locator.locationAt(offset);
|
|
6512
|
+
const columnShift = start.column - offset;
|
|
6513
|
+
const children = new Array(close - tokenStart - 1 >>> 1);
|
|
6514
|
+
for (let index = 0; index < children.length; index++) {
|
|
6515
|
+
const cell = tokenStart + 1 + index * 2;
|
|
6516
|
+
const from = tokens.start(cell);
|
|
6517
|
+
const to = tokens.start(cell + 2);
|
|
6518
|
+
children[index] = {
|
|
6646
6519
|
type: "tableCell",
|
|
6647
6520
|
children: buildInlineFragment(cell, true, context).children,
|
|
6648
6521
|
position: {
|
|
6649
|
-
start
|
|
6650
|
-
|
|
6522
|
+
start: {
|
|
6523
|
+
line: start.line,
|
|
6524
|
+
column: from + columnShift,
|
|
6525
|
+
offset: from
|
|
6526
|
+
},
|
|
6527
|
+
end: {
|
|
6528
|
+
line: start.line,
|
|
6529
|
+
column: to + columnShift,
|
|
6530
|
+
offset: to
|
|
6531
|
+
}
|
|
6651
6532
|
}
|
|
6652
|
-
}
|
|
6653
|
-
cell = next;
|
|
6533
|
+
};
|
|
6654
6534
|
}
|
|
6535
|
+
const end = tokens.start(close);
|
|
6655
6536
|
return {
|
|
6656
6537
|
type: "tableRow",
|
|
6657
6538
|
children,
|
|
6658
6539
|
position: {
|
|
6659
6540
|
start,
|
|
6660
|
-
end:
|
|
6541
|
+
end: {
|
|
6542
|
+
line: start.line,
|
|
6543
|
+
column: end + columnShift,
|
|
6544
|
+
offset: end
|
|
6545
|
+
}
|
|
6661
6546
|
}
|
|
6662
6547
|
};
|
|
6663
6548
|
}
|