@tiaforge-ui/sinter-markdown 0.0.0-stage → 0.20.0
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 +305 -2
- package/docs/markdown.md +258 -0
- package/docs/recipes/article-with-comments.html +28 -0
- package/llms.txt +44 -0
- package/package.json +65 -4
- package/sinter/components/internal/md-block.html +7 -0
- package/sinter/components/internal/md-blockquote.html +3 -0
- package/sinter/components/internal/md-break.html +3 -0
- package/sinter/components/internal/md-code.html +4 -0
- package/sinter/components/internal/md-delete.html +3 -0
- package/sinter/components/internal/md-details.html +4 -0
- package/sinter/components/internal/md-emphasis.html +3 -0
- package/sinter/components/internal/md-heading.html +4 -0
- package/sinter/components/internal/md-image.html +9 -0
- package/sinter/components/internal/md-inline-code.html +3 -0
- package/sinter/components/internal/md-kbd.html +3 -0
- package/sinter/components/internal/md-link.html +4 -0
- package/sinter/components/internal/md-list-item.html +4 -0
- package/sinter/components/internal/md-list.html +4 -0
- package/sinter/components/internal/md-mark.html +3 -0
- package/sinter/components/internal/md-paragraph.html +3 -0
- package/sinter/components/internal/md-phrasing.html +9 -0
- package/sinter/components/internal/md-strong.html +3 -0
- package/sinter/components/internal/md-sub.html +3 -0
- package/sinter/components/internal/md-sup.html +3 -0
- package/sinter/components/internal/md-table.html +9 -0
- package/sinter/components/internal/md-thematic-break.html +3 -0
- package/sinter/components/md-doc.html +10 -0
- package/sinter/components/md-inline.html +11 -0
- package/sinter/index.ts +5 -0
- package/sinter/parse.ts +270 -0
- package/sinter/parser.d.ts +19 -0
- package/sinter/parser.js +2872 -0
- package/sinter/sinter.helpers.ts +10 -0
- package/sinter/sinter.types.ts +209 -0
- package/sinter/tree.ts +61 -0
package/sinter/parser.js
ADDED
|
@@ -0,0 +1,2872 @@
|
|
|
1
|
+
// Generated by scripts/build-parser.mjs from scripts/parser-entry.js; do not edit.
|
|
2
|
+
// markdown-it 14.1.0, character-entities 2.0.2; production, non-browser conditions (README.md, "The parser").
|
|
3
|
+
// \0rolldown/runtime.js
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __exportAll = (all, no_symbols) => {
|
|
6
|
+
let target = {};
|
|
7
|
+
for (var name in all) {
|
|
8
|
+
__defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
if (!no_symbols) {
|
|
14
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
+
}
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// scripts/mdurl.js
|
|
20
|
+
var mdurl_exports = /* @__PURE__ */ __exportAll({
|
|
21
|
+
decode: () => decode,
|
|
22
|
+
encode: () => encode,
|
|
23
|
+
format: () => format,
|
|
24
|
+
parse: () => parse
|
|
25
|
+
});
|
|
26
|
+
const unused$1 = () => {
|
|
27
|
+
throw new Error("mdurl is not bundled into sinter/parser.js");
|
|
28
|
+
};
|
|
29
|
+
const decode = unused$1;
|
|
30
|
+
const encode = unused$1;
|
|
31
|
+
const parse = unused$1;
|
|
32
|
+
const format = unused$1;
|
|
33
|
+
|
|
34
|
+
// scripts/uc-micro.js
|
|
35
|
+
var uc_micro_exports = /* @__PURE__ */ __exportAll({
|
|
36
|
+
P: () => P,
|
|
37
|
+
S: () => S
|
|
38
|
+
});
|
|
39
|
+
const P = /\p{P}/u;
|
|
40
|
+
const S = /\p{S}/u;
|
|
41
|
+
|
|
42
|
+
// \0packed-entities
|
|
43
|
+
var _packed_entities_default = "9 Tab 1 NewLine n excl 1 QUOT 0 quot 1 num 1 dollar 1 percnt 1 AMP 0 amp 1 apos 1 lpar 1 rpar 1 ast 0 midast 1 plus 1 comma 2 period 1 sol b colon 1 semi 1 LT 0 lt 0+6he nvlt 1 equals 0+6hx bne 1 GT 0 gt 0+6he nvgt 1 quest 1 commat r lbrack 0 lsqb 1 bsol 1 rbrack 0 rsqb 1 Hat 1 UnderBar 0 lowbar 1 DiacriticalGrave 0 grave 6+2y fjlig l lbrace 0 lcub 1 VerticalLine 0 verbar 0 vert 1 rbrace 0 rcub z NonBreakingSpace 0 nbsp 1 iexcl 1 cent 1 pound 1 curren 1 yen 1 brvbar 1 sect 1 Dot 0 DoubleDot 0 die 0 uml 1 COPY 0 copy 1 ordf 1 laquo 1 not 1 shy 1 REG 0 circledR 0 reg 1 macr 0 strns 1 deg 1 PlusMinus 0 plusmn 0 pm 1 sup2 1 sup3 1 DiacriticalAcute 0 acute 1 micro 1 para 1 CenterDot 0 centerdot 0 middot 1 Cedilla 0 cedil 1 sup1 1 ordm 1 raquo 1 frac14 1 frac12 0 half 1 frac34 1 iquest 1 Agrave 1 Aacute 1 Acirc 1 Atilde 1 Auml 1 Aring 0 angst 1 AElig 1 Ccedil 1 Egrave 1 Eacute 1 Ecirc 1 Euml 1 Igrave 1 Iacute 1 Icirc 1 Iuml 1 ETH 1 Ntilde 1 Ograve 1 Oacute 1 Ocirc 1 Otilde 1 Ouml 1 times 1 Oslash 1 Ugrave 1 Uacute 1 Ucirc 1 Uuml 1 Yacute 1 THORN 1 szlig 1 agrave 1 aacute 1 acirc 1 atilde 1 auml 1 aring 1 aelig 1 ccedil 1 egrave 1 eacute 1 ecirc 1 euml 1 igrave 1 iacute 1 icirc 1 iuml 1 eth 1 ntilde 1 ograve 1 oacute 1 ocirc 1 otilde 1 ouml 1 div 0 divide 1 oslash 1 ugrave 1 uacute 1 ucirc 1 uuml 1 yacute 1 thorn 1 yuml 1 Amacr 1 amacr 1 Abreve 1 abreve 1 Aogon 1 aogon 1 Cacute 1 cacute 1 Ccirc 1 ccirc 1 Cdot 1 cdot 1 Ccaron 1 ccaron 1 Dcaron 1 dcaron 1 Dstrok 1 dstrok 1 Emacr 1 emacr 3 Edot 1 edot 1 Eogon 1 eogon 1 Ecaron 1 ecaron 1 Gcirc 1 gcirc 1 Gbreve 1 gbreve 1 Gdot 1 gdot 1 Gcedil 2 Hcirc 1 hcirc 1 Hstrok 1 hstrok 1 Itilde 1 itilde 1 Imacr 1 imacr 3 Iogon 1 iogon 1 Idot 1 imath 0 inodot 1 IJlig 1 ijlig 1 Jcirc 1 jcirc 1 Kcedil 1 kcedil 1 kgreen 1 Lacute 1 lacute 1 Lcedil 1 lcedil 1 Lcaron 1 lcaron 1 Lmidot 1 lmidot 1 Lstrok 1 lstrok 1 Nacute 1 nacute 1 Ncedil 1 ncedil 1 Ncaron 1 ncaron 1 napos 1 ENG 1 eng 1 Omacr 1 omacr 3 Odblac 1 odblac 1 OElig 1 oelig 1 Racute 1 racute 1 Rcedil 1 rcedil 1 Rcaron 1 rcaron 1 Sacute 1 sacute 1 Scirc 1 scirc 1 Scedil 1 scedil 1 Scaron 1 scaron 1 Tcedil 1 tcedil 1 Tcaron 1 tcaron 1 Tstrok 1 tstrok 1 Utilde 1 utilde 1 Umacr 1 umacr 1 Ubreve 1 ubreve 1 Uring 1 uring 1 Udblac 1 udblac 1 Uogon 1 uogon 1 Wcirc 1 wcirc 1 Ycirc 1 ycirc 1 Yuml 1 Zacute 1 zacute 1 Zdot 1 zdot 1 Zcaron 1 zcaron k fnof z imped 1s gacute 1u jmath 3z circ 1 Hacek 0 caron h Breve 0 breve 1 DiacriticalDot 0 dot 1 ring 1 ogon 1 DiacriticalTilde 0 tilde 1 DiacriticalDoubleAcute 0 dblac 1g DownBreve 3k Alpha 1 Beta 1 Gamma 1 Delta 1 Epsilon 1 Zeta 1 Eta 1 Theta 1 Iota 1 Kappa 1 Lambda 1 Mu 1 Nu 1 Xi 1 Omicron 1 Pi 1 Rho 2 Sigma 1 Tau 1 Upsilon 1 Phi 1 Chi 1 Psi 1 Omega 0 ohm 8 alpha 1 beta 1 gamma 1 delta 1 epsi 0 epsilon 1 zeta 1 eta 1 theta 1 iota 1 kappa 1 lambda 1 mu 1 nu 1 xi 1 omicron 1 pi 1 rho 1 sigmaf 0 sigmav 0 varsigma 1 sigma 1 tau 1 upsi 0 upsilon 1 phi 1 chi 1 psi 1 omega 8 thetasym 0 thetav 0 vartheta 1 Upsi 0 upsih 3 phiv 0 straightphi 0 varphi 1 piv 0 varpi 6 Gammad 1 digamma 0 gammad j kappav 0 varkappa 1 rhov 0 varrho 4 epsiv 0 straightepsilon 0 varepsilon 1 backepsilon 0 bepsi b IOcy 1 DJcy 1 GJcy 1 Jukcy 1 DScy 1 Iukcy 1 YIcy 1 Jsercy 1 LJcy 1 NJcy 1 TSHcy 1 KJcy 2 Ubrcy 1 DZcy 1 Acy 1 Bcy 1 Vcy 1 Gcy 1 Dcy 1 IEcy 1 ZHcy 1 Zcy 1 Icy 1 Jcy 1 Kcy 1 Lcy 1 Mcy 1 Ncy 1 Ocy 1 Pcy 1 Rcy 1 Scy 1 Tcy 1 Ucy 1 Fcy 1 KHcy 1 TScy 1 CHcy 1 SHcy 1 SHCHcy 1 HARDcy 1 Ycy 1 SOFTcy 1 Ecy 1 YUcy 1 YAcy 1 acy 1 bcy 1 vcy 1 gcy 1 dcy 1 iecy 1 zhcy 1 zcy 1 icy 1 jcy 1 kcy 1 lcy 1 mcy 1 ncy 1 ocy 1 pcy 1 rcy 1 scy 1 tcy 1 ucy 1 fcy 1 khcy 1 tscy 1 chcy 1 shcy 1 shchcy 1 hardcy 1 ycy 1 softcy 1 ecy 1 yucy 1 yacy 2 iocy 1 djcy 1 gjcy 1 jukcy 1 dscy 1 iukcy 1 yicy 1 jsercy 1 ljcy 1 njcy 1 tshcy 1 kjcy 2 ubrcy 1 dzcy 5gj ensp 1 emsp 1 emsp13 1 emsp14 2 numsp 1 puncsp 1 ThinSpace 0 thinsp 1 VeryThinSpace 0 hairsp 1 NegativeMediumSpace 0 NegativeThickSpace 0 NegativeThinSpace 0 NegativeVeryThinSpace 0 ZeroWidthSpace 1 zwnj 1 zwj 1 lrm 1 rlm 1 dash 0 hyphen 3 ndash 1 mdash 1 horbar 1 Verbar 0 Vert 2 OpenCurlyQuote 0 lsquo 1 CloseCurlyQuote 0 rsquo 0 rsquor 1 lsquor 0 sbquo 2 OpenCurlyDoubleQuote 0 ldquo 1 CloseCurlyDoubleQuote 0 rdquo 0 rdquor 1 bdquo 0 ldquor 2 dagger 1 Dagger 0 ddagger 1 bull 0 bullet 3 nldr 1 hellip 0 mldr a permil 1 pertenk 1 prime 1 Prime 1 tprime 1 backprime 0 bprime 4 lsaquo 1 rsaquo 4 OverBar 0 oline 3 caret 2 hybull 1 frasl b bsemi 8 qprime 8 MediumSpace 0+6bu ThickSpace 1 NoBreak 1 ApplyFunction 0 af 1 InvisibleTimes 0 it 1 InvisibleComma 0 ic 21 euro 1b TripleDot 0 tdot 1 DotDot 12 Copf 0 complexes 3 incare 5 gscr 1 HilbertSpace 0 Hscr 0 hamilt 1 Hfr 0 Poincareplane 1 Hopf 0 quaternions 1 planckh 1 hbar 0 hslash 0 planck 0 plankv 1 Iscr 0 imagline 1 Ifr 0 Im 0 image 0 imagpart 1 Laplacetrf 0 Lscr 0 lagran 1 ell 2 Nopf 0 naturals 1 numero 1 copysr 1 weierp 0 wp 1 Popf 0 primes 1 Qopf 0 rationals 1 Rscr 0 realine 1 Re 0 Rfr 0 real 0 realpart 1 Ropf 0 reals 1 rx 4 TRADE 0 trade 2 Zopf 0 integers 3 mho 1 Zfr 0 zeetrf 1 iiota 3 Bernoullis 0 Bscr 0 bernou 1 Cayleys 0 Cfr 2 escr 1 Escr 0 expectation 1 Fouriertrf 0 Fscr 2 Mellintrf 0 Mscr 0 phmmat 1 order 0 orderof 0 oscr 1 alefsym 0 aleph 1 beth 1 gimel 1 daleth d CapitalDifferentialD 0 DD 1 DifferentialD 0 dd 1 ExponentialE 0 ee 0 exponentiale 1 ImaginaryI 0 ii b frac13 1 frac23 1 frac15 1 frac25 1 frac35 1 frac45 1 frac16 1 frac56 1 frac18 1 frac38 1 frac58 1 frac78 1e LeftArrow 0 ShortLeftArrow 0 larr 0 leftarrow 0 slarr 1 ShortUpArrow 0 UpArrow 0 uarr 0 uparrow 1 RightArrow 0 ShortRightArrow 0 rarr 0 rightarrow 0 srarr 1 DownArrow 0 ShortDownArrow 0 darr 0 downarrow 1 LeftRightArrow 0 harr 0 leftrightarrow 1 UpDownArrow 0 updownarrow 0 varr 1 UpperLeftArrow 0 nwarr 0 nwarrow 1 UpperRightArrow 0 nearr 0 nearrow 1 LowerRightArrow 0 searr 0 searrow 1 LowerLeftArrow 0 swarr 0 swarrow 1 nlarr 0 nleftarrow 1 nrarr 0 nrightarrow 2 rarrw 0 rightsquigarrow 0+mw nrarrw 1 Larr 0 twoheadleftarrow 1 Uarr 1 Rarr 0 twoheadrightarrow 1 Darr 1 larrtl 0 leftarrowtail 1 rarrtl 0 rightarrowtail 1 LeftTeeArrow 0 mapstoleft 1 UpTeeArrow 0 mapstoup 1 RightTeeArrow 0 map 0 mapsto 1 DownTeeArrow 0 mapstodown 2 hookleftarrow 0 larrhk 1 hookrightarrow 0 rarrhk 1 larrlp 0 looparrowleft 1 looparrowright 0 rarrlp 1 harrw 0 leftrightsquigarrow 1 nharr 0 nleftrightarrow 2 Lsh 0 lsh 1 Rsh 0 rsh 1 ldsh 1 rdsh 2 crarr 1 cularr 0 curvearrowleft 1 curarr 0 curvearrowright 3 circlearrowleft 0 olarr 1 circlearrowright 0 orarr 1 LeftVector 0 leftharpoonup 0 lharu 1 DownLeftVector 0 leftharpoondown 0 lhard 1 RightUpVector 0 uharr 0 upharpoonright 1 LeftUpVector 0 uharl 0 upharpoonleft 1 RightVector 0 rharu 0 rightharpoonup 1 DownRightVector 0 rhard 0 rightharpoondown 1 RightDownVector 0 dharr 0 downharpoonright 1 LeftDownVector 0 dharl 0 downharpoonleft 1 RightArrowLeftArrow 0 rightleftarrows 0 rlarr 1 UpArrowDownArrow 0 udarr 1 LeftArrowRightArrow 0 leftrightarrows 0 lrarr 1 leftleftarrows 0 llarr 1 upuparrows 0 uuarr 1 rightrightarrows 0 rrarr 1 ddarr 0 downdownarrows 1 ReverseEquilibrium 0 leftrightharpoons 0 lrhar 1 Equilibrium 0 rightleftharpoons 0 rlhar 1 nLeftarrow 0 nlArr 1 nLeftrightarrow 0 nhArr 1 nRightarrow 0 nrArr 1 DoubleLeftArrow 0 Leftarrow 0 lArr 1 DoubleUpArrow 0 Uparrow 0 uArr 1 DoubleRightArrow 0 Implies 0 Rightarrow 0 rArr 1 DoubleDownArrow 0 Downarrow 0 dArr 1 DoubleLeftRightArrow 0 Leftrightarrow 0 hArr 0 iff 1 DoubleUpDownArrow 0 Updownarrow 0 vArr 1 nwArr 1 neArr 1 seArr 1 swArr 1 Lleftarrow 0 lAarr 1 Rrightarrow 0 rAarr 2 zigrarr 7 LeftArrowBar 0 larrb 1 RightArrowBar 0 rarrb g DownArrowUpArrow 0 duarr 8 loarr 1 roarr 1 hoarr 1 ForAll 0 forall 1 comp 0 complement 1 PartialD 0 part 0+mw npart 1 Exists 0 exist 1 NotExists 0 nexist 0 nexists 1 empty 0 emptyset 0 emptyv 0 varnothing 2 Del 0 nabla 1 Element 0 in 0 isin 0 isinv 1 NotElement 0 notin 0 notinva 2 ReverseElement 0 SuchThat 0 ni 0 niv 1 NotReverseElement 0 notni 0 notniva 3 Product 0 prod 1 Coproduct 0 coprod 1 Sum 0 sum 1 minus 1 MinusPlus 0 mnplus 0 mp 1 dotplus 0 plusdo 2 Backslash 0 setminus 0 setmn 0 smallsetminus 0 ssetmn 1 lowast 1 SmallCircle 0 compfn 2 Sqrt 0 radic 3 Proportional 0 prop 0 propto 0 varpropto 0 vprop 1 infin 1 angrt 1 ang 0 angle 0+6he nang 1 angmsd 0 measuredangle 1 angsph 1 VerticalBar 0 mid 0 shortmid 0 smid 1 NotVerticalBar 0 nmid 0 nshortmid 0 nsmid 1 DoubleVerticalBar 0 par 0 parallel 0 shortparallel 0 spar 1 NotDoubleVerticalBar 0 npar 0 nparallel 0 nshortparallel 0 nspar 1 and 0 wedge 1 or 0 vee 1 cap 0+1e68 caps 1 cup 0+1e68 cups 1 Integral 0 int 1 Int 1 iiint 0 tint 1 ContourIntegral 0 conint 0 oint 1 Conint 0 DoubleContourIntegral 1 Cconint 1 cwint 1 ClockwiseContourIntegral 0 cwconint 1 CounterClockwiseContourIntegral 0 awconint 1 Therefore 0 there4 0 therefore 1 Because 0 becaus 0 because 1 ratio 1 Colon 0 Proportion 1 dotminus 0 minusd 2 mDDot 1 homtht 1 Tilde 0 sim 0 thicksim 0 thksim 0+6he nvsim 1 backsim 0 bsim 0+mp race 1 ac 0 mstpos 0+mr acE 1 acd 1 VerticalTilde 0 wr 0 wreath 1 NotTilde 0 nsim 1 EqualTilde 0 eqsim 0 esim 0+mw NotEqualTilde 0+mw nesim 1 TildeEqual 0 sime 0 simeq 1 NotTildeEqual 0 nsime 0 nsimeq 1 TildeFullEqual 0 cong 1 simne 1 NotTildeFullEqual 0 ncong 1 TildeTilde 0 ap 0 approx 0 asymp 0 thickapprox 0 thkap 1 NotTildeTilde 0 nap 0 napprox 1 ape 0 approxeq 1 apid 0+mw napid 1 backcong 0 bcong 1 CupCap 0 asympeq 0+6he nvap 1 Bumpeq 0 HumpDownHump 0 bump 0+mw NotHumpDownHump 0+mw nbump 1 HumpEqual 0 bumpe 0 bumpeq 0+mw NotHumpEqual 0+mw nbumpe 1 DotEqual 0 doteq 0 esdot 0+mw nedot 1 doteqdot 0 eDot 1 efDot 0 fallingdotseq 1 erDot 0 risingdotseq 1 Assign 0 colone 0 coloneq 1 ecolon 0 eqcolon 1 ecir 0 eqcirc 1 circeq 0 cire 2 wedgeq 1 veeeq 2 triangleq 0 trie 3 equest 0 questeq 1 NotEqual 0 ne 1 Congruent 0 equiv 0+6hx bnequiv 1 NotCongruent 0 nequiv 2 le 0 leq 0+6he nvle 1 GreaterEqual 0 ge 0 geq 0+6he nvge 1 LessFullEqual 0 lE 0 leqq 0+mw nlE 0+mw nleqq 1 GreaterFullEqual 0 gE 0 geqq 0+mw NotGreaterFullEqual 0+mw ngE 0+mw ngeqq 1 lnE 0 lneqq 0+1e68 lvertneqq 0+1e68 lvnE 1 gnE 0 gneqq 0+1e68 gvertneqq 0+1e68 gvnE 1 Lt 0 NestedLessLess 0 ll 0+mw NotLessLess 0+mw nLtv 0+6he nLt 1 Gt 0 NestedGreaterGreater 0 gg 0+mw NotGreaterGreater 0+mw nGtv 0+6he nGt 1 between 0 twixt 1 NotCupCap 1 NotLess 0 nless 0 nlt 1 NotGreater 0 ngt 0 ngtr 1 NotLessEqual 0 nle 0 nleq 1 NotGreaterEqual 0 nge 0 ngeq 1 LessTilde 0 lesssim 0 lsim 1 GreaterTilde 0 gsim 0 gtrsim 1 NotLessTilde 0 nlsim 1 NotGreaterTilde 0 ngsim 1 LessGreater 0 lessgtr 0 lg 1 GreaterLess 0 gl 0 gtrless 1 NotLessGreater 0 ntlg 1 NotGreaterLess 0 ntgl 1 Precedes 0 pr 0 prec 1 Succeeds 0 sc 0 succ 1 PrecedesSlantEqual 0 prcue 0 preccurlyeq 1 SucceedsSlantEqual 0 sccue 0 succcurlyeq 1 PrecedesTilde 0 precsim 0 prsim 1 SucceedsTilde 0 scsim 0 succsim 0+mw NotSucceedsTilde 1 NotPrecedes 0 npr 0 nprec 1 NotSucceeds 0 nsc 0 nsucc 1 sub 0 subset 0+6he NotSubset 0+6he nsubset 0+6he vnsub 1 Superset 0 sup 0 supset 0+6he NotSuperset 0+6he nsupset 0+6he vnsup 1 nsub 1 nsup 1 SubsetEqual 0 sube 0 subseteq 1 SupersetEqual 0 supe 0 supseteq 1 NotSubsetEqual 0 nsube 0 nsubseteq 1 NotSupersetEqual 0 nsupe 0 nsupseteq 1 subne 0 subsetneq 0+1e68 varsubsetneq 0+1e68 vsubne 1 supne 0 supsetneq 0+1e68 varsupsetneq 0+1e68 vsupne 2 cupdot 1 UnionPlus 0 uplus 1 SquareSubset 0 sqsub 0 sqsubset 0+mw NotSquareSubset 1 SquareSuperset 0 sqsup 0 sqsupset 0+mw NotSquareSuperset 1 SquareSubsetEqual 0 sqsube 0 sqsubseteq 1 SquareSupersetEqual 0 sqsupe 0 sqsupseteq 1 SquareIntersection 0 sqcap 0+1e68 sqcaps 1 SquareUnion 0 sqcup 0+1e68 sqcups 1 CirclePlus 0 oplus 1 CircleMinus 0 ominus 1 CircleTimes 0 otimes 1 osol 1 CircleDot 0 odot 1 circledcirc 0 ocir 1 circledast 0 oast 2 circleddash 0 odash 1 boxplus 0 plusb 1 boxminus 0 minusb 1 boxtimes 0 timesb 1 dotsquare 0 sdotb 1 RightTee 0 vdash 1 LeftTee 0 dashv 1 DownTee 0 top 1 UpTee 0 bot 0 bottom 0 perp 2 models 1 DoubleRightTee 0 vDash 1 Vdash 1 Vvdash 1 VDash 1 nvdash 1 nvDash 1 nVdash 1 nVDash 1 prurel 2 LeftTriangle 0 vartriangleleft 0 vltri 1 RightTriangle 0 vartriangleright 0 vrtri 1 LeftTriangleEqual 0 ltrie 0 trianglelefteq 0+6he nvltrie 1 RightTriangleEqual 0 rtrie 0 trianglerighteq 0+6he nvrtrie 1 origof 1 imof 1 multimap 0 mumap 1 hercon 1 intcal 0 intercal 1 veebar 2 barvee 1 angrtvb 1 lrtri 1 Wedge 0 bigwedge 0 xwedge 1 Vee 0 bigvee 0 xvee 1 Intersection 0 bigcap 0 xcap 1 Union 0 bigcup 0 xcup 1 Diamond 0 diam 0 diamond 1 sdot 1 Star 0 sstarf 1 divideontimes 0 divonx 1 bowtie 1 ltimes 1 rtimes 1 leftthreetimes 0 lthree 1 rightthreetimes 0 rthree 1 backsimeq 0 bsime 1 curlyvee 0 cuvee 1 curlywedge 0 cuwed 1 Sub 0 Subset 1 Sup 0 Supset 1 Cap 1 Cup 1 fork 0 pitchfork 1 epar 1 lessdot 0 ltdot 1 gtdot 0 gtrdot 1 Ll 0+mw nLl 1 Gg 0 ggg 0+mw nGg 1 LessEqualGreater 0 leg 0 lesseqgtr 0+1e68 lesg 1 GreaterEqualLess 0 gel 0 gtreqless 0+1e68 gesl 3 cuepr 0 curlyeqprec 1 cuesc 0 curlyeqsucc 1 NotPrecedesSlantEqual 0 nprcue 1 NotSucceedsSlantEqual 0 nsccue 1 NotSquareSubsetEqual 0 nsqsube 1 NotSquareSupersetEqual 0 nsqsupe 3 lnsim 1 gnsim 1 precnsim 0 prnsim 1 scnsim 0 succnsim 1 NotLeftTriangle 0 nltri 0 ntriangleleft 1 NotRightTriangle 0 nrtri 0 ntriangleright 1 NotLeftTriangleEqual 0 nltrie 0 ntrianglelefteq 1 NotRightTriangleEqual 0 nrtrie 0 ntrianglerighteq 1 vellip 1 ctdot 1 utdot 1 dtdot 1 disin 1 isinsv 1 isins 1 isindot 0+mw notindot 1 notinvc 1 notinvb 2 isinE 0+mw notinE 1 nisd 1 xnis 1 nis 1 notnivc 1 notnivb 7 barwed 0 barwedge 1 Barwed 0 doublebarwedge 2 LeftCeiling 0 lceil 1 RightCeiling 0 rceil 1 LeftFloor 0 lfloor 1 RightFloor 0 rfloor 1 drcrop 1 dlcrop 1 urcrop 1 ulcrop 1 bnot 2 profline 1 profsurf 2 telrec 1 target 6 ulcorn 0 ulcorner 1 urcorn 0 urcorner 1 dlcorn 0 llcorner 1 drcorn 0 lrcorner 3 frown 0 sfrown 1 smile 0 ssmile a cylcty 1 profalar 8 topbot 7 ovbar 2 solbar 1p angzarr 1g lmoust 0 lmoustache 1 rmoust 0 rmoustache 3 OverBracket 0 tbrk 1 UnderBracket 0 bbrk 1 bbrktbrk 12 OverParenthesis 1 UnderParenthesis 1 OverBrace 1 UnderBrace 3 trpezium 5 elinters 1o blank 4l circledS 0 oS 1k HorizontalLine 0 boxh 2 boxv a boxdr 4 boxdl 4 boxur 4 boxul 4 boxvr 8 boxvl 8 boxhd 8 boxhu 8 boxvh k boxH 1 boxV 1 boxdR 1 boxDr 1 boxDR 1 boxdL 1 boxDl 1 boxDL 1 boxuR 1 boxUr 1 boxUR 1 boxuL 1 boxUl 1 boxUL 1 boxvR 1 boxVr 1 boxVR 1 boxvL 1 boxVl 1 boxVL 1 boxHd 1 boxhD 1 boxHD 1 boxHu 1 boxhU 1 boxHU 1 boxvH 1 boxVh 1 boxVH k uhblk 4 lhblk 4 block 9 blk14 1 blk12 1 blk34 e Square 0 squ 0 square 9 FilledVerySmallSquare 0 blacksquare 0 squarf 0 squf 1 EmptyVerySmallSquare 2 rect 1 marker 3 fltns 2 bigtriangleup 0 xutri 1 blacktriangle 0 utrif 1 triangle 0 utri 3 blacktriangleright 0 rtrif 1 rtri 0 triangleright 4 bigtriangledown 0 xdtri 1 blacktriangledown 0 dtrif 1 dtri 0 triangledown 3 blacktriangleleft 0 ltrif 1 ltri 0 triangleleft 7 loz 0 lozenge 1 cir x tridot 3 bigcirc 0 xcirc 9 ultri 1 urtri 1 lltri 1 EmptySmallSquare 1 FilledSmallSquare 9 bigstar 0 starf 1 star 8 phone 1e female 2 male u spades 0 spadesuit 3 clubs 0 clubsuit 2 hearts 0 heartsuit 1 diamondsuit 0 diams 4 sung 3 flat 1 natur 0 natural 1 sharp 4k check 0 checkmark 4 cross 9 malt 0 maltese m sext y VerticalSeparator q lbbrk 1 rbbrk 2d bsolhsub 1 suphsol t LeftDoubleBracket 0 lobrk 1 RightDoubleBracket 0 robrk 1 LeftAngleBracket 0 lang 0 langle 1 RightAngleBracket 0 rang 0 rangle 1 Lang 1 Rang 1 loang 1 roang 8 LongLeftArrow 0 longleftarrow 0 xlarr 1 LongRightArrow 0 longrightarrow 0 xrarr 1 LongLeftRightArrow 0 longleftrightarrow 0 xharr 1 DoubleLongLeftArrow 0 Longleftarrow 0 xlArr 1 DoubleLongRightArrow 0 Longrightarrow 0 xrArr 1 DoubleLongLeftRightArrow 0 Longleftrightarrow 0 xhArr 2 longmapsto 0 xmap 3 dzigrarr 77 nvlArr 1 nvrArr 1 nvHarr 1 Map 7 lbarr 1 bkarow 0 rbarr 1 lBarr 1 dbkarow 0 rBarr 1 RBarr 0 drbkarow 1 DDotrahd 1 UpArrowBar 1 DownArrowBar 3 Rarrtl 3 latail 1 ratail 1 lAtail 1 rAtail 1 larrfs 1 rarrfs 1 larrbfs 1 rarrbfs 3 nwarhk 1 nearhk 1 hksearow 0 searhk 1 hkswarow 0 swarhk 1 nwnear 1 nesear 0 toea 1 seswar 0 tosa 1 swnwar 9 rarrc 0+mw nrarrc 2 cudarrr 1 ldca 1 rdca 1 cudarrl 1 larrpl 3 curarrm 1 cularrp 8 rarrpl 3 harrcir 1 Uarrocir 1 lurdshar 1 ldrushar 3 LeftRightVector 1 RightUpDownVector 1 DownLeftRightVector 1 LeftUpDownVector 1 LeftVectorBar 1 RightVectorBar 1 RightUpVectorBar 1 RightDownVectorBar 1 DownLeftVectorBar 1 DownRightVectorBar 1 LeftUpVectorBar 1 LeftDownVectorBar 1 LeftTeeVector 1 RightTeeVector 1 RightUpTeeVector 1 RightDownTeeVector 1 DownLeftTeeVector 1 DownRightTeeVector 1 LeftUpTeeVector 1 LeftDownTeeVector 1 lHar 1 uHar 1 rHar 1 dHar 1 luruhar 1 ldrdhar 1 ruluhar 1 rdldhar 1 lharul 1 llhard 1 rharul 1 lrhard 1 UpEquilibrium 0 udhar 1 ReverseUpEquilibrium 0 duhar 1 RoundImplies 1 erarr 1 simrarr 1 larrsim 1 rarrsim 1 rarrap 1 ltlarr 2 gtrarr 1 subrarr 2 suplarr 1 lfisht 1 rfisht 1 ufisht 1 dfisht 6 lopar 1 ropar 5 lbrke 1 rbrke 1 lbrkslu 1 rbrksld 1 lbrksld 1 rbrkslu 1 langd 1 rangd 1 lparlt 1 rpargt 1 gtlPar 1 ltrPar 4 vzigzag 2 vangrt 1 angrtvbd 7 ange 1 range 1 dwangle 1 uwangle 1 angmsdaa 1 angmsdab 1 angmsdac 1 angmsdad 1 angmsdae 1 angmsdaf 1 angmsdag 1 angmsdah 1 bemptyv 1 demptyv 1 cemptyv 1 raemptyv 1 laemptyv 1 ohbar 1 omid 1 opar 2 operp 2 olcross 1 odsold 2 olcir 1 ofcir 1 olt 1 ogt 1 cirscir 1 cirE 1 solb 1 bsolb 4 boxbox 4 trisb 1 rtriltri 1 LeftTriangleBar 0+mw NotLeftTriangleBar 1 RightTriangleBar 0+mw NotRightTriangleBar c iinfin 1 infintie 1 nvinfin 5 eparsl 1 smeparsl 1 eqvparsl 6 blacklozenge 0 lozf 9 RuleDelayed 2 dsol a bigodot 0 xodot 1 bigoplus 0 xoplus 1 bigotimes 0 xotime 2 biguplus 0 xuplus 2 bigsqcup 0 xsqcup 6 iiiint 0 qint 1 fpartint 3 cirfnint 1 awint 1 rppolint 1 scpolint 1 npolint 1 pointint 1 quatint 1 intlarhk b pluscir 1 plusacir 1 simplus 1 plusdu 1 plussim 1 plustwo 2 mcomma 1 minusdu 3 loplus 1 roplus 1 Cross 1 timesd 1 timesbar 2 smashp 1 lotimes 1 rotimes 1 otimesas 1 Otimes 1 odiv 1 triplus 1 triminus 1 tritime 1 intprod 0 iprod 3 amalg 1 capdot 2 ncup 1 ncap 1 capand 1 cupor 1 cupcap 1 capcup 1 cupbrcap 1 capbrcup 1 cupcup 1 capcap 1 ccups 1 ccaps 3 ccupssm 3 And 1 Or 1 andand 1 oror 1 orslope 1 andslope 2 andv 1 orv 1 andd 1 ord 2 wedbar 7 sdote 4 simdot 3 congdot 0+mw ncongdot 1 easter 1 apacir 1 apE 0+mw napE 1 eplus 1 pluse 1 Esim 1 Colone 1 Equal 2 ddotseq 0 eDDot 1 equivDD 1 ltcir 1 gtcir 1 ltquest 1 gtquest 1 LessSlantEqual 0 leqslant 0 les 0+mw NotLessSlantEqual 0+mw nleqslant 0+mw nles 1 GreaterSlantEqual 0 geqslant 0 ges 0+mw NotGreaterSlantEqual 0+mw ngeqslant 0+mw nges 1 lesdot 1 gesdot 1 lesdoto 1 gesdoto 1 lesdotor 1 gesdotol 1 lap 0 lessapprox 1 gap 0 gtrapprox 1 lne 0 lneq 1 gne 0 gneq 1 lnap 0 lnapprox 1 gnap 0 gnapprox 1 lEg 0 lesseqqgtr 1 gEl 0 gtreqqless 1 lsime 1 gsime 1 lsimg 1 gsiml 1 lgE 1 glE 1 lesges 1 gesles 1 els 0 eqslantless 1 egs 0 eqslantgtr 1 elsdot 1 egsdot 1 el 1 eg 3 siml 1 simg 1 simlE 1 simgE 1 LessLess 0+mw NotNestedLessLess 1 GreaterGreater 0+mw NotNestedGreaterGreater 2 glj 1 gla 1 ltcc 1 gtcc 1 lescc 1 gescc 1 smt 1 lat 1 smte 0+1e68 smtes 1 late 0+1e68 lates 1 bumpE 1 PrecedesEqual 0 pre 0 preceq 0+mw NotPrecedesEqual 0+mw npre 0+mw npreceq 1 SucceedsEqual 0 sce 0 succeq 0+mw NotSucceedsEqual 0+mw nsce 0+mw nsucceq 3 prE 1 scE 1 precneqq 0 prnE 1 scnE 0 succneqq 1 prap 0 precapprox 1 scap 0 succapprox 1 precnapprox 0 prnap 1 scnap 0 succnapprox 1 Pr 1 Sc 1 subdot 1 supdot 1 subplus 1 supplus 1 submult 1 supmult 1 subedot 1 supedot 1 subE 0 subseteqq 0+mw nsubE 0+mw nsubseteqq 1 supE 0 supseteqq 0+mw nsupE 0+mw nsupseteqq 1 subsim 1 supsim 3 subnE 0 subsetneqq 0+1e68 varsubsetneqq 0+1e68 vsubnE 1 supnE 0 supsetneqq 0+1e68 varsupsetneqq 0+1e68 vsupnE 3 csub 1 csup 1 csube 1 csupe 1 subsup 1 supsub 1 subsub 1 supsup 1 suphsub 1 supdsub 1 forkv 1 topfork 1 mlcp 9 Dashv 0 DoubleLeftTee 2 Vdashl 1 Barv 1 vBar 1 vBarv 2 Vbar 1 Not 1 bNot 1 rnmid 1 cirmid 1 midcir 1 topcir 1 nhpar 1 parsim a parsl 0+6hx nparsl 1537 fflig 1 filig 1 fllig 1 ffilig 1 ffllig 16zc Ascr 2 Cscr 1 Dscr 3 Gscr 3 Jscr 1 Kscr 3 Nscr 1 Oscr 1 Pscr 1 Qscr 2 Sscr 1 Tscr 1 Uscr 1 Vscr 1 Wscr 1 Xscr 1 Yscr 1 Zscr 1 ascr 1 bscr 1 cscr 1 dscr 2 fscr 2 hscr 1 iscr 1 jscr 1 kscr 1 lscr 1 mscr 1 nscr 2 pscr 1 qscr 1 rscr 1 sscr 1 tscr 1 uscr 1 vscr 1 wscr 1 xscr 1 yscr 1 zscr 1h Afr 1 Bfr 2 Dfr 1 Efr 1 Ffr 1 Gfr 3 Jfr 1 Kfr 1 Lfr 1 Mfr 1 Nfr 1 Ofr 1 Pfr 1 Qfr 2 Sfr 1 Tfr 1 Ufr 1 Vfr 1 Wfr 1 Xfr 1 Yfr 2 afr 1 bfr 1 cfr 1 dfr 1 efr 1 ffr 1 gfr 1 hfr 1 ifr 1 jfr 1 kfr 1 lfr 1 mfr 1 nfr 1 ofr 1 pfr 1 qfr 1 rfr 1 sfr 1 tfr 1 ufr 1 vfr 1 wfr 1 xfr 1 yfr 1 zfr 1 Aopf 1 Bopf 2 Dopf 1 Eopf 1 Fopf 1 Gopf 2 Iopf 1 Jopf 1 Kopf 1 Lopf 1 Mopf 2 Oopf 4 Sopf 1 Topf 1 Uopf 1 Vopf 1 Wopf 1 Xopf 1 Yopf 2 aopf 1 bopf 1 copf 1 dopf 1 eopf 1 fopf 1 gopf 1 hopf 1 iopf 1 jopf 1 kopf 1 lopf 1 mopf 1 nopf 1 oopf 1 popf 1 qopf 1 ropf 1 sopf 1 topf 1 uopf 1 vopf 1 wopf 1 xopf 1 yopf 1 zopf";
|
|
44
|
+
|
|
45
|
+
// scripts/entities.js
|
|
46
|
+
function unpack(packed) {
|
|
47
|
+
const table = /* @__PURE__ */ new Map(), fields = packed.split(" ");
|
|
48
|
+
let code = 0;
|
|
49
|
+
for (let i = 0; i < fields.length; i += 2) {
|
|
50
|
+
const [delta, second] = fields[i].split("+");
|
|
51
|
+
code += parseInt(delta, 36);
|
|
52
|
+
table.set(fields[i + 1], String.fromCodePoint(code) + (second ? String.fromCodePoint(parseInt(second, 36)) : ""));
|
|
53
|
+
}
|
|
54
|
+
return table;
|
|
55
|
+
}
|
|
56
|
+
const ENTITIES = unpack(_packed_entities_default);
|
|
57
|
+
function decodeHTML(match) {
|
|
58
|
+
return match[0] === "&" && match[match.length - 1] === ";" && ENTITIES.get(match.slice(1, -1)) || match;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// node_modules/markdown-it/lib/common/utils.mjs
|
|
62
|
+
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
63
|
+
arrayReplaceAt: () => arrayReplaceAt,
|
|
64
|
+
assign: () => assign,
|
|
65
|
+
escapeHtml: () => escapeHtml,
|
|
66
|
+
escapeRE: () => escapeRE,
|
|
67
|
+
fromCodePoint: () => fromCodePoint,
|
|
68
|
+
has: () => has,
|
|
69
|
+
isMdAsciiPunct: () => isMdAsciiPunct,
|
|
70
|
+
isPunctChar: () => isPunctChar,
|
|
71
|
+
isSpace: () => isSpace,
|
|
72
|
+
isString: () => isString,
|
|
73
|
+
isValidEntityCode: () => isValidEntityCode,
|
|
74
|
+
isWhiteSpace: () => isWhiteSpace,
|
|
75
|
+
lib: () => lib,
|
|
76
|
+
normalizeReference: () => normalizeReference,
|
|
77
|
+
unescapeAll: () => unescapeAll$1,
|
|
78
|
+
unescapeMd: () => unescapeMd
|
|
79
|
+
});
|
|
80
|
+
function _class(obj) {
|
|
81
|
+
return Object.prototype.toString.call(obj);
|
|
82
|
+
}
|
|
83
|
+
function isString(obj) {
|
|
84
|
+
return _class(obj) === "[object String]";
|
|
85
|
+
}
|
|
86
|
+
const _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
87
|
+
function has(object, key) {
|
|
88
|
+
return _hasOwnProperty.call(object, key);
|
|
89
|
+
}
|
|
90
|
+
function assign(obj) {
|
|
91
|
+
Array.prototype.slice.call(arguments, 1).forEach(function(source) {
|
|
92
|
+
if (!source) return;
|
|
93
|
+
if (typeof source !== "object") throw new TypeError(source + "must be object");
|
|
94
|
+
Object.keys(source).forEach(function(key) {
|
|
95
|
+
obj[key] = source[key];
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
return obj;
|
|
99
|
+
}
|
|
100
|
+
function arrayReplaceAt(src, pos, newElements) {
|
|
101
|
+
return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
|
|
102
|
+
}
|
|
103
|
+
function isValidEntityCode(c) {
|
|
104
|
+
if (c >= 55296 && c <= 57343) return false;
|
|
105
|
+
if (c >= 64976 && c <= 65007) return false;
|
|
106
|
+
if ((c & 65535) === 65535 || (c & 65535) === 65534) return false;
|
|
107
|
+
if (c >= 0 && c <= 8) return false;
|
|
108
|
+
if (c === 11) return false;
|
|
109
|
+
if (c >= 14 && c <= 31) return false;
|
|
110
|
+
if (c >= 127 && c <= 159) return false;
|
|
111
|
+
if (c > 1114111) return false;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
function fromCodePoint(c) {
|
|
115
|
+
if (c > 65535) {
|
|
116
|
+
c -= 65536;
|
|
117
|
+
const surrogate1 = 55296 + (c >> 10);
|
|
118
|
+
const surrogate2 = 56320 + (c & 1023);
|
|
119
|
+
return String.fromCharCode(surrogate1, surrogate2);
|
|
120
|
+
}
|
|
121
|
+
return String.fromCharCode(c);
|
|
122
|
+
}
|
|
123
|
+
const UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g;
|
|
124
|
+
const UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + "|" + /&([a-z#][a-z0-9]{1,31});/gi.source, "gi");
|
|
125
|
+
const DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
|
|
126
|
+
function replaceEntityPattern(match, name) {
|
|
127
|
+
if (name.charCodeAt(0) === 35 && DIGITAL_ENTITY_TEST_RE.test(name)) {
|
|
128
|
+
const code = name[1].toLowerCase() === "x" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
|
|
129
|
+
if (isValidEntityCode(code)) return fromCodePoint(code);
|
|
130
|
+
return match;
|
|
131
|
+
}
|
|
132
|
+
const decoded = decodeHTML(match);
|
|
133
|
+
if (decoded !== match) return decoded;
|
|
134
|
+
return match;
|
|
135
|
+
}
|
|
136
|
+
function unescapeMd(str) {
|
|
137
|
+
if (str.indexOf("\\") < 0) return str;
|
|
138
|
+
return str.replace(UNESCAPE_MD_RE, "$1");
|
|
139
|
+
}
|
|
140
|
+
function unescapeAll$1(str) {
|
|
141
|
+
if (str.indexOf("\\") < 0 && str.indexOf("&") < 0) return str;
|
|
142
|
+
return str.replace(UNESCAPE_ALL_RE, function(match, escaped, entity) {
|
|
143
|
+
if (escaped) return escaped;
|
|
144
|
+
return replaceEntityPattern(match, entity);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const HTML_ESCAPE_TEST_RE = /[&<>"]/;
|
|
148
|
+
const HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
|
|
149
|
+
const HTML_REPLACEMENTS = {
|
|
150
|
+
"&": "&",
|
|
151
|
+
"<": "<",
|
|
152
|
+
">": ">",
|
|
153
|
+
"\"": """
|
|
154
|
+
};
|
|
155
|
+
function replaceUnsafeChar(ch) {
|
|
156
|
+
return HTML_REPLACEMENTS[ch];
|
|
157
|
+
}
|
|
158
|
+
function escapeHtml(str) {
|
|
159
|
+
if (HTML_ESCAPE_TEST_RE.test(str)) return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
|
|
160
|
+
return str;
|
|
161
|
+
}
|
|
162
|
+
const REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
|
|
163
|
+
function escapeRE(str) {
|
|
164
|
+
return str.replace(REGEXP_ESCAPE_RE, "\\$&");
|
|
165
|
+
}
|
|
166
|
+
function isSpace(code) {
|
|
167
|
+
switch (code) {
|
|
168
|
+
case 9:
|
|
169
|
+
case 32: return true;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
function isWhiteSpace(code) {
|
|
174
|
+
if (code >= 8192 && code <= 8202) return true;
|
|
175
|
+
switch (code) {
|
|
176
|
+
case 9:
|
|
177
|
+
case 10:
|
|
178
|
+
case 11:
|
|
179
|
+
case 12:
|
|
180
|
+
case 13:
|
|
181
|
+
case 32:
|
|
182
|
+
case 160:
|
|
183
|
+
case 5760:
|
|
184
|
+
case 8239:
|
|
185
|
+
case 8287:
|
|
186
|
+
case 12288: return true;
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
function isPunctChar(ch) {
|
|
191
|
+
return P.test(ch) || S.test(ch);
|
|
192
|
+
}
|
|
193
|
+
function isMdAsciiPunct(ch) {
|
|
194
|
+
switch (ch) {
|
|
195
|
+
case 33:
|
|
196
|
+
case 34:
|
|
197
|
+
case 35:
|
|
198
|
+
case 36:
|
|
199
|
+
case 37:
|
|
200
|
+
case 38:
|
|
201
|
+
case 39:
|
|
202
|
+
case 40:
|
|
203
|
+
case 41:
|
|
204
|
+
case 42:
|
|
205
|
+
case 43:
|
|
206
|
+
case 44:
|
|
207
|
+
case 45:
|
|
208
|
+
case 46:
|
|
209
|
+
case 47:
|
|
210
|
+
case 58:
|
|
211
|
+
case 59:
|
|
212
|
+
case 60:
|
|
213
|
+
case 61:
|
|
214
|
+
case 62:
|
|
215
|
+
case 63:
|
|
216
|
+
case 64:
|
|
217
|
+
case 91:
|
|
218
|
+
case 92:
|
|
219
|
+
case 93:
|
|
220
|
+
case 94:
|
|
221
|
+
case 95:
|
|
222
|
+
case 96:
|
|
223
|
+
case 123:
|
|
224
|
+
case 124:
|
|
225
|
+
case 125:
|
|
226
|
+
case 126: return true;
|
|
227
|
+
default: return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function normalizeReference(str) {
|
|
231
|
+
str = str.trim().replace(/\s+/g, " ");
|
|
232
|
+
if ("ẞ".toLowerCase() === "Ṿ") str = str.replace(/ẞ/g, "ß");
|
|
233
|
+
return str.toLowerCase().toUpperCase();
|
|
234
|
+
}
|
|
235
|
+
const lib = {
|
|
236
|
+
mdurl: mdurl_exports,
|
|
237
|
+
ucmicro: uc_micro_exports
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// node_modules/markdown-it/lib/helpers/parse_link_label.mjs
|
|
241
|
+
function parseLinkLabel(state, start, disableNested) {
|
|
242
|
+
let level, found, marker, prevPos;
|
|
243
|
+
const max = state.posMax;
|
|
244
|
+
const oldPos = state.pos;
|
|
245
|
+
state.pos = start + 1;
|
|
246
|
+
level = 1;
|
|
247
|
+
while (state.pos < max) {
|
|
248
|
+
marker = state.src.charCodeAt(state.pos);
|
|
249
|
+
if (marker === 93) {
|
|
250
|
+
level--;
|
|
251
|
+
if (level === 0) {
|
|
252
|
+
found = true;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
prevPos = state.pos;
|
|
257
|
+
state.md.inline.skipToken(state);
|
|
258
|
+
if (marker === 91) {
|
|
259
|
+
if (prevPos === state.pos - 1) level++;
|
|
260
|
+
else if (disableNested) {
|
|
261
|
+
state.pos = oldPos;
|
|
262
|
+
return -1;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
let labelEnd = -1;
|
|
267
|
+
if (found) labelEnd = state.pos;
|
|
268
|
+
state.pos = oldPos;
|
|
269
|
+
return labelEnd;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// node_modules/markdown-it/lib/helpers/parse_link_destination.mjs
|
|
273
|
+
function parseLinkDestination(str, start, max) {
|
|
274
|
+
let code;
|
|
275
|
+
let pos = start;
|
|
276
|
+
const result = {
|
|
277
|
+
ok: false,
|
|
278
|
+
pos: 0,
|
|
279
|
+
str: ""
|
|
280
|
+
};
|
|
281
|
+
if (str.charCodeAt(pos) === 60) {
|
|
282
|
+
pos++;
|
|
283
|
+
while (pos < max) {
|
|
284
|
+
code = str.charCodeAt(pos);
|
|
285
|
+
if (code === 10) return result;
|
|
286
|
+
if (code === 60) return result;
|
|
287
|
+
if (code === 62) {
|
|
288
|
+
result.pos = pos + 1;
|
|
289
|
+
result.str = unescapeAll$1(str.slice(start + 1, pos));
|
|
290
|
+
result.ok = true;
|
|
291
|
+
return result;
|
|
292
|
+
}
|
|
293
|
+
if (code === 92 && pos + 1 < max) {
|
|
294
|
+
pos += 2;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
pos++;
|
|
298
|
+
}
|
|
299
|
+
return result;
|
|
300
|
+
}
|
|
301
|
+
let level = 0;
|
|
302
|
+
while (pos < max) {
|
|
303
|
+
code = str.charCodeAt(pos);
|
|
304
|
+
if (code === 32) break;
|
|
305
|
+
if (code < 32 || code === 127) break;
|
|
306
|
+
if (code === 92 && pos + 1 < max) {
|
|
307
|
+
if (str.charCodeAt(pos + 1) === 32) break;
|
|
308
|
+
pos += 2;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (code === 40) {
|
|
312
|
+
level++;
|
|
313
|
+
if (level > 32) return result;
|
|
314
|
+
}
|
|
315
|
+
if (code === 41) {
|
|
316
|
+
if (level === 0) break;
|
|
317
|
+
level--;
|
|
318
|
+
}
|
|
319
|
+
pos++;
|
|
320
|
+
}
|
|
321
|
+
if (start === pos) return result;
|
|
322
|
+
if (level !== 0) return result;
|
|
323
|
+
result.str = unescapeAll$1(str.slice(start, pos));
|
|
324
|
+
result.pos = pos;
|
|
325
|
+
result.ok = true;
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// node_modules/markdown-it/lib/helpers/parse_link_title.mjs
|
|
330
|
+
function parseLinkTitle(str, start, max, prev_state) {
|
|
331
|
+
let code;
|
|
332
|
+
let pos = start;
|
|
333
|
+
const state = {
|
|
334
|
+
ok: false,
|
|
335
|
+
can_continue: false,
|
|
336
|
+
pos: 0,
|
|
337
|
+
str: "",
|
|
338
|
+
marker: 0
|
|
339
|
+
};
|
|
340
|
+
if (prev_state) {
|
|
341
|
+
state.str = prev_state.str;
|
|
342
|
+
state.marker = prev_state.marker;
|
|
343
|
+
} else {
|
|
344
|
+
if (pos >= max) return state;
|
|
345
|
+
let marker = str.charCodeAt(pos);
|
|
346
|
+
if (marker !== 34 && marker !== 39 && marker !== 40) return state;
|
|
347
|
+
start++;
|
|
348
|
+
pos++;
|
|
349
|
+
if (marker === 40) marker = 41;
|
|
350
|
+
state.marker = marker;
|
|
351
|
+
}
|
|
352
|
+
while (pos < max) {
|
|
353
|
+
code = str.charCodeAt(pos);
|
|
354
|
+
if (code === state.marker) {
|
|
355
|
+
state.pos = pos + 1;
|
|
356
|
+
state.str += unescapeAll$1(str.slice(start, pos));
|
|
357
|
+
state.ok = true;
|
|
358
|
+
return state;
|
|
359
|
+
} else if (code === 40 && state.marker === 41) return state;
|
|
360
|
+
else if (code === 92 && pos + 1 < max) pos++;
|
|
361
|
+
pos++;
|
|
362
|
+
}
|
|
363
|
+
state.can_continue = true;
|
|
364
|
+
state.str += unescapeAll$1(str.slice(start, pos));
|
|
365
|
+
return state;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// node_modules/markdown-it/lib/helpers/index.mjs
|
|
369
|
+
var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
370
|
+
parseLinkDestination: () => parseLinkDestination,
|
|
371
|
+
parseLinkLabel: () => parseLinkLabel,
|
|
372
|
+
parseLinkTitle: () => parseLinkTitle
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// scripts/unused.js
|
|
376
|
+
function unused() {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// node_modules/markdown-it/lib/ruler.mjs
|
|
381
|
+
function Ruler() {
|
|
382
|
+
this.__rules__ = [];
|
|
383
|
+
this.__cache__ = null;
|
|
384
|
+
}
|
|
385
|
+
Ruler.prototype.__find__ = function(name) {
|
|
386
|
+
for (let i = 0; i < this.__rules__.length; i++) if (this.__rules__[i].name === name) return i;
|
|
387
|
+
return -1;
|
|
388
|
+
};
|
|
389
|
+
Ruler.prototype.__compile__ = function() {
|
|
390
|
+
const self = this;
|
|
391
|
+
const chains = [""];
|
|
392
|
+
self.__rules__.forEach(function(rule) {
|
|
393
|
+
if (!rule.enabled) return;
|
|
394
|
+
rule.alt.forEach(function(altName) {
|
|
395
|
+
if (chains.indexOf(altName) < 0) chains.push(altName);
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
self.__cache__ = {};
|
|
399
|
+
chains.forEach(function(chain) {
|
|
400
|
+
self.__cache__[chain] = [];
|
|
401
|
+
self.__rules__.forEach(function(rule) {
|
|
402
|
+
if (!rule.enabled) return;
|
|
403
|
+
if (chain && rule.alt.indexOf(chain) < 0) return;
|
|
404
|
+
self.__cache__[chain].push(rule.fn);
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
Ruler.prototype.at = function(name, fn, options) {
|
|
409
|
+
const index = this.__find__(name);
|
|
410
|
+
const opt = options || {};
|
|
411
|
+
if (index === -1) throw new Error("Parser rule not found: " + name);
|
|
412
|
+
this.__rules__[index].fn = fn;
|
|
413
|
+
this.__rules__[index].alt = opt.alt || [];
|
|
414
|
+
this.__cache__ = null;
|
|
415
|
+
};
|
|
416
|
+
Ruler.prototype.before = function(beforeName, ruleName, fn, options) {
|
|
417
|
+
const index = this.__find__(beforeName);
|
|
418
|
+
const opt = options || {};
|
|
419
|
+
if (index === -1) throw new Error("Parser rule not found: " + beforeName);
|
|
420
|
+
this.__rules__.splice(index, 0, {
|
|
421
|
+
name: ruleName,
|
|
422
|
+
enabled: true,
|
|
423
|
+
fn,
|
|
424
|
+
alt: opt.alt || []
|
|
425
|
+
});
|
|
426
|
+
this.__cache__ = null;
|
|
427
|
+
};
|
|
428
|
+
Ruler.prototype.after = function(afterName, ruleName, fn, options) {
|
|
429
|
+
const index = this.__find__(afterName);
|
|
430
|
+
const opt = options || {};
|
|
431
|
+
if (index === -1) throw new Error("Parser rule not found: " + afterName);
|
|
432
|
+
this.__rules__.splice(index + 1, 0, {
|
|
433
|
+
name: ruleName,
|
|
434
|
+
enabled: true,
|
|
435
|
+
fn,
|
|
436
|
+
alt: opt.alt || []
|
|
437
|
+
});
|
|
438
|
+
this.__cache__ = null;
|
|
439
|
+
};
|
|
440
|
+
Ruler.prototype.push = function(ruleName, fn, options) {
|
|
441
|
+
const opt = options || {};
|
|
442
|
+
this.__rules__.push({
|
|
443
|
+
name: ruleName,
|
|
444
|
+
enabled: true,
|
|
445
|
+
fn,
|
|
446
|
+
alt: opt.alt || []
|
|
447
|
+
});
|
|
448
|
+
this.__cache__ = null;
|
|
449
|
+
};
|
|
450
|
+
Ruler.prototype.enable = function(list, ignoreInvalid) {
|
|
451
|
+
if (!Array.isArray(list)) list = [list];
|
|
452
|
+
const result = [];
|
|
453
|
+
list.forEach(function(name) {
|
|
454
|
+
const idx = this.__find__(name);
|
|
455
|
+
if (idx < 0) {
|
|
456
|
+
if (ignoreInvalid) return;
|
|
457
|
+
throw new Error("Rules manager: invalid rule name " + name);
|
|
458
|
+
}
|
|
459
|
+
this.__rules__[idx].enabled = true;
|
|
460
|
+
result.push(name);
|
|
461
|
+
}, this);
|
|
462
|
+
this.__cache__ = null;
|
|
463
|
+
return result;
|
|
464
|
+
};
|
|
465
|
+
Ruler.prototype.enableOnly = function(list, ignoreInvalid) {
|
|
466
|
+
if (!Array.isArray(list)) list = [list];
|
|
467
|
+
this.__rules__.forEach(function(rule) {
|
|
468
|
+
rule.enabled = false;
|
|
469
|
+
});
|
|
470
|
+
this.enable(list, ignoreInvalid);
|
|
471
|
+
};
|
|
472
|
+
Ruler.prototype.disable = function(list, ignoreInvalid) {
|
|
473
|
+
if (!Array.isArray(list)) list = [list];
|
|
474
|
+
const result = [];
|
|
475
|
+
list.forEach(function(name) {
|
|
476
|
+
const idx = this.__find__(name);
|
|
477
|
+
if (idx < 0) {
|
|
478
|
+
if (ignoreInvalid) return;
|
|
479
|
+
throw new Error("Rules manager: invalid rule name " + name);
|
|
480
|
+
}
|
|
481
|
+
this.__rules__[idx].enabled = false;
|
|
482
|
+
result.push(name);
|
|
483
|
+
}, this);
|
|
484
|
+
this.__cache__ = null;
|
|
485
|
+
return result;
|
|
486
|
+
};
|
|
487
|
+
Ruler.prototype.getRules = function(chainName) {
|
|
488
|
+
if (this.__cache__ === null) this.__compile__();
|
|
489
|
+
return this.__cache__[chainName] || [];
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
// node_modules/markdown-it/lib/token.mjs
|
|
493
|
+
function Token(type, tag, nesting) {
|
|
494
|
+
this.type = type;
|
|
495
|
+
this.tag = tag;
|
|
496
|
+
this.attrs = null;
|
|
497
|
+
this.map = null;
|
|
498
|
+
this.nesting = nesting;
|
|
499
|
+
this.level = 0;
|
|
500
|
+
this.children = null;
|
|
501
|
+
this.content = "";
|
|
502
|
+
this.markup = "";
|
|
503
|
+
this.info = "";
|
|
504
|
+
this.meta = null;
|
|
505
|
+
this.block = false;
|
|
506
|
+
this.hidden = false;
|
|
507
|
+
}
|
|
508
|
+
Token.prototype.attrIndex = function attrIndex(name) {
|
|
509
|
+
if (!this.attrs) return -1;
|
|
510
|
+
const attrs = this.attrs;
|
|
511
|
+
for (let i = 0, len = attrs.length; i < len; i++) if (attrs[i][0] === name) return i;
|
|
512
|
+
return -1;
|
|
513
|
+
};
|
|
514
|
+
Token.prototype.attrPush = function attrPush(attrData) {
|
|
515
|
+
if (this.attrs) this.attrs.push(attrData);
|
|
516
|
+
else this.attrs = [attrData];
|
|
517
|
+
};
|
|
518
|
+
Token.prototype.attrSet = function attrSet(name, value) {
|
|
519
|
+
const idx = this.attrIndex(name);
|
|
520
|
+
const attrData = [name, value];
|
|
521
|
+
if (idx < 0) this.attrPush(attrData);
|
|
522
|
+
else this.attrs[idx] = attrData;
|
|
523
|
+
};
|
|
524
|
+
Token.prototype.attrGet = function attrGet(name) {
|
|
525
|
+
const idx = this.attrIndex(name);
|
|
526
|
+
let value = null;
|
|
527
|
+
if (idx >= 0) value = this.attrs[idx][1];
|
|
528
|
+
return value;
|
|
529
|
+
};
|
|
530
|
+
Token.prototype.attrJoin = function attrJoin(name, value) {
|
|
531
|
+
const idx = this.attrIndex(name);
|
|
532
|
+
if (idx < 0) this.attrPush([name, value]);
|
|
533
|
+
else this.attrs[idx][1] = this.attrs[idx][1] + " " + value;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// node_modules/markdown-it/lib/rules_core/state_core.mjs
|
|
537
|
+
function StateCore(src, md, env) {
|
|
538
|
+
this.src = src;
|
|
539
|
+
this.env = env;
|
|
540
|
+
this.tokens = [];
|
|
541
|
+
this.inlineMode = false;
|
|
542
|
+
this.md = md;
|
|
543
|
+
}
|
|
544
|
+
StateCore.prototype.Token = Token;
|
|
545
|
+
|
|
546
|
+
// node_modules/markdown-it/lib/rules_core/normalize.mjs
|
|
547
|
+
const NEWLINES_RE = /\r\n?|\n/g;
|
|
548
|
+
const NULL_RE = /\0/g;
|
|
549
|
+
function normalize(state) {
|
|
550
|
+
let str;
|
|
551
|
+
str = state.src.replace(NEWLINES_RE, "\n");
|
|
552
|
+
str = str.replace(NULL_RE, "�");
|
|
553
|
+
state.src = str;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// node_modules/markdown-it/lib/rules_core/block.mjs
|
|
557
|
+
function block(state) {
|
|
558
|
+
let token;
|
|
559
|
+
if (state.inlineMode) {
|
|
560
|
+
token = new state.Token("inline", "", 0);
|
|
561
|
+
token.content = state.src;
|
|
562
|
+
token.map = [0, 1];
|
|
563
|
+
token.children = [];
|
|
564
|
+
state.tokens.push(token);
|
|
565
|
+
} else state.md.block.parse(state.src, state.md, state.env, state.tokens);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// node_modules/markdown-it/lib/rules_core/inline.mjs
|
|
569
|
+
function inline(state) {
|
|
570
|
+
const tokens = state.tokens;
|
|
571
|
+
for (let i = 0, l = tokens.length; i < l; i++) {
|
|
572
|
+
const tok = tokens[i];
|
|
573
|
+
if (tok.type === "inline") state.md.inline.parse(tok.content, state.md, state.env, tok.children);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// node_modules/markdown-it/lib/rules_core/text_join.mjs
|
|
578
|
+
function text_join(state) {
|
|
579
|
+
let curr, last;
|
|
580
|
+
const blockTokens = state.tokens;
|
|
581
|
+
const l = blockTokens.length;
|
|
582
|
+
for (let j = 0; j < l; j++) {
|
|
583
|
+
if (blockTokens[j].type !== "inline") continue;
|
|
584
|
+
const tokens = blockTokens[j].children;
|
|
585
|
+
const max = tokens.length;
|
|
586
|
+
for (curr = 0; curr < max; curr++) if (tokens[curr].type === "text_special") tokens[curr].type = "text";
|
|
587
|
+
for (curr = last = 0; curr < max; curr++) if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
|
|
588
|
+
else {
|
|
589
|
+
if (curr !== last) tokens[last] = tokens[curr];
|
|
590
|
+
last++;
|
|
591
|
+
}
|
|
592
|
+
if (curr !== last) tokens.length = last;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// node_modules/markdown-it/lib/parser_core.mjs
|
|
597
|
+
const _rules$2 = [
|
|
598
|
+
["normalize", normalize],
|
|
599
|
+
["block", block],
|
|
600
|
+
["inline", inline],
|
|
601
|
+
["linkify", unused],
|
|
602
|
+
["replacements", unused],
|
|
603
|
+
["smartquotes", unused],
|
|
604
|
+
["text_join", text_join]
|
|
605
|
+
];
|
|
606
|
+
function Core() {
|
|
607
|
+
this.ruler = new Ruler();
|
|
608
|
+
for (let i = 0; i < _rules$2.length; i++) this.ruler.push(_rules$2[i][0], _rules$2[i][1]);
|
|
609
|
+
}
|
|
610
|
+
Core.prototype.process = function(state) {
|
|
611
|
+
const rules = this.ruler.getRules("");
|
|
612
|
+
for (let i = 0, l = rules.length; i < l; i++) rules[i](state);
|
|
613
|
+
};
|
|
614
|
+
Core.prototype.State = StateCore;
|
|
615
|
+
|
|
616
|
+
// node_modules/markdown-it/lib/rules_block/state_block.mjs
|
|
617
|
+
function StateBlock(src, md, env, tokens) {
|
|
618
|
+
this.src = src;
|
|
619
|
+
this.md = md;
|
|
620
|
+
this.env = env;
|
|
621
|
+
this.tokens = tokens;
|
|
622
|
+
this.bMarks = [];
|
|
623
|
+
this.eMarks = [];
|
|
624
|
+
this.tShift = [];
|
|
625
|
+
this.sCount = [];
|
|
626
|
+
this.bsCount = [];
|
|
627
|
+
this.blkIndent = 0;
|
|
628
|
+
this.line = 0;
|
|
629
|
+
this.lineMax = 0;
|
|
630
|
+
this.tight = false;
|
|
631
|
+
this.ddIndent = -1;
|
|
632
|
+
this.listIndent = -1;
|
|
633
|
+
this.parentType = "root";
|
|
634
|
+
this.level = 0;
|
|
635
|
+
const s = this.src;
|
|
636
|
+
for (let start = 0, pos = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos < len; pos++) {
|
|
637
|
+
const ch = s.charCodeAt(pos);
|
|
638
|
+
if (!indent_found) {
|
|
639
|
+
if (isSpace(ch)) {
|
|
640
|
+
indent++;
|
|
641
|
+
if (ch === 9) offset += 4 - offset % 4;
|
|
642
|
+
else offset++;
|
|
643
|
+
continue;
|
|
644
|
+
} else indent_found = true;
|
|
645
|
+
}
|
|
646
|
+
if (ch === 10 || pos === len - 1) {
|
|
647
|
+
if (ch !== 10) pos++;
|
|
648
|
+
this.bMarks.push(start);
|
|
649
|
+
this.eMarks.push(pos);
|
|
650
|
+
this.tShift.push(indent);
|
|
651
|
+
this.sCount.push(offset);
|
|
652
|
+
this.bsCount.push(0);
|
|
653
|
+
indent_found = false;
|
|
654
|
+
indent = 0;
|
|
655
|
+
offset = 0;
|
|
656
|
+
start = pos + 1;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
this.bMarks.push(s.length);
|
|
660
|
+
this.eMarks.push(s.length);
|
|
661
|
+
this.tShift.push(0);
|
|
662
|
+
this.sCount.push(0);
|
|
663
|
+
this.bsCount.push(0);
|
|
664
|
+
this.lineMax = this.bMarks.length - 1;
|
|
665
|
+
}
|
|
666
|
+
StateBlock.prototype.push = function(type, tag, nesting) {
|
|
667
|
+
const token = new Token(type, tag, nesting);
|
|
668
|
+
token.block = true;
|
|
669
|
+
if (nesting < 0) this.level--;
|
|
670
|
+
token.level = this.level;
|
|
671
|
+
if (nesting > 0) this.level++;
|
|
672
|
+
this.tokens.push(token);
|
|
673
|
+
return token;
|
|
674
|
+
};
|
|
675
|
+
StateBlock.prototype.isEmpty = function isEmpty(line) {
|
|
676
|
+
return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
|
|
677
|
+
};
|
|
678
|
+
StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
|
|
679
|
+
for (let max = this.lineMax; from < max; from++) if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) break;
|
|
680
|
+
return from;
|
|
681
|
+
};
|
|
682
|
+
StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
|
|
683
|
+
for (let max = this.src.length; pos < max; pos++) {
|
|
684
|
+
const ch = this.src.charCodeAt(pos);
|
|
685
|
+
if (!isSpace(ch)) break;
|
|
686
|
+
}
|
|
687
|
+
return pos;
|
|
688
|
+
};
|
|
689
|
+
StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
|
|
690
|
+
if (pos <= min) return pos;
|
|
691
|
+
while (pos > min) if (!isSpace(this.src.charCodeAt(--pos))) return pos + 1;
|
|
692
|
+
return pos;
|
|
693
|
+
};
|
|
694
|
+
StateBlock.prototype.skipChars = function skipChars(pos, code) {
|
|
695
|
+
for (let max = this.src.length; pos < max; pos++) if (this.src.charCodeAt(pos) !== code) break;
|
|
696
|
+
return pos;
|
|
697
|
+
};
|
|
698
|
+
StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
|
|
699
|
+
if (pos <= min) return pos;
|
|
700
|
+
while (pos > min) if (code !== this.src.charCodeAt(--pos)) return pos + 1;
|
|
701
|
+
return pos;
|
|
702
|
+
};
|
|
703
|
+
StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
|
|
704
|
+
if (begin >= end) return "";
|
|
705
|
+
const queue = new Array(end - begin);
|
|
706
|
+
for (let i = 0, line = begin; line < end; line++, i++) {
|
|
707
|
+
let lineIndent = 0;
|
|
708
|
+
const lineStart = this.bMarks[line];
|
|
709
|
+
let first = lineStart;
|
|
710
|
+
let last;
|
|
711
|
+
if (line + 1 < end || keepLastLF) last = this.eMarks[line] + 1;
|
|
712
|
+
else last = this.eMarks[line];
|
|
713
|
+
while (first < last && lineIndent < indent) {
|
|
714
|
+
const ch = this.src.charCodeAt(first);
|
|
715
|
+
if (isSpace(ch)) {
|
|
716
|
+
if (ch === 9) lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
|
|
717
|
+
else lineIndent++;
|
|
718
|
+
} else if (first - lineStart < this.tShift[line]) lineIndent++;
|
|
719
|
+
else break;
|
|
720
|
+
first++;
|
|
721
|
+
}
|
|
722
|
+
if (lineIndent > indent) queue[i] = new Array(lineIndent - indent + 1).join(" ") + this.src.slice(first, last);
|
|
723
|
+
else queue[i] = this.src.slice(first, last);
|
|
724
|
+
}
|
|
725
|
+
return queue.join("");
|
|
726
|
+
};
|
|
727
|
+
StateBlock.prototype.Token = Token;
|
|
728
|
+
|
|
729
|
+
// node_modules/markdown-it/lib/rules_block/table.mjs
|
|
730
|
+
const MAX_AUTOCOMPLETED_CELLS = 65536;
|
|
731
|
+
function getLine(state, line) {
|
|
732
|
+
const pos = state.bMarks[line] + state.tShift[line];
|
|
733
|
+
const max = state.eMarks[line];
|
|
734
|
+
return state.src.slice(pos, max);
|
|
735
|
+
}
|
|
736
|
+
function escapedSplit(str) {
|
|
737
|
+
const result = [];
|
|
738
|
+
const max = str.length;
|
|
739
|
+
let pos = 0;
|
|
740
|
+
let ch = str.charCodeAt(pos);
|
|
741
|
+
let isEscaped = false;
|
|
742
|
+
let lastPos = 0;
|
|
743
|
+
let current = "";
|
|
744
|
+
while (pos < max) {
|
|
745
|
+
if (ch === 124) {
|
|
746
|
+
if (!isEscaped) {
|
|
747
|
+
result.push(current + str.substring(lastPos, pos));
|
|
748
|
+
current = "";
|
|
749
|
+
lastPos = pos + 1;
|
|
750
|
+
} else {
|
|
751
|
+
current += str.substring(lastPos, pos - 1);
|
|
752
|
+
lastPos = pos;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
isEscaped = ch === 92;
|
|
756
|
+
pos++;
|
|
757
|
+
ch = str.charCodeAt(pos);
|
|
758
|
+
}
|
|
759
|
+
result.push(current + str.substring(lastPos));
|
|
760
|
+
return result;
|
|
761
|
+
}
|
|
762
|
+
function table(state, startLine, endLine, silent) {
|
|
763
|
+
if (startLine + 2 > endLine) return false;
|
|
764
|
+
let nextLine = startLine + 1;
|
|
765
|
+
if (state.sCount[nextLine] < state.blkIndent) return false;
|
|
766
|
+
if (state.sCount[nextLine] - state.blkIndent >= 4) return false;
|
|
767
|
+
let pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
768
|
+
if (pos >= state.eMarks[nextLine]) return false;
|
|
769
|
+
const firstCh = state.src.charCodeAt(pos++);
|
|
770
|
+
if (firstCh !== 124 && firstCh !== 45 && firstCh !== 58) return false;
|
|
771
|
+
if (pos >= state.eMarks[nextLine]) return false;
|
|
772
|
+
const secondCh = state.src.charCodeAt(pos++);
|
|
773
|
+
if (secondCh !== 124 && secondCh !== 45 && secondCh !== 58 && !isSpace(secondCh)) return false;
|
|
774
|
+
if (firstCh === 45 && isSpace(secondCh)) return false;
|
|
775
|
+
while (pos < state.eMarks[nextLine]) {
|
|
776
|
+
const ch = state.src.charCodeAt(pos);
|
|
777
|
+
if (ch !== 124 && ch !== 45 && ch !== 58 && !isSpace(ch)) return false;
|
|
778
|
+
pos++;
|
|
779
|
+
}
|
|
780
|
+
let lineText = getLine(state, startLine + 1);
|
|
781
|
+
let columns = lineText.split("|");
|
|
782
|
+
const aligns = [];
|
|
783
|
+
for (let i = 0; i < columns.length; i++) {
|
|
784
|
+
const t = columns[i].trim();
|
|
785
|
+
if (!t) {
|
|
786
|
+
if (i === 0 || i === columns.length - 1) continue;
|
|
787
|
+
else return false;
|
|
788
|
+
}
|
|
789
|
+
if (!/^:?-+:?$/.test(t)) return false;
|
|
790
|
+
if (t.charCodeAt(t.length - 1) === 58) aligns.push(t.charCodeAt(0) === 58 ? "center" : "right");
|
|
791
|
+
else if (t.charCodeAt(0) === 58) aligns.push("left");
|
|
792
|
+
else aligns.push("");
|
|
793
|
+
}
|
|
794
|
+
lineText = getLine(state, startLine).trim();
|
|
795
|
+
if (lineText.indexOf("|") === -1) return false;
|
|
796
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
797
|
+
columns = escapedSplit(lineText);
|
|
798
|
+
if (columns.length && columns[0] === "") columns.shift();
|
|
799
|
+
if (columns.length && columns[columns.length - 1] === "") columns.pop();
|
|
800
|
+
const columnCount = columns.length;
|
|
801
|
+
if (columnCount === 0 || columnCount !== aligns.length) return false;
|
|
802
|
+
if (silent) return true;
|
|
803
|
+
const oldParentType = state.parentType;
|
|
804
|
+
state.parentType = "table";
|
|
805
|
+
const terminatorRules = state.md.block.ruler.getRules("blockquote");
|
|
806
|
+
const token_to = state.push("table_open", "table", 1);
|
|
807
|
+
const tableLines = [startLine, 0];
|
|
808
|
+
token_to.map = tableLines;
|
|
809
|
+
const token_tho = state.push("thead_open", "thead", 1);
|
|
810
|
+
token_tho.map = [startLine, startLine + 1];
|
|
811
|
+
const token_htro = state.push("tr_open", "tr", 1);
|
|
812
|
+
token_htro.map = [startLine, startLine + 1];
|
|
813
|
+
for (let i = 0; i < columns.length; i++) {
|
|
814
|
+
const token_ho = state.push("th_open", "th", 1);
|
|
815
|
+
if (aligns[i]) token_ho.attrs = [["style", "text-align:" + aligns[i]]];
|
|
816
|
+
const token_il = state.push("inline", "", 0);
|
|
817
|
+
token_il.content = columns[i].trim();
|
|
818
|
+
token_il.children = [];
|
|
819
|
+
state.push("th_close", "th", -1);
|
|
820
|
+
}
|
|
821
|
+
state.push("tr_close", "tr", -1);
|
|
822
|
+
state.push("thead_close", "thead", -1);
|
|
823
|
+
let tbodyLines;
|
|
824
|
+
let autocompletedCells = 0;
|
|
825
|
+
for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
|
|
826
|
+
if (state.sCount[nextLine] < state.blkIndent) break;
|
|
827
|
+
let terminate = false;
|
|
828
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
829
|
+
terminate = true;
|
|
830
|
+
break;
|
|
831
|
+
}
|
|
832
|
+
if (terminate) break;
|
|
833
|
+
lineText = getLine(state, nextLine).trim();
|
|
834
|
+
if (!lineText) break;
|
|
835
|
+
if (state.sCount[nextLine] - state.blkIndent >= 4) break;
|
|
836
|
+
columns = escapedSplit(lineText);
|
|
837
|
+
if (columns.length && columns[0] === "") columns.shift();
|
|
838
|
+
if (columns.length && columns[columns.length - 1] === "") columns.pop();
|
|
839
|
+
autocompletedCells += columnCount - columns.length;
|
|
840
|
+
if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) break;
|
|
841
|
+
if (nextLine === startLine + 2) {
|
|
842
|
+
const token_tbo = state.push("tbody_open", "tbody", 1);
|
|
843
|
+
token_tbo.map = tbodyLines = [startLine + 2, 0];
|
|
844
|
+
}
|
|
845
|
+
const token_tro = state.push("tr_open", "tr", 1);
|
|
846
|
+
token_tro.map = [nextLine, nextLine + 1];
|
|
847
|
+
for (let i = 0; i < columnCount; i++) {
|
|
848
|
+
const token_tdo = state.push("td_open", "td", 1);
|
|
849
|
+
if (aligns[i]) token_tdo.attrs = [["style", "text-align:" + aligns[i]]];
|
|
850
|
+
const token_il = state.push("inline", "", 0);
|
|
851
|
+
token_il.content = columns[i] ? columns[i].trim() : "";
|
|
852
|
+
token_il.children = [];
|
|
853
|
+
state.push("td_close", "td", -1);
|
|
854
|
+
}
|
|
855
|
+
state.push("tr_close", "tr", -1);
|
|
856
|
+
}
|
|
857
|
+
if (tbodyLines) {
|
|
858
|
+
state.push("tbody_close", "tbody", -1);
|
|
859
|
+
tbodyLines[1] = nextLine;
|
|
860
|
+
}
|
|
861
|
+
state.push("table_close", "table", -1);
|
|
862
|
+
tableLines[1] = nextLine;
|
|
863
|
+
state.parentType = oldParentType;
|
|
864
|
+
state.line = nextLine;
|
|
865
|
+
return true;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// node_modules/markdown-it/lib/rules_block/code.mjs
|
|
869
|
+
function code(state, startLine, endLine) {
|
|
870
|
+
if (state.sCount[startLine] - state.blkIndent < 4) return false;
|
|
871
|
+
let nextLine = startLine + 1;
|
|
872
|
+
let last = nextLine;
|
|
873
|
+
while (nextLine < endLine) {
|
|
874
|
+
if (state.isEmpty(nextLine)) {
|
|
875
|
+
nextLine++;
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
if (state.sCount[nextLine] - state.blkIndent >= 4) {
|
|
879
|
+
nextLine++;
|
|
880
|
+
last = nextLine;
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
break;
|
|
884
|
+
}
|
|
885
|
+
state.line = last;
|
|
886
|
+
const token = state.push("code_block", "code", 0);
|
|
887
|
+
token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + "\n";
|
|
888
|
+
token.map = [startLine, state.line];
|
|
889
|
+
return true;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// node_modules/markdown-it/lib/rules_block/fence.mjs
|
|
893
|
+
function fence(state, startLine, endLine, silent) {
|
|
894
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
895
|
+
let max = state.eMarks[startLine];
|
|
896
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
897
|
+
if (pos + 3 > max) return false;
|
|
898
|
+
const marker = state.src.charCodeAt(pos);
|
|
899
|
+
if (marker !== 126 && marker !== 96) return false;
|
|
900
|
+
let mem = pos;
|
|
901
|
+
pos = state.skipChars(pos, marker);
|
|
902
|
+
let len = pos - mem;
|
|
903
|
+
if (len < 3) return false;
|
|
904
|
+
const markup = state.src.slice(mem, pos);
|
|
905
|
+
const params = state.src.slice(pos, max);
|
|
906
|
+
if (marker === 96) {
|
|
907
|
+
if (params.indexOf(String.fromCharCode(marker)) >= 0) return false;
|
|
908
|
+
}
|
|
909
|
+
if (silent) return true;
|
|
910
|
+
let nextLine = startLine;
|
|
911
|
+
let haveEndMarker = false;
|
|
912
|
+
for (;;) {
|
|
913
|
+
nextLine++;
|
|
914
|
+
if (nextLine >= endLine) break;
|
|
915
|
+
pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
916
|
+
max = state.eMarks[nextLine];
|
|
917
|
+
if (pos < max && state.sCount[nextLine] < state.blkIndent) break;
|
|
918
|
+
if (state.src.charCodeAt(pos) !== marker) continue;
|
|
919
|
+
if (state.sCount[nextLine] - state.blkIndent >= 4) continue;
|
|
920
|
+
pos = state.skipChars(pos, marker);
|
|
921
|
+
if (pos - mem < len) continue;
|
|
922
|
+
pos = state.skipSpaces(pos);
|
|
923
|
+
if (pos < max) continue;
|
|
924
|
+
haveEndMarker = true;
|
|
925
|
+
break;
|
|
926
|
+
}
|
|
927
|
+
len = state.sCount[startLine];
|
|
928
|
+
state.line = nextLine + (haveEndMarker ? 1 : 0);
|
|
929
|
+
const token = state.push("fence", "code", 0);
|
|
930
|
+
token.info = params;
|
|
931
|
+
token.content = state.getLines(startLine + 1, nextLine, len, true);
|
|
932
|
+
token.markup = markup;
|
|
933
|
+
token.map = [startLine, state.line];
|
|
934
|
+
return true;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// node_modules/markdown-it/lib/rules_block/blockquote.mjs
|
|
938
|
+
function blockquote(state, startLine, endLine, silent) {
|
|
939
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
940
|
+
let max = state.eMarks[startLine];
|
|
941
|
+
const oldLineMax = state.lineMax;
|
|
942
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
943
|
+
if (state.src.charCodeAt(pos) !== 62) return false;
|
|
944
|
+
if (silent) return true;
|
|
945
|
+
const oldBMarks = [];
|
|
946
|
+
const oldBSCount = [];
|
|
947
|
+
const oldSCount = [];
|
|
948
|
+
const oldTShift = [];
|
|
949
|
+
const terminatorRules = state.md.block.ruler.getRules("blockquote");
|
|
950
|
+
const oldParentType = state.parentType;
|
|
951
|
+
state.parentType = "blockquote";
|
|
952
|
+
let lastLineEmpty = false;
|
|
953
|
+
let nextLine;
|
|
954
|
+
for (nextLine = startLine; nextLine < endLine; nextLine++) {
|
|
955
|
+
const isOutdented = state.sCount[nextLine] < state.blkIndent;
|
|
956
|
+
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
957
|
+
max = state.eMarks[nextLine];
|
|
958
|
+
if (pos >= max) break;
|
|
959
|
+
if (state.src.charCodeAt(pos++) === 62 && !isOutdented) {
|
|
960
|
+
let initial = state.sCount[nextLine] + 1;
|
|
961
|
+
let spaceAfterMarker;
|
|
962
|
+
let adjustTab;
|
|
963
|
+
if (state.src.charCodeAt(pos) === 32) {
|
|
964
|
+
pos++;
|
|
965
|
+
initial++;
|
|
966
|
+
adjustTab = false;
|
|
967
|
+
spaceAfterMarker = true;
|
|
968
|
+
} else if (state.src.charCodeAt(pos) === 9) {
|
|
969
|
+
spaceAfterMarker = true;
|
|
970
|
+
if ((state.bsCount[nextLine] + initial) % 4 === 3) {
|
|
971
|
+
pos++;
|
|
972
|
+
initial++;
|
|
973
|
+
adjustTab = false;
|
|
974
|
+
} else adjustTab = true;
|
|
975
|
+
} else spaceAfterMarker = false;
|
|
976
|
+
let offset = initial;
|
|
977
|
+
oldBMarks.push(state.bMarks[nextLine]);
|
|
978
|
+
state.bMarks[nextLine] = pos;
|
|
979
|
+
while (pos < max) {
|
|
980
|
+
const ch = state.src.charCodeAt(pos);
|
|
981
|
+
if (isSpace(ch)) {
|
|
982
|
+
if (ch === 9) offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
|
|
983
|
+
else offset++;
|
|
984
|
+
} else break;
|
|
985
|
+
pos++;
|
|
986
|
+
}
|
|
987
|
+
lastLineEmpty = pos >= max;
|
|
988
|
+
oldBSCount.push(state.bsCount[nextLine]);
|
|
989
|
+
state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
|
|
990
|
+
oldSCount.push(state.sCount[nextLine]);
|
|
991
|
+
state.sCount[nextLine] = offset - initial;
|
|
992
|
+
oldTShift.push(state.tShift[nextLine]);
|
|
993
|
+
state.tShift[nextLine] = pos - state.bMarks[nextLine];
|
|
994
|
+
continue;
|
|
995
|
+
}
|
|
996
|
+
if (lastLineEmpty) break;
|
|
997
|
+
let terminate = false;
|
|
998
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
999
|
+
terminate = true;
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
if (terminate) {
|
|
1003
|
+
state.lineMax = nextLine;
|
|
1004
|
+
if (state.blkIndent !== 0) {
|
|
1005
|
+
oldBMarks.push(state.bMarks[nextLine]);
|
|
1006
|
+
oldBSCount.push(state.bsCount[nextLine]);
|
|
1007
|
+
oldTShift.push(state.tShift[nextLine]);
|
|
1008
|
+
oldSCount.push(state.sCount[nextLine]);
|
|
1009
|
+
state.sCount[nextLine] -= state.blkIndent;
|
|
1010
|
+
}
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
oldBMarks.push(state.bMarks[nextLine]);
|
|
1014
|
+
oldBSCount.push(state.bsCount[nextLine]);
|
|
1015
|
+
oldTShift.push(state.tShift[nextLine]);
|
|
1016
|
+
oldSCount.push(state.sCount[nextLine]);
|
|
1017
|
+
state.sCount[nextLine] = -1;
|
|
1018
|
+
}
|
|
1019
|
+
const oldIndent = state.blkIndent;
|
|
1020
|
+
state.blkIndent = 0;
|
|
1021
|
+
const token_o = state.push("blockquote_open", "blockquote", 1);
|
|
1022
|
+
token_o.markup = ">";
|
|
1023
|
+
const lines = [startLine, 0];
|
|
1024
|
+
token_o.map = lines;
|
|
1025
|
+
state.md.block.tokenize(state, startLine, nextLine);
|
|
1026
|
+
const token_c = state.push("blockquote_close", "blockquote", -1);
|
|
1027
|
+
token_c.markup = ">";
|
|
1028
|
+
state.lineMax = oldLineMax;
|
|
1029
|
+
state.parentType = oldParentType;
|
|
1030
|
+
lines[1] = state.line;
|
|
1031
|
+
for (let i = 0; i < oldTShift.length; i++) {
|
|
1032
|
+
state.bMarks[i + startLine] = oldBMarks[i];
|
|
1033
|
+
state.tShift[i + startLine] = oldTShift[i];
|
|
1034
|
+
state.sCount[i + startLine] = oldSCount[i];
|
|
1035
|
+
state.bsCount[i + startLine] = oldBSCount[i];
|
|
1036
|
+
}
|
|
1037
|
+
state.blkIndent = oldIndent;
|
|
1038
|
+
return true;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// node_modules/markdown-it/lib/rules_block/hr.mjs
|
|
1042
|
+
function hr(state, startLine, endLine, silent) {
|
|
1043
|
+
const max = state.eMarks[startLine];
|
|
1044
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
1045
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1046
|
+
const marker = state.src.charCodeAt(pos++);
|
|
1047
|
+
if (marker !== 42 && marker !== 45 && marker !== 95) return false;
|
|
1048
|
+
let cnt = 1;
|
|
1049
|
+
while (pos < max) {
|
|
1050
|
+
const ch = state.src.charCodeAt(pos++);
|
|
1051
|
+
if (ch !== marker && !isSpace(ch)) return false;
|
|
1052
|
+
if (ch === marker) cnt++;
|
|
1053
|
+
}
|
|
1054
|
+
if (cnt < 3) return false;
|
|
1055
|
+
if (silent) return true;
|
|
1056
|
+
state.line = startLine + 1;
|
|
1057
|
+
const token = state.push("hr", "hr", 0);
|
|
1058
|
+
token.map = [startLine, state.line];
|
|
1059
|
+
token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
|
|
1060
|
+
return true;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
// node_modules/markdown-it/lib/rules_block/list.mjs
|
|
1064
|
+
function skipBulletListMarker(state, startLine) {
|
|
1065
|
+
const max = state.eMarks[startLine];
|
|
1066
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1067
|
+
const marker = state.src.charCodeAt(pos++);
|
|
1068
|
+
if (marker !== 42 && marker !== 45 && marker !== 43) return -1;
|
|
1069
|
+
if (pos < max) {
|
|
1070
|
+
const ch = state.src.charCodeAt(pos);
|
|
1071
|
+
if (!isSpace(ch)) return -1;
|
|
1072
|
+
}
|
|
1073
|
+
return pos;
|
|
1074
|
+
}
|
|
1075
|
+
function skipOrderedListMarker(state, startLine) {
|
|
1076
|
+
const start = state.bMarks[startLine] + state.tShift[startLine];
|
|
1077
|
+
const max = state.eMarks[startLine];
|
|
1078
|
+
let pos = start;
|
|
1079
|
+
if (pos + 1 >= max) return -1;
|
|
1080
|
+
let ch = state.src.charCodeAt(pos++);
|
|
1081
|
+
if (ch < 48 || ch > 57) return -1;
|
|
1082
|
+
for (;;) {
|
|
1083
|
+
if (pos >= max) return -1;
|
|
1084
|
+
ch = state.src.charCodeAt(pos++);
|
|
1085
|
+
if (ch >= 48 && ch <= 57) {
|
|
1086
|
+
if (pos - start >= 10) return -1;
|
|
1087
|
+
continue;
|
|
1088
|
+
}
|
|
1089
|
+
if (ch === 41 || ch === 46) break;
|
|
1090
|
+
return -1;
|
|
1091
|
+
}
|
|
1092
|
+
if (pos < max) {
|
|
1093
|
+
ch = state.src.charCodeAt(pos);
|
|
1094
|
+
if (!isSpace(ch)) return -1;
|
|
1095
|
+
}
|
|
1096
|
+
return pos;
|
|
1097
|
+
}
|
|
1098
|
+
function markTightParagraphs(state, idx) {
|
|
1099
|
+
const level = state.level + 2;
|
|
1100
|
+
for (let i = idx + 2, l = state.tokens.length - 2; i < l; i++) if (state.tokens[i].level === level && state.tokens[i].type === "paragraph_open") {
|
|
1101
|
+
state.tokens[i + 2].hidden = true;
|
|
1102
|
+
state.tokens[i].hidden = true;
|
|
1103
|
+
i += 2;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
function list(state, startLine, endLine, silent) {
|
|
1107
|
+
let max, pos, start, token;
|
|
1108
|
+
let nextLine = startLine;
|
|
1109
|
+
let tight = true;
|
|
1110
|
+
if (state.sCount[nextLine] - state.blkIndent >= 4) return false;
|
|
1111
|
+
if (state.listIndent >= 0 && state.sCount[nextLine] - state.listIndent >= 4 && state.sCount[nextLine] < state.blkIndent) return false;
|
|
1112
|
+
let isTerminatingParagraph = false;
|
|
1113
|
+
if (silent && state.parentType === "paragraph") {
|
|
1114
|
+
if (state.sCount[nextLine] >= state.blkIndent) isTerminatingParagraph = true;
|
|
1115
|
+
}
|
|
1116
|
+
let isOrdered;
|
|
1117
|
+
let markerValue;
|
|
1118
|
+
let posAfterMarker;
|
|
1119
|
+
if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {
|
|
1120
|
+
isOrdered = true;
|
|
1121
|
+
start = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
1122
|
+
markerValue = Number(state.src.slice(start, posAfterMarker - 1));
|
|
1123
|
+
if (isTerminatingParagraph && markerValue !== 1) return false;
|
|
1124
|
+
} else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) isOrdered = false;
|
|
1125
|
+
else return false;
|
|
1126
|
+
if (isTerminatingParagraph) {
|
|
1127
|
+
if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false;
|
|
1128
|
+
}
|
|
1129
|
+
if (silent) return true;
|
|
1130
|
+
const markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
|
|
1131
|
+
const listTokIdx = state.tokens.length;
|
|
1132
|
+
if (isOrdered) {
|
|
1133
|
+
token = state.push("ordered_list_open", "ol", 1);
|
|
1134
|
+
if (markerValue !== 1) token.attrs = [["start", markerValue]];
|
|
1135
|
+
} else token = state.push("bullet_list_open", "ul", 1);
|
|
1136
|
+
const listLines = [nextLine, 0];
|
|
1137
|
+
token.map = listLines;
|
|
1138
|
+
token.markup = String.fromCharCode(markerCharCode);
|
|
1139
|
+
let prevEmptyEnd = false;
|
|
1140
|
+
const terminatorRules = state.md.block.ruler.getRules("list");
|
|
1141
|
+
const oldParentType = state.parentType;
|
|
1142
|
+
state.parentType = "list";
|
|
1143
|
+
while (nextLine < endLine) {
|
|
1144
|
+
pos = posAfterMarker;
|
|
1145
|
+
max = state.eMarks[nextLine];
|
|
1146
|
+
const initial = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]);
|
|
1147
|
+
let offset = initial;
|
|
1148
|
+
while (pos < max) {
|
|
1149
|
+
const ch = state.src.charCodeAt(pos);
|
|
1150
|
+
if (ch === 9) offset += 4 - (offset + state.bsCount[nextLine]) % 4;
|
|
1151
|
+
else if (ch === 32) offset++;
|
|
1152
|
+
else break;
|
|
1153
|
+
pos++;
|
|
1154
|
+
}
|
|
1155
|
+
const contentStart = pos;
|
|
1156
|
+
let indentAfterMarker;
|
|
1157
|
+
if (contentStart >= max) indentAfterMarker = 1;
|
|
1158
|
+
else indentAfterMarker = offset - initial;
|
|
1159
|
+
if (indentAfterMarker > 4) indentAfterMarker = 1;
|
|
1160
|
+
const indent = initial + indentAfterMarker;
|
|
1161
|
+
token = state.push("list_item_open", "li", 1);
|
|
1162
|
+
token.markup = String.fromCharCode(markerCharCode);
|
|
1163
|
+
const itemLines = [nextLine, 0];
|
|
1164
|
+
token.map = itemLines;
|
|
1165
|
+
if (isOrdered) token.info = state.src.slice(start, posAfterMarker - 1);
|
|
1166
|
+
const oldTight = state.tight;
|
|
1167
|
+
const oldTShift = state.tShift[nextLine];
|
|
1168
|
+
const oldSCount = state.sCount[nextLine];
|
|
1169
|
+
const oldListIndent = state.listIndent;
|
|
1170
|
+
state.listIndent = state.blkIndent;
|
|
1171
|
+
state.blkIndent = indent;
|
|
1172
|
+
state.tight = true;
|
|
1173
|
+
state.tShift[nextLine] = contentStart - state.bMarks[nextLine];
|
|
1174
|
+
state.sCount[nextLine] = offset;
|
|
1175
|
+
if (contentStart >= max && state.isEmpty(nextLine + 1)) state.line = Math.min(state.line + 2, endLine);
|
|
1176
|
+
else state.md.block.tokenize(state, nextLine, endLine, true);
|
|
1177
|
+
if (!state.tight || prevEmptyEnd) tight = false;
|
|
1178
|
+
prevEmptyEnd = state.line - nextLine > 1 && state.isEmpty(state.line - 1);
|
|
1179
|
+
state.blkIndent = state.listIndent;
|
|
1180
|
+
state.listIndent = oldListIndent;
|
|
1181
|
+
state.tShift[nextLine] = oldTShift;
|
|
1182
|
+
state.sCount[nextLine] = oldSCount;
|
|
1183
|
+
state.tight = oldTight;
|
|
1184
|
+
token = state.push("list_item_close", "li", -1);
|
|
1185
|
+
token.markup = String.fromCharCode(markerCharCode);
|
|
1186
|
+
nextLine = state.line;
|
|
1187
|
+
itemLines[1] = nextLine;
|
|
1188
|
+
if (nextLine >= endLine) break;
|
|
1189
|
+
if (state.sCount[nextLine] < state.blkIndent) break;
|
|
1190
|
+
if (state.sCount[nextLine] - state.blkIndent >= 4) break;
|
|
1191
|
+
let terminate = false;
|
|
1192
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
1193
|
+
terminate = true;
|
|
1194
|
+
break;
|
|
1195
|
+
}
|
|
1196
|
+
if (terminate) break;
|
|
1197
|
+
if (isOrdered) {
|
|
1198
|
+
posAfterMarker = skipOrderedListMarker(state, nextLine);
|
|
1199
|
+
if (posAfterMarker < 0) break;
|
|
1200
|
+
start = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
1201
|
+
} else {
|
|
1202
|
+
posAfterMarker = skipBulletListMarker(state, nextLine);
|
|
1203
|
+
if (posAfterMarker < 0) break;
|
|
1204
|
+
}
|
|
1205
|
+
if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) break;
|
|
1206
|
+
}
|
|
1207
|
+
if (isOrdered) token = state.push("ordered_list_close", "ol", -1);
|
|
1208
|
+
else token = state.push("bullet_list_close", "ul", -1);
|
|
1209
|
+
token.markup = String.fromCharCode(markerCharCode);
|
|
1210
|
+
listLines[1] = nextLine;
|
|
1211
|
+
state.line = nextLine;
|
|
1212
|
+
state.parentType = oldParentType;
|
|
1213
|
+
if (tight) markTightParagraphs(state, listTokIdx);
|
|
1214
|
+
return true;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// node_modules/markdown-it/lib/rules_block/reference.mjs
|
|
1218
|
+
function reference(state, startLine, _endLine, silent) {
|
|
1219
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1220
|
+
let max = state.eMarks[startLine];
|
|
1221
|
+
let nextLine = startLine + 1;
|
|
1222
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
1223
|
+
if (state.src.charCodeAt(pos) !== 91) return false;
|
|
1224
|
+
function getNextLine(nextLine) {
|
|
1225
|
+
const endLine = state.lineMax;
|
|
1226
|
+
if (nextLine >= endLine || state.isEmpty(nextLine)) return null;
|
|
1227
|
+
let isContinuation = false;
|
|
1228
|
+
if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
|
|
1229
|
+
if (state.sCount[nextLine] < 0) isContinuation = true;
|
|
1230
|
+
if (!isContinuation) {
|
|
1231
|
+
const terminatorRules = state.md.block.ruler.getRules("reference");
|
|
1232
|
+
const oldParentType = state.parentType;
|
|
1233
|
+
state.parentType = "reference";
|
|
1234
|
+
let terminate = false;
|
|
1235
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
1236
|
+
terminate = true;
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
state.parentType = oldParentType;
|
|
1240
|
+
if (terminate) return null;
|
|
1241
|
+
}
|
|
1242
|
+
const pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
1243
|
+
const max = state.eMarks[nextLine];
|
|
1244
|
+
return state.src.slice(pos, max + 1);
|
|
1245
|
+
}
|
|
1246
|
+
let str = state.src.slice(pos, max + 1);
|
|
1247
|
+
max = str.length;
|
|
1248
|
+
let labelEnd = -1;
|
|
1249
|
+
for (pos = 1; pos < max; pos++) {
|
|
1250
|
+
const ch = str.charCodeAt(pos);
|
|
1251
|
+
if (ch === 91) return false;
|
|
1252
|
+
else if (ch === 93) {
|
|
1253
|
+
labelEnd = pos;
|
|
1254
|
+
break;
|
|
1255
|
+
} else if (ch === 10) {
|
|
1256
|
+
const lineContent = getNextLine(nextLine);
|
|
1257
|
+
if (lineContent !== null) {
|
|
1258
|
+
str += lineContent;
|
|
1259
|
+
max = str.length;
|
|
1260
|
+
nextLine++;
|
|
1261
|
+
}
|
|
1262
|
+
} else if (ch === 92) {
|
|
1263
|
+
pos++;
|
|
1264
|
+
if (pos < max && str.charCodeAt(pos) === 10) {
|
|
1265
|
+
const lineContent = getNextLine(nextLine);
|
|
1266
|
+
if (lineContent !== null) {
|
|
1267
|
+
str += lineContent;
|
|
1268
|
+
max = str.length;
|
|
1269
|
+
nextLine++;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) return false;
|
|
1275
|
+
for (pos = labelEnd + 2; pos < max; pos++) {
|
|
1276
|
+
const ch = str.charCodeAt(pos);
|
|
1277
|
+
if (ch === 10) {
|
|
1278
|
+
const lineContent = getNextLine(nextLine);
|
|
1279
|
+
if (lineContent !== null) {
|
|
1280
|
+
str += lineContent;
|
|
1281
|
+
max = str.length;
|
|
1282
|
+
nextLine++;
|
|
1283
|
+
}
|
|
1284
|
+
} else if (isSpace(ch)) {} else break;
|
|
1285
|
+
}
|
|
1286
|
+
const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
|
|
1287
|
+
if (!destRes.ok) return false;
|
|
1288
|
+
const href = state.md.normalizeLink(destRes.str);
|
|
1289
|
+
if (!state.md.validateLink(href)) return false;
|
|
1290
|
+
pos = destRes.pos;
|
|
1291
|
+
const destEndPos = pos;
|
|
1292
|
+
const destEndLineNo = nextLine;
|
|
1293
|
+
const start = pos;
|
|
1294
|
+
for (; pos < max; pos++) {
|
|
1295
|
+
const ch = str.charCodeAt(pos);
|
|
1296
|
+
if (ch === 10) {
|
|
1297
|
+
const lineContent = getNextLine(nextLine);
|
|
1298
|
+
if (lineContent !== null) {
|
|
1299
|
+
str += lineContent;
|
|
1300
|
+
max = str.length;
|
|
1301
|
+
nextLine++;
|
|
1302
|
+
}
|
|
1303
|
+
} else if (isSpace(ch)) {} else break;
|
|
1304
|
+
}
|
|
1305
|
+
let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
|
|
1306
|
+
while (titleRes.can_continue) {
|
|
1307
|
+
const lineContent = getNextLine(nextLine);
|
|
1308
|
+
if (lineContent === null) break;
|
|
1309
|
+
str += lineContent;
|
|
1310
|
+
pos = max;
|
|
1311
|
+
max = str.length;
|
|
1312
|
+
nextLine++;
|
|
1313
|
+
titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
|
|
1314
|
+
}
|
|
1315
|
+
let title;
|
|
1316
|
+
if (pos < max && start !== pos && titleRes.ok) {
|
|
1317
|
+
title = titleRes.str;
|
|
1318
|
+
pos = titleRes.pos;
|
|
1319
|
+
} else {
|
|
1320
|
+
title = "";
|
|
1321
|
+
pos = destEndPos;
|
|
1322
|
+
nextLine = destEndLineNo;
|
|
1323
|
+
}
|
|
1324
|
+
while (pos < max) {
|
|
1325
|
+
const ch = str.charCodeAt(pos);
|
|
1326
|
+
if (!isSpace(ch)) break;
|
|
1327
|
+
pos++;
|
|
1328
|
+
}
|
|
1329
|
+
if (pos < max && str.charCodeAt(pos) !== 10) {
|
|
1330
|
+
if (title) {
|
|
1331
|
+
title = "";
|
|
1332
|
+
pos = destEndPos;
|
|
1333
|
+
nextLine = destEndLineNo;
|
|
1334
|
+
while (pos < max) {
|
|
1335
|
+
const ch = str.charCodeAt(pos);
|
|
1336
|
+
if (!isSpace(ch)) break;
|
|
1337
|
+
pos++;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
if (pos < max && str.charCodeAt(pos) !== 10) return false;
|
|
1342
|
+
const label = normalizeReference(str.slice(1, labelEnd));
|
|
1343
|
+
if (!label) return false;
|
|
1344
|
+
/* istanbul ignore if */
|
|
1345
|
+
if (silent) return true;
|
|
1346
|
+
if (typeof state.env.references === "undefined") state.env.references = {};
|
|
1347
|
+
if (typeof state.env.references[label] === "undefined") state.env.references[label] = {
|
|
1348
|
+
title,
|
|
1349
|
+
href
|
|
1350
|
+
};
|
|
1351
|
+
state.line = nextLine;
|
|
1352
|
+
return true;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
// node_modules/markdown-it/lib/common/html_blocks.mjs
|
|
1356
|
+
var html_blocks_default = [
|
|
1357
|
+
"address",
|
|
1358
|
+
"article",
|
|
1359
|
+
"aside",
|
|
1360
|
+
"base",
|
|
1361
|
+
"basefont",
|
|
1362
|
+
"blockquote",
|
|
1363
|
+
"body",
|
|
1364
|
+
"caption",
|
|
1365
|
+
"center",
|
|
1366
|
+
"col",
|
|
1367
|
+
"colgroup",
|
|
1368
|
+
"dd",
|
|
1369
|
+
"details",
|
|
1370
|
+
"dialog",
|
|
1371
|
+
"dir",
|
|
1372
|
+
"div",
|
|
1373
|
+
"dl",
|
|
1374
|
+
"dt",
|
|
1375
|
+
"fieldset",
|
|
1376
|
+
"figcaption",
|
|
1377
|
+
"figure",
|
|
1378
|
+
"footer",
|
|
1379
|
+
"form",
|
|
1380
|
+
"frame",
|
|
1381
|
+
"frameset",
|
|
1382
|
+
"h1",
|
|
1383
|
+
"h2",
|
|
1384
|
+
"h3",
|
|
1385
|
+
"h4",
|
|
1386
|
+
"h5",
|
|
1387
|
+
"h6",
|
|
1388
|
+
"head",
|
|
1389
|
+
"header",
|
|
1390
|
+
"hr",
|
|
1391
|
+
"html",
|
|
1392
|
+
"iframe",
|
|
1393
|
+
"legend",
|
|
1394
|
+
"li",
|
|
1395
|
+
"link",
|
|
1396
|
+
"main",
|
|
1397
|
+
"menu",
|
|
1398
|
+
"menuitem",
|
|
1399
|
+
"nav",
|
|
1400
|
+
"noframes",
|
|
1401
|
+
"ol",
|
|
1402
|
+
"optgroup",
|
|
1403
|
+
"option",
|
|
1404
|
+
"p",
|
|
1405
|
+
"param",
|
|
1406
|
+
"search",
|
|
1407
|
+
"section",
|
|
1408
|
+
"summary",
|
|
1409
|
+
"table",
|
|
1410
|
+
"tbody",
|
|
1411
|
+
"td",
|
|
1412
|
+
"tfoot",
|
|
1413
|
+
"th",
|
|
1414
|
+
"thead",
|
|
1415
|
+
"title",
|
|
1416
|
+
"tr",
|
|
1417
|
+
"track",
|
|
1418
|
+
"ul"
|
|
1419
|
+
];
|
|
1420
|
+
|
|
1421
|
+
// node_modules/markdown-it/lib/common/html_re.mjs
|
|
1422
|
+
const open_tag = "<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>";
|
|
1423
|
+
const close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
|
|
1424
|
+
const HTML_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + "|" + "<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->" + "|" + "<[?][\\s\\S]*?[?]>" + "|" + "<![A-Za-z][^>]*>" + "|" + "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>" + ")");
|
|
1425
|
+
const HTML_OPEN_CLOSE_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + ")");
|
|
1426
|
+
|
|
1427
|
+
// node_modules/markdown-it/lib/rules_block/html_block.mjs
|
|
1428
|
+
const HTML_SEQUENCES = [
|
|
1429
|
+
[
|
|
1430
|
+
/^<(script|pre|style|textarea)(?=(\s|>|$))/i,
|
|
1431
|
+
/<\/(script|pre|style|textarea)>/i,
|
|
1432
|
+
true
|
|
1433
|
+
],
|
|
1434
|
+
[
|
|
1435
|
+
/^<!--/,
|
|
1436
|
+
/-->/,
|
|
1437
|
+
true
|
|
1438
|
+
],
|
|
1439
|
+
[
|
|
1440
|
+
/^<\?/,
|
|
1441
|
+
/\?>/,
|
|
1442
|
+
true
|
|
1443
|
+
],
|
|
1444
|
+
[
|
|
1445
|
+
/^<![A-Z]/,
|
|
1446
|
+
/>/,
|
|
1447
|
+
true
|
|
1448
|
+
],
|
|
1449
|
+
[
|
|
1450
|
+
/^<!\[CDATA\[/,
|
|
1451
|
+
/\]\]>/,
|
|
1452
|
+
true
|
|
1453
|
+
],
|
|
1454
|
+
[
|
|
1455
|
+
new RegExp("^</?(" + html_blocks_default.join("|") + ")(?=(\\s|/?>|$))", "i"),
|
|
1456
|
+
/^$/,
|
|
1457
|
+
true
|
|
1458
|
+
],
|
|
1459
|
+
[
|
|
1460
|
+
new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + "\\s*$"),
|
|
1461
|
+
/^$/,
|
|
1462
|
+
false
|
|
1463
|
+
]
|
|
1464
|
+
];
|
|
1465
|
+
function html_block(state, startLine, endLine, silent) {
|
|
1466
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1467
|
+
let max = state.eMarks[startLine];
|
|
1468
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
1469
|
+
if (!state.md.options.html) return false;
|
|
1470
|
+
if (state.src.charCodeAt(pos) !== 60) return false;
|
|
1471
|
+
let lineText = state.src.slice(pos, max);
|
|
1472
|
+
let i = 0;
|
|
1473
|
+
for (; i < HTML_SEQUENCES.length; i++) if (HTML_SEQUENCES[i][0].test(lineText)) break;
|
|
1474
|
+
if (i === HTML_SEQUENCES.length) return false;
|
|
1475
|
+
if (silent) return HTML_SEQUENCES[i][2];
|
|
1476
|
+
let nextLine = startLine + 1;
|
|
1477
|
+
if (!HTML_SEQUENCES[i][1].test(lineText)) for (; nextLine < endLine; nextLine++) {
|
|
1478
|
+
if (state.sCount[nextLine] < state.blkIndent) break;
|
|
1479
|
+
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
1480
|
+
max = state.eMarks[nextLine];
|
|
1481
|
+
lineText = state.src.slice(pos, max);
|
|
1482
|
+
if (HTML_SEQUENCES[i][1].test(lineText)) {
|
|
1483
|
+
if (lineText.length !== 0) nextLine++;
|
|
1484
|
+
break;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
state.line = nextLine;
|
|
1488
|
+
const token = state.push("html_block", "", 0);
|
|
1489
|
+
token.map = [startLine, nextLine];
|
|
1490
|
+
token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
|
|
1491
|
+
return true;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// node_modules/markdown-it/lib/rules_block/heading.mjs
|
|
1495
|
+
function heading(state, startLine, endLine, silent) {
|
|
1496
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1497
|
+
let max = state.eMarks[startLine];
|
|
1498
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
1499
|
+
let ch = state.src.charCodeAt(pos);
|
|
1500
|
+
if (ch !== 35 || pos >= max) return false;
|
|
1501
|
+
let level = 1;
|
|
1502
|
+
ch = state.src.charCodeAt(++pos);
|
|
1503
|
+
while (ch === 35 && pos < max && level <= 6) {
|
|
1504
|
+
level++;
|
|
1505
|
+
ch = state.src.charCodeAt(++pos);
|
|
1506
|
+
}
|
|
1507
|
+
if (level > 6 || pos < max && !isSpace(ch)) return false;
|
|
1508
|
+
if (silent) return true;
|
|
1509
|
+
max = state.skipSpacesBack(max, pos);
|
|
1510
|
+
const tmp = state.skipCharsBack(max, 35, pos);
|
|
1511
|
+
if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) max = tmp;
|
|
1512
|
+
state.line = startLine + 1;
|
|
1513
|
+
const token_o = state.push("heading_open", "h" + String(level), 1);
|
|
1514
|
+
token_o.markup = "########".slice(0, level);
|
|
1515
|
+
token_o.map = [startLine, state.line];
|
|
1516
|
+
const token_i = state.push("inline", "", 0);
|
|
1517
|
+
token_i.content = state.src.slice(pos, max).trim();
|
|
1518
|
+
token_i.map = [startLine, state.line];
|
|
1519
|
+
token_i.children = [];
|
|
1520
|
+
const token_c = state.push("heading_close", "h" + String(level), -1);
|
|
1521
|
+
token_c.markup = "########".slice(0, level);
|
|
1522
|
+
return true;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
// node_modules/markdown-it/lib/rules_block/lheading.mjs
|
|
1526
|
+
function lheading(state, startLine, endLine) {
|
|
1527
|
+
const terminatorRules = state.md.block.ruler.getRules("paragraph");
|
|
1528
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
1529
|
+
const oldParentType = state.parentType;
|
|
1530
|
+
state.parentType = "paragraph";
|
|
1531
|
+
let level = 0;
|
|
1532
|
+
let marker;
|
|
1533
|
+
let nextLine = startLine + 1;
|
|
1534
|
+
for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
|
|
1535
|
+
if (state.sCount[nextLine] - state.blkIndent > 3) continue;
|
|
1536
|
+
if (state.sCount[nextLine] >= state.blkIndent) {
|
|
1537
|
+
let pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
1538
|
+
const max = state.eMarks[nextLine];
|
|
1539
|
+
if (pos < max) {
|
|
1540
|
+
marker = state.src.charCodeAt(pos);
|
|
1541
|
+
if (marker === 45 || marker === 61) {
|
|
1542
|
+
pos = state.skipChars(pos, marker);
|
|
1543
|
+
pos = state.skipSpaces(pos);
|
|
1544
|
+
if (pos >= max) {
|
|
1545
|
+
level = marker === 61 ? 1 : 2;
|
|
1546
|
+
break;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
if (state.sCount[nextLine] < 0) continue;
|
|
1552
|
+
let terminate = false;
|
|
1553
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
1554
|
+
terminate = true;
|
|
1555
|
+
break;
|
|
1556
|
+
}
|
|
1557
|
+
if (terminate) break;
|
|
1558
|
+
}
|
|
1559
|
+
if (!level) return false;
|
|
1560
|
+
const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
|
|
1561
|
+
state.line = nextLine + 1;
|
|
1562
|
+
const token_o = state.push("heading_open", "h" + String(level), 1);
|
|
1563
|
+
token_o.markup = String.fromCharCode(marker);
|
|
1564
|
+
token_o.map = [startLine, state.line];
|
|
1565
|
+
const token_i = state.push("inline", "", 0);
|
|
1566
|
+
token_i.content = content;
|
|
1567
|
+
token_i.map = [startLine, state.line - 1];
|
|
1568
|
+
token_i.children = [];
|
|
1569
|
+
const token_c = state.push("heading_close", "h" + String(level), -1);
|
|
1570
|
+
token_c.markup = String.fromCharCode(marker);
|
|
1571
|
+
state.parentType = oldParentType;
|
|
1572
|
+
return true;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// node_modules/markdown-it/lib/rules_block/paragraph.mjs
|
|
1576
|
+
function paragraph(state, startLine, endLine) {
|
|
1577
|
+
const terminatorRules = state.md.block.ruler.getRules("paragraph");
|
|
1578
|
+
const oldParentType = state.parentType;
|
|
1579
|
+
let nextLine = startLine + 1;
|
|
1580
|
+
state.parentType = "paragraph";
|
|
1581
|
+
for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
|
|
1582
|
+
if (state.sCount[nextLine] - state.blkIndent > 3) continue;
|
|
1583
|
+
if (state.sCount[nextLine] < 0) continue;
|
|
1584
|
+
let terminate = false;
|
|
1585
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
1586
|
+
terminate = true;
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1589
|
+
if (terminate) break;
|
|
1590
|
+
}
|
|
1591
|
+
const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
|
|
1592
|
+
state.line = nextLine;
|
|
1593
|
+
const token_o = state.push("paragraph_open", "p", 1);
|
|
1594
|
+
token_o.map = [startLine, state.line];
|
|
1595
|
+
const token_i = state.push("inline", "", 0);
|
|
1596
|
+
token_i.content = content;
|
|
1597
|
+
token_i.map = [startLine, state.line];
|
|
1598
|
+
token_i.children = [];
|
|
1599
|
+
state.push("paragraph_close", "p", -1);
|
|
1600
|
+
state.parentType = oldParentType;
|
|
1601
|
+
return true;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
// node_modules/markdown-it/lib/parser_block.mjs
|
|
1605
|
+
const _rules$1 = [
|
|
1606
|
+
[
|
|
1607
|
+
"table",
|
|
1608
|
+
table,
|
|
1609
|
+
["paragraph", "reference"]
|
|
1610
|
+
],
|
|
1611
|
+
["code", code],
|
|
1612
|
+
[
|
|
1613
|
+
"fence",
|
|
1614
|
+
fence,
|
|
1615
|
+
[
|
|
1616
|
+
"paragraph",
|
|
1617
|
+
"reference",
|
|
1618
|
+
"blockquote",
|
|
1619
|
+
"list"
|
|
1620
|
+
]
|
|
1621
|
+
],
|
|
1622
|
+
[
|
|
1623
|
+
"blockquote",
|
|
1624
|
+
blockquote,
|
|
1625
|
+
[
|
|
1626
|
+
"paragraph",
|
|
1627
|
+
"reference",
|
|
1628
|
+
"blockquote",
|
|
1629
|
+
"list"
|
|
1630
|
+
]
|
|
1631
|
+
],
|
|
1632
|
+
[
|
|
1633
|
+
"hr",
|
|
1634
|
+
hr,
|
|
1635
|
+
[
|
|
1636
|
+
"paragraph",
|
|
1637
|
+
"reference",
|
|
1638
|
+
"blockquote",
|
|
1639
|
+
"list"
|
|
1640
|
+
]
|
|
1641
|
+
],
|
|
1642
|
+
[
|
|
1643
|
+
"list",
|
|
1644
|
+
list,
|
|
1645
|
+
[
|
|
1646
|
+
"paragraph",
|
|
1647
|
+
"reference",
|
|
1648
|
+
"blockquote"
|
|
1649
|
+
]
|
|
1650
|
+
],
|
|
1651
|
+
["reference", reference],
|
|
1652
|
+
[
|
|
1653
|
+
"html_block",
|
|
1654
|
+
html_block,
|
|
1655
|
+
[
|
|
1656
|
+
"paragraph",
|
|
1657
|
+
"reference",
|
|
1658
|
+
"blockquote"
|
|
1659
|
+
]
|
|
1660
|
+
],
|
|
1661
|
+
[
|
|
1662
|
+
"heading",
|
|
1663
|
+
heading,
|
|
1664
|
+
[
|
|
1665
|
+
"paragraph",
|
|
1666
|
+
"reference",
|
|
1667
|
+
"blockquote"
|
|
1668
|
+
]
|
|
1669
|
+
],
|
|
1670
|
+
["lheading", lheading],
|
|
1671
|
+
["paragraph", paragraph]
|
|
1672
|
+
];
|
|
1673
|
+
function ParserBlock() {
|
|
1674
|
+
this.ruler = new Ruler();
|
|
1675
|
+
for (let i = 0; i < _rules$1.length; i++) this.ruler.push(_rules$1[i][0], _rules$1[i][1], { alt: (_rules$1[i][2] || []).slice() });
|
|
1676
|
+
}
|
|
1677
|
+
ParserBlock.prototype.tokenize = function(state, startLine, endLine) {
|
|
1678
|
+
const rules = this.ruler.getRules("");
|
|
1679
|
+
const len = rules.length;
|
|
1680
|
+
const maxNesting = state.md.options.maxNesting;
|
|
1681
|
+
let line = startLine;
|
|
1682
|
+
let hasEmptyLines = false;
|
|
1683
|
+
while (line < endLine) {
|
|
1684
|
+
state.line = line = state.skipEmptyLines(line);
|
|
1685
|
+
if (line >= endLine) break;
|
|
1686
|
+
if (state.sCount[line] < state.blkIndent) break;
|
|
1687
|
+
if (state.level >= maxNesting) {
|
|
1688
|
+
state.line = endLine;
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
const prevLine = state.line;
|
|
1692
|
+
let ok = false;
|
|
1693
|
+
for (let i = 0; i < len; i++) {
|
|
1694
|
+
ok = rules[i](state, line, endLine, false);
|
|
1695
|
+
if (ok) {
|
|
1696
|
+
if (prevLine >= state.line) throw new Error("block rule didn't increment state.line");
|
|
1697
|
+
break;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
if (!ok) throw new Error("none of the block rules matched");
|
|
1701
|
+
state.tight = !hasEmptyLines;
|
|
1702
|
+
if (state.isEmpty(state.line - 1)) hasEmptyLines = true;
|
|
1703
|
+
line = state.line;
|
|
1704
|
+
if (line < endLine && state.isEmpty(line)) {
|
|
1705
|
+
hasEmptyLines = true;
|
|
1706
|
+
line++;
|
|
1707
|
+
state.line = line;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
ParserBlock.prototype.parse = function(src, md, env, outTokens) {
|
|
1712
|
+
if (!src) return;
|
|
1713
|
+
const state = new this.State(src, md, env, outTokens);
|
|
1714
|
+
this.tokenize(state, state.line, state.lineMax);
|
|
1715
|
+
};
|
|
1716
|
+
ParserBlock.prototype.State = StateBlock;
|
|
1717
|
+
|
|
1718
|
+
// node_modules/markdown-it/lib/rules_inline/state_inline.mjs
|
|
1719
|
+
function StateInline(src, md, env, outTokens) {
|
|
1720
|
+
this.src = src;
|
|
1721
|
+
this.env = env;
|
|
1722
|
+
this.md = md;
|
|
1723
|
+
this.tokens = outTokens;
|
|
1724
|
+
this.tokens_meta = Array(outTokens.length);
|
|
1725
|
+
this.pos = 0;
|
|
1726
|
+
this.posMax = this.src.length;
|
|
1727
|
+
this.level = 0;
|
|
1728
|
+
this.pending = "";
|
|
1729
|
+
this.pendingLevel = 0;
|
|
1730
|
+
this.cache = {};
|
|
1731
|
+
this.delimiters = [];
|
|
1732
|
+
this._prev_delimiters = [];
|
|
1733
|
+
this.backticks = {};
|
|
1734
|
+
this.backticksScanned = false;
|
|
1735
|
+
this.linkLevel = 0;
|
|
1736
|
+
}
|
|
1737
|
+
StateInline.prototype.pushPending = function() {
|
|
1738
|
+
const token = new Token("text", "", 0);
|
|
1739
|
+
token.content = this.pending;
|
|
1740
|
+
token.level = this.pendingLevel;
|
|
1741
|
+
this.tokens.push(token);
|
|
1742
|
+
this.pending = "";
|
|
1743
|
+
return token;
|
|
1744
|
+
};
|
|
1745
|
+
StateInline.prototype.push = function(type, tag, nesting) {
|
|
1746
|
+
if (this.pending) this.pushPending();
|
|
1747
|
+
const token = new Token(type, tag, nesting);
|
|
1748
|
+
let token_meta = null;
|
|
1749
|
+
if (nesting < 0) {
|
|
1750
|
+
this.level--;
|
|
1751
|
+
this.delimiters = this._prev_delimiters.pop();
|
|
1752
|
+
}
|
|
1753
|
+
token.level = this.level;
|
|
1754
|
+
if (nesting > 0) {
|
|
1755
|
+
this.level++;
|
|
1756
|
+
this._prev_delimiters.push(this.delimiters);
|
|
1757
|
+
this.delimiters = [];
|
|
1758
|
+
token_meta = { delimiters: this.delimiters };
|
|
1759
|
+
}
|
|
1760
|
+
this.pendingLevel = this.level;
|
|
1761
|
+
this.tokens.push(token);
|
|
1762
|
+
this.tokens_meta.push(token_meta);
|
|
1763
|
+
return token;
|
|
1764
|
+
};
|
|
1765
|
+
StateInline.prototype.scanDelims = function(start, canSplitWord) {
|
|
1766
|
+
const max = this.posMax;
|
|
1767
|
+
const marker = this.src.charCodeAt(start);
|
|
1768
|
+
const lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 32;
|
|
1769
|
+
let pos = start;
|
|
1770
|
+
while (pos < max && this.src.charCodeAt(pos) === marker) pos++;
|
|
1771
|
+
const count = pos - start;
|
|
1772
|
+
const nextChar = pos < max ? this.src.charCodeAt(pos) : 32;
|
|
1773
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
|
|
1774
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
|
|
1775
|
+
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
1776
|
+
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
1777
|
+
const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
|
|
1778
|
+
const right_flanking = !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
|
|
1779
|
+
return {
|
|
1780
|
+
can_open: left_flanking && (canSplitWord || !right_flanking || isLastPunctChar),
|
|
1781
|
+
can_close: right_flanking && (canSplitWord || !left_flanking || isNextPunctChar),
|
|
1782
|
+
length: count
|
|
1783
|
+
};
|
|
1784
|
+
};
|
|
1785
|
+
StateInline.prototype.Token = Token;
|
|
1786
|
+
|
|
1787
|
+
// node_modules/markdown-it/lib/rules_inline/text.mjs
|
|
1788
|
+
function isTerminatorChar(ch) {
|
|
1789
|
+
switch (ch) {
|
|
1790
|
+
case 10:
|
|
1791
|
+
case 33:
|
|
1792
|
+
case 35:
|
|
1793
|
+
case 36:
|
|
1794
|
+
case 37:
|
|
1795
|
+
case 38:
|
|
1796
|
+
case 42:
|
|
1797
|
+
case 43:
|
|
1798
|
+
case 45:
|
|
1799
|
+
case 58:
|
|
1800
|
+
case 60:
|
|
1801
|
+
case 61:
|
|
1802
|
+
case 62:
|
|
1803
|
+
case 64:
|
|
1804
|
+
case 91:
|
|
1805
|
+
case 92:
|
|
1806
|
+
case 93:
|
|
1807
|
+
case 94:
|
|
1808
|
+
case 95:
|
|
1809
|
+
case 96:
|
|
1810
|
+
case 123:
|
|
1811
|
+
case 125:
|
|
1812
|
+
case 126: return true;
|
|
1813
|
+
default: return false;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
function text(state, silent) {
|
|
1817
|
+
let pos = state.pos;
|
|
1818
|
+
while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) pos++;
|
|
1819
|
+
if (pos === state.pos) return false;
|
|
1820
|
+
if (!silent) state.pending += state.src.slice(state.pos, pos);
|
|
1821
|
+
state.pos = pos;
|
|
1822
|
+
return true;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
// node_modules/markdown-it/lib/rules_inline/newline.mjs
|
|
1826
|
+
function newline(state, silent) {
|
|
1827
|
+
let pos = state.pos;
|
|
1828
|
+
if (state.src.charCodeAt(pos) !== 10) return false;
|
|
1829
|
+
const pmax = state.pending.length - 1;
|
|
1830
|
+
const max = state.posMax;
|
|
1831
|
+
if (!silent) {
|
|
1832
|
+
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 32) {
|
|
1833
|
+
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 32) {
|
|
1834
|
+
let ws = pmax - 1;
|
|
1835
|
+
while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32) ws--;
|
|
1836
|
+
state.pending = state.pending.slice(0, ws);
|
|
1837
|
+
state.push("hardbreak", "br", 0);
|
|
1838
|
+
} else {
|
|
1839
|
+
state.pending = state.pending.slice(0, -1);
|
|
1840
|
+
state.push("softbreak", "br", 0);
|
|
1841
|
+
}
|
|
1842
|
+
} else state.push("softbreak", "br", 0);
|
|
1843
|
+
}
|
|
1844
|
+
pos++;
|
|
1845
|
+
while (pos < max && isSpace(state.src.charCodeAt(pos))) pos++;
|
|
1846
|
+
state.pos = pos;
|
|
1847
|
+
return true;
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
// node_modules/markdown-it/lib/rules_inline/escape.mjs
|
|
1851
|
+
const ESCAPED = [];
|
|
1852
|
+
for (let i = 0; i < 256; i++) ESCAPED.push(0);
|
|
1853
|
+
"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(ch) {
|
|
1854
|
+
ESCAPED[ch.charCodeAt(0)] = 1;
|
|
1855
|
+
});
|
|
1856
|
+
function escape(state, silent) {
|
|
1857
|
+
let pos = state.pos;
|
|
1858
|
+
const max = state.posMax;
|
|
1859
|
+
if (state.src.charCodeAt(pos) !== 92) return false;
|
|
1860
|
+
pos++;
|
|
1861
|
+
if (pos >= max) return false;
|
|
1862
|
+
let ch1 = state.src.charCodeAt(pos);
|
|
1863
|
+
if (ch1 === 10) {
|
|
1864
|
+
if (!silent) state.push("hardbreak", "br", 0);
|
|
1865
|
+
pos++;
|
|
1866
|
+
while (pos < max) {
|
|
1867
|
+
ch1 = state.src.charCodeAt(pos);
|
|
1868
|
+
if (!isSpace(ch1)) break;
|
|
1869
|
+
pos++;
|
|
1870
|
+
}
|
|
1871
|
+
state.pos = pos;
|
|
1872
|
+
return true;
|
|
1873
|
+
}
|
|
1874
|
+
let escapedStr = state.src[pos];
|
|
1875
|
+
if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max) {
|
|
1876
|
+
const ch2 = state.src.charCodeAt(pos + 1);
|
|
1877
|
+
if (ch2 >= 56320 && ch2 <= 57343) {
|
|
1878
|
+
escapedStr += state.src[pos + 1];
|
|
1879
|
+
pos++;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
const origStr = "\\" + escapedStr;
|
|
1883
|
+
if (!silent) {
|
|
1884
|
+
const token = state.push("text_special", "", 0);
|
|
1885
|
+
if (ch1 < 256 && ESCAPED[ch1] !== 0) token.content = escapedStr;
|
|
1886
|
+
else token.content = origStr;
|
|
1887
|
+
token.markup = origStr;
|
|
1888
|
+
token.info = "escape";
|
|
1889
|
+
}
|
|
1890
|
+
state.pos = pos + 1;
|
|
1891
|
+
return true;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
// node_modules/markdown-it/lib/rules_inline/backticks.mjs
|
|
1895
|
+
function backtick(state, silent) {
|
|
1896
|
+
let pos = state.pos;
|
|
1897
|
+
if (state.src.charCodeAt(pos) !== 96) return false;
|
|
1898
|
+
const start = pos;
|
|
1899
|
+
pos++;
|
|
1900
|
+
const max = state.posMax;
|
|
1901
|
+
while (pos < max && state.src.charCodeAt(pos) === 96) pos++;
|
|
1902
|
+
const marker = state.src.slice(start, pos);
|
|
1903
|
+
const openerLength = marker.length;
|
|
1904
|
+
if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
|
|
1905
|
+
if (!silent) state.pending += marker;
|
|
1906
|
+
state.pos += openerLength;
|
|
1907
|
+
return true;
|
|
1908
|
+
}
|
|
1909
|
+
let matchEnd = pos;
|
|
1910
|
+
let matchStart;
|
|
1911
|
+
while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
|
|
1912
|
+
matchEnd = matchStart + 1;
|
|
1913
|
+
while (matchEnd < max && state.src.charCodeAt(matchEnd) === 96) matchEnd++;
|
|
1914
|
+
const closerLength = matchEnd - matchStart;
|
|
1915
|
+
if (closerLength === openerLength) {
|
|
1916
|
+
if (!silent) {
|
|
1917
|
+
const token = state.push("code_inline", "code", 0);
|
|
1918
|
+
token.markup = marker;
|
|
1919
|
+
token.content = state.src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
|
|
1920
|
+
}
|
|
1921
|
+
state.pos = matchEnd;
|
|
1922
|
+
return true;
|
|
1923
|
+
}
|
|
1924
|
+
state.backticks[closerLength] = matchStart;
|
|
1925
|
+
}
|
|
1926
|
+
state.backticksScanned = true;
|
|
1927
|
+
if (!silent) state.pending += marker;
|
|
1928
|
+
state.pos += openerLength;
|
|
1929
|
+
return true;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
// node_modules/markdown-it/lib/rules_inline/strikethrough.mjs
|
|
1933
|
+
function strikethrough_tokenize(state, silent) {
|
|
1934
|
+
const start = state.pos;
|
|
1935
|
+
const marker = state.src.charCodeAt(start);
|
|
1936
|
+
if (silent) return false;
|
|
1937
|
+
if (marker !== 126) return false;
|
|
1938
|
+
const scanned = state.scanDelims(state.pos, true);
|
|
1939
|
+
let len = scanned.length;
|
|
1940
|
+
const ch = String.fromCharCode(marker);
|
|
1941
|
+
if (len < 2) return false;
|
|
1942
|
+
let token;
|
|
1943
|
+
if (len % 2) {
|
|
1944
|
+
token = state.push("text", "", 0);
|
|
1945
|
+
token.content = ch;
|
|
1946
|
+
len--;
|
|
1947
|
+
}
|
|
1948
|
+
for (let i = 0; i < len; i += 2) {
|
|
1949
|
+
token = state.push("text", "", 0);
|
|
1950
|
+
token.content = ch + ch;
|
|
1951
|
+
state.delimiters.push({
|
|
1952
|
+
marker,
|
|
1953
|
+
length: 0,
|
|
1954
|
+
token: state.tokens.length - 1,
|
|
1955
|
+
end: -1,
|
|
1956
|
+
open: scanned.can_open,
|
|
1957
|
+
close: scanned.can_close
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
state.pos += scanned.length;
|
|
1961
|
+
return true;
|
|
1962
|
+
}
|
|
1963
|
+
function postProcess$1(state, delimiters) {
|
|
1964
|
+
let token;
|
|
1965
|
+
const loneMarkers = [];
|
|
1966
|
+
const max = delimiters.length;
|
|
1967
|
+
for (let i = 0; i < max; i++) {
|
|
1968
|
+
const startDelim = delimiters[i];
|
|
1969
|
+
if (startDelim.marker !== 126) continue;
|
|
1970
|
+
if (startDelim.end === -1) continue;
|
|
1971
|
+
const endDelim = delimiters[startDelim.end];
|
|
1972
|
+
token = state.tokens[startDelim.token];
|
|
1973
|
+
token.type = "s_open";
|
|
1974
|
+
token.tag = "s";
|
|
1975
|
+
token.nesting = 1;
|
|
1976
|
+
token.markup = "~~";
|
|
1977
|
+
token.content = "";
|
|
1978
|
+
token = state.tokens[endDelim.token];
|
|
1979
|
+
token.type = "s_close";
|
|
1980
|
+
token.tag = "s";
|
|
1981
|
+
token.nesting = -1;
|
|
1982
|
+
token.markup = "~~";
|
|
1983
|
+
token.content = "";
|
|
1984
|
+
if (state.tokens[endDelim.token - 1].type === "text" && state.tokens[endDelim.token - 1].content === "~") loneMarkers.push(endDelim.token - 1);
|
|
1985
|
+
}
|
|
1986
|
+
while (loneMarkers.length) {
|
|
1987
|
+
const i = loneMarkers.pop();
|
|
1988
|
+
let j = i + 1;
|
|
1989
|
+
while (j < state.tokens.length && state.tokens[j].type === "s_close") j++;
|
|
1990
|
+
j--;
|
|
1991
|
+
if (i !== j) {
|
|
1992
|
+
token = state.tokens[j];
|
|
1993
|
+
state.tokens[j] = state.tokens[i];
|
|
1994
|
+
state.tokens[i] = token;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
function strikethrough_postProcess(state) {
|
|
1999
|
+
const tokens_meta = state.tokens_meta;
|
|
2000
|
+
const max = state.tokens_meta.length;
|
|
2001
|
+
postProcess$1(state, state.delimiters);
|
|
2002
|
+
for (let curr = 0; curr < max; curr++) if (tokens_meta[curr] && tokens_meta[curr].delimiters) postProcess$1(state, tokens_meta[curr].delimiters);
|
|
2003
|
+
}
|
|
2004
|
+
var strikethrough_default = {
|
|
2005
|
+
tokenize: strikethrough_tokenize,
|
|
2006
|
+
postProcess: strikethrough_postProcess
|
|
2007
|
+
};
|
|
2008
|
+
|
|
2009
|
+
// node_modules/markdown-it/lib/rules_inline/emphasis.mjs
|
|
2010
|
+
function emphasis_tokenize(state, silent) {
|
|
2011
|
+
const start = state.pos;
|
|
2012
|
+
const marker = state.src.charCodeAt(start);
|
|
2013
|
+
if (silent) return false;
|
|
2014
|
+
if (marker !== 95 && marker !== 42) return false;
|
|
2015
|
+
const scanned = state.scanDelims(state.pos, marker === 42);
|
|
2016
|
+
for (let i = 0; i < scanned.length; i++) {
|
|
2017
|
+
const token = state.push("text", "", 0);
|
|
2018
|
+
token.content = String.fromCharCode(marker);
|
|
2019
|
+
state.delimiters.push({
|
|
2020
|
+
marker,
|
|
2021
|
+
length: scanned.length,
|
|
2022
|
+
token: state.tokens.length - 1,
|
|
2023
|
+
end: -1,
|
|
2024
|
+
open: scanned.can_open,
|
|
2025
|
+
close: scanned.can_close
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
state.pos += scanned.length;
|
|
2029
|
+
return true;
|
|
2030
|
+
}
|
|
2031
|
+
function postProcess(state, delimiters) {
|
|
2032
|
+
const max = delimiters.length;
|
|
2033
|
+
for (let i = max - 1; i >= 0; i--) {
|
|
2034
|
+
const startDelim = delimiters[i];
|
|
2035
|
+
if (startDelim.marker !== 95 && startDelim.marker !== 42) continue;
|
|
2036
|
+
if (startDelim.end === -1) continue;
|
|
2037
|
+
const endDelim = delimiters[startDelim.end];
|
|
2038
|
+
const isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 && delimiters[i - 1].marker === startDelim.marker && delimiters[i - 1].token === startDelim.token - 1 && delimiters[startDelim.end + 1].token === endDelim.token + 1;
|
|
2039
|
+
const ch = String.fromCharCode(startDelim.marker);
|
|
2040
|
+
const token_o = state.tokens[startDelim.token];
|
|
2041
|
+
token_o.type = isStrong ? "strong_open" : "em_open";
|
|
2042
|
+
token_o.tag = isStrong ? "strong" : "em";
|
|
2043
|
+
token_o.nesting = 1;
|
|
2044
|
+
token_o.markup = isStrong ? ch + ch : ch;
|
|
2045
|
+
token_o.content = "";
|
|
2046
|
+
const token_c = state.tokens[endDelim.token];
|
|
2047
|
+
token_c.type = isStrong ? "strong_close" : "em_close";
|
|
2048
|
+
token_c.tag = isStrong ? "strong" : "em";
|
|
2049
|
+
token_c.nesting = -1;
|
|
2050
|
+
token_c.markup = isStrong ? ch + ch : ch;
|
|
2051
|
+
token_c.content = "";
|
|
2052
|
+
if (isStrong) {
|
|
2053
|
+
state.tokens[delimiters[i - 1].token].content = "";
|
|
2054
|
+
state.tokens[delimiters[startDelim.end + 1].token].content = "";
|
|
2055
|
+
i--;
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
function emphasis_post_process(state) {
|
|
2060
|
+
const tokens_meta = state.tokens_meta;
|
|
2061
|
+
const max = state.tokens_meta.length;
|
|
2062
|
+
postProcess(state, state.delimiters);
|
|
2063
|
+
for (let curr = 0; curr < max; curr++) if (tokens_meta[curr] && tokens_meta[curr].delimiters) postProcess(state, tokens_meta[curr].delimiters);
|
|
2064
|
+
}
|
|
2065
|
+
var emphasis_default = {
|
|
2066
|
+
tokenize: emphasis_tokenize,
|
|
2067
|
+
postProcess: emphasis_post_process
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
// node_modules/markdown-it/lib/rules_inline/link.mjs
|
|
2071
|
+
function link(state, silent) {
|
|
2072
|
+
let code, label, res, ref;
|
|
2073
|
+
let href = "";
|
|
2074
|
+
let title = "";
|
|
2075
|
+
let start = state.pos;
|
|
2076
|
+
let parseReference = true;
|
|
2077
|
+
if (state.src.charCodeAt(state.pos) !== 91) return false;
|
|
2078
|
+
const oldPos = state.pos;
|
|
2079
|
+
const max = state.posMax;
|
|
2080
|
+
const labelStart = state.pos + 1;
|
|
2081
|
+
const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
|
|
2082
|
+
if (labelEnd < 0) return false;
|
|
2083
|
+
let pos = labelEnd + 1;
|
|
2084
|
+
if (pos < max && state.src.charCodeAt(pos) === 40) {
|
|
2085
|
+
parseReference = false;
|
|
2086
|
+
pos++;
|
|
2087
|
+
for (; pos < max; pos++) {
|
|
2088
|
+
code = state.src.charCodeAt(pos);
|
|
2089
|
+
if (!isSpace(code) && code !== 10) break;
|
|
2090
|
+
}
|
|
2091
|
+
if (pos >= max) return false;
|
|
2092
|
+
start = pos;
|
|
2093
|
+
res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
|
|
2094
|
+
if (res.ok) {
|
|
2095
|
+
href = state.md.normalizeLink(res.str);
|
|
2096
|
+
if (state.md.validateLink(href)) pos = res.pos;
|
|
2097
|
+
else href = "";
|
|
2098
|
+
start = pos;
|
|
2099
|
+
for (; pos < max; pos++) {
|
|
2100
|
+
code = state.src.charCodeAt(pos);
|
|
2101
|
+
if (!isSpace(code) && code !== 10) break;
|
|
2102
|
+
}
|
|
2103
|
+
res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
|
|
2104
|
+
if (pos < max && start !== pos && res.ok) {
|
|
2105
|
+
title = res.str;
|
|
2106
|
+
pos = res.pos;
|
|
2107
|
+
for (; pos < max; pos++) {
|
|
2108
|
+
code = state.src.charCodeAt(pos);
|
|
2109
|
+
if (!isSpace(code) && code !== 10) break;
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
if (pos >= max || state.src.charCodeAt(pos) !== 41) parseReference = true;
|
|
2114
|
+
pos++;
|
|
2115
|
+
}
|
|
2116
|
+
if (parseReference) {
|
|
2117
|
+
if (typeof state.env.references === "undefined") return false;
|
|
2118
|
+
if (pos < max && state.src.charCodeAt(pos) === 91) {
|
|
2119
|
+
start = pos + 1;
|
|
2120
|
+
pos = state.md.helpers.parseLinkLabel(state, pos);
|
|
2121
|
+
if (pos >= 0) label = state.src.slice(start, pos++);
|
|
2122
|
+
else pos = labelEnd + 1;
|
|
2123
|
+
} else pos = labelEnd + 1;
|
|
2124
|
+
if (!label) label = state.src.slice(labelStart, labelEnd);
|
|
2125
|
+
ref = state.env.references[normalizeReference(label)];
|
|
2126
|
+
if (!ref) {
|
|
2127
|
+
state.pos = oldPos;
|
|
2128
|
+
return false;
|
|
2129
|
+
}
|
|
2130
|
+
href = ref.href;
|
|
2131
|
+
title = ref.title;
|
|
2132
|
+
}
|
|
2133
|
+
if (!silent) {
|
|
2134
|
+
state.pos = labelStart;
|
|
2135
|
+
state.posMax = labelEnd;
|
|
2136
|
+
const token_o = state.push("link_open", "a", 1);
|
|
2137
|
+
const attrs = [["href", href]];
|
|
2138
|
+
token_o.attrs = attrs;
|
|
2139
|
+
if (title) attrs.push(["title", title]);
|
|
2140
|
+
state.linkLevel++;
|
|
2141
|
+
state.md.inline.tokenize(state);
|
|
2142
|
+
state.linkLevel--;
|
|
2143
|
+
state.push("link_close", "a", -1);
|
|
2144
|
+
}
|
|
2145
|
+
state.pos = pos;
|
|
2146
|
+
state.posMax = max;
|
|
2147
|
+
return true;
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
// node_modules/markdown-it/lib/rules_inline/image.mjs
|
|
2151
|
+
function image(state, silent) {
|
|
2152
|
+
let code, content, label, pos, ref, res, title, start;
|
|
2153
|
+
let href = "";
|
|
2154
|
+
const oldPos = state.pos;
|
|
2155
|
+
const max = state.posMax;
|
|
2156
|
+
if (state.src.charCodeAt(state.pos) !== 33) return false;
|
|
2157
|
+
if (state.src.charCodeAt(state.pos + 1) !== 91) return false;
|
|
2158
|
+
const labelStart = state.pos + 2;
|
|
2159
|
+
const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
|
|
2160
|
+
if (labelEnd < 0) return false;
|
|
2161
|
+
pos = labelEnd + 1;
|
|
2162
|
+
if (pos < max && state.src.charCodeAt(pos) === 40) {
|
|
2163
|
+
pos++;
|
|
2164
|
+
for (; pos < max; pos++) {
|
|
2165
|
+
code = state.src.charCodeAt(pos);
|
|
2166
|
+
if (!isSpace(code) && code !== 10) break;
|
|
2167
|
+
}
|
|
2168
|
+
if (pos >= max) return false;
|
|
2169
|
+
start = pos;
|
|
2170
|
+
res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
|
|
2171
|
+
if (res.ok) {
|
|
2172
|
+
href = state.md.normalizeLink(res.str);
|
|
2173
|
+
if (state.md.validateLink(href)) pos = res.pos;
|
|
2174
|
+
else href = "";
|
|
2175
|
+
}
|
|
2176
|
+
start = pos;
|
|
2177
|
+
for (; pos < max; pos++) {
|
|
2178
|
+
code = state.src.charCodeAt(pos);
|
|
2179
|
+
if (!isSpace(code) && code !== 10) break;
|
|
2180
|
+
}
|
|
2181
|
+
res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
|
|
2182
|
+
if (pos < max && start !== pos && res.ok) {
|
|
2183
|
+
title = res.str;
|
|
2184
|
+
pos = res.pos;
|
|
2185
|
+
for (; pos < max; pos++) {
|
|
2186
|
+
code = state.src.charCodeAt(pos);
|
|
2187
|
+
if (!isSpace(code) && code !== 10) break;
|
|
2188
|
+
}
|
|
2189
|
+
} else title = "";
|
|
2190
|
+
if (pos >= max || state.src.charCodeAt(pos) !== 41) {
|
|
2191
|
+
state.pos = oldPos;
|
|
2192
|
+
return false;
|
|
2193
|
+
}
|
|
2194
|
+
pos++;
|
|
2195
|
+
} else {
|
|
2196
|
+
if (typeof state.env.references === "undefined") return false;
|
|
2197
|
+
if (pos < max && state.src.charCodeAt(pos) === 91) {
|
|
2198
|
+
start = pos + 1;
|
|
2199
|
+
pos = state.md.helpers.parseLinkLabel(state, pos);
|
|
2200
|
+
if (pos >= 0) label = state.src.slice(start, pos++);
|
|
2201
|
+
else pos = labelEnd + 1;
|
|
2202
|
+
} else pos = labelEnd + 1;
|
|
2203
|
+
if (!label) label = state.src.slice(labelStart, labelEnd);
|
|
2204
|
+
ref = state.env.references[normalizeReference(label)];
|
|
2205
|
+
if (!ref) {
|
|
2206
|
+
state.pos = oldPos;
|
|
2207
|
+
return false;
|
|
2208
|
+
}
|
|
2209
|
+
href = ref.href;
|
|
2210
|
+
title = ref.title;
|
|
2211
|
+
}
|
|
2212
|
+
if (!silent) {
|
|
2213
|
+
content = state.src.slice(labelStart, labelEnd);
|
|
2214
|
+
const tokens = [];
|
|
2215
|
+
state.md.inline.parse(content, state.md, state.env, tokens);
|
|
2216
|
+
const token = state.push("image", "img", 0);
|
|
2217
|
+
const attrs = [["src", href], ["alt", ""]];
|
|
2218
|
+
token.attrs = attrs;
|
|
2219
|
+
token.children = tokens;
|
|
2220
|
+
token.content = content;
|
|
2221
|
+
if (title) attrs.push(["title", title]);
|
|
2222
|
+
}
|
|
2223
|
+
state.pos = pos;
|
|
2224
|
+
state.posMax = max;
|
|
2225
|
+
return true;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
// node_modules/markdown-it/lib/rules_inline/autolink.mjs
|
|
2229
|
+
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])?)*)$/;
|
|
2230
|
+
const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
|
|
2231
|
+
function autolink$1(state, silent) {
|
|
2232
|
+
let pos = state.pos;
|
|
2233
|
+
if (state.src.charCodeAt(pos) !== 60) return false;
|
|
2234
|
+
const start = state.pos;
|
|
2235
|
+
const max = state.posMax;
|
|
2236
|
+
for (;;) {
|
|
2237
|
+
if (++pos >= max) return false;
|
|
2238
|
+
const ch = state.src.charCodeAt(pos);
|
|
2239
|
+
if (ch === 60) return false;
|
|
2240
|
+
if (ch === 62) break;
|
|
2241
|
+
}
|
|
2242
|
+
const url = state.src.slice(start + 1, pos);
|
|
2243
|
+
if (AUTOLINK_RE.test(url)) {
|
|
2244
|
+
const fullUrl = state.md.normalizeLink(url);
|
|
2245
|
+
if (!state.md.validateLink(fullUrl)) return false;
|
|
2246
|
+
if (!silent) {
|
|
2247
|
+
const token_o = state.push("link_open", "a", 1);
|
|
2248
|
+
token_o.attrs = [["href", fullUrl]];
|
|
2249
|
+
token_o.markup = "autolink";
|
|
2250
|
+
token_o.info = "auto";
|
|
2251
|
+
const token_t = state.push("text", "", 0);
|
|
2252
|
+
token_t.content = state.md.normalizeLinkText(url);
|
|
2253
|
+
const token_c = state.push("link_close", "a", -1);
|
|
2254
|
+
token_c.markup = "autolink";
|
|
2255
|
+
token_c.info = "auto";
|
|
2256
|
+
}
|
|
2257
|
+
state.pos += url.length + 2;
|
|
2258
|
+
return true;
|
|
2259
|
+
}
|
|
2260
|
+
if (EMAIL_RE.test(url)) {
|
|
2261
|
+
const fullUrl = state.md.normalizeLink("mailto:" + url);
|
|
2262
|
+
if (!state.md.validateLink(fullUrl)) return false;
|
|
2263
|
+
if (!silent) {
|
|
2264
|
+
const token_o = state.push("link_open", "a", 1);
|
|
2265
|
+
token_o.attrs = [["href", fullUrl]];
|
|
2266
|
+
token_o.markup = "autolink";
|
|
2267
|
+
token_o.info = "auto";
|
|
2268
|
+
const token_t = state.push("text", "", 0);
|
|
2269
|
+
token_t.content = state.md.normalizeLinkText(url);
|
|
2270
|
+
const token_c = state.push("link_close", "a", -1);
|
|
2271
|
+
token_c.markup = "autolink";
|
|
2272
|
+
token_c.info = "auto";
|
|
2273
|
+
}
|
|
2274
|
+
state.pos += url.length + 2;
|
|
2275
|
+
return true;
|
|
2276
|
+
}
|
|
2277
|
+
return false;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
// node_modules/markdown-it/lib/rules_inline/html_inline.mjs
|
|
2281
|
+
function isLinkOpen(str) {
|
|
2282
|
+
return /^<a[>\s]/i.test(str);
|
|
2283
|
+
}
|
|
2284
|
+
function isLinkClose(str) {
|
|
2285
|
+
return /^<\/a\s*>/i.test(str);
|
|
2286
|
+
}
|
|
2287
|
+
function isLetter(ch) {
|
|
2288
|
+
const lc = ch | 32;
|
|
2289
|
+
return lc >= 97 && lc <= 122;
|
|
2290
|
+
}
|
|
2291
|
+
function html_inline(state, silent) {
|
|
2292
|
+
if (!state.md.options.html) return false;
|
|
2293
|
+
const max = state.posMax;
|
|
2294
|
+
const pos = state.pos;
|
|
2295
|
+
if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
|
|
2296
|
+
const ch = state.src.charCodeAt(pos + 1);
|
|
2297
|
+
if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter(ch)) return false;
|
|
2298
|
+
const match = state.src.slice(pos).match(HTML_TAG_RE);
|
|
2299
|
+
if (!match) return false;
|
|
2300
|
+
if (!silent) {
|
|
2301
|
+
const token = state.push("html_inline", "", 0);
|
|
2302
|
+
token.content = match[0];
|
|
2303
|
+
if (isLinkOpen(token.content)) state.linkLevel++;
|
|
2304
|
+
if (isLinkClose(token.content)) state.linkLevel--;
|
|
2305
|
+
}
|
|
2306
|
+
state.pos += match[0].length;
|
|
2307
|
+
return true;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
// node_modules/markdown-it/lib/rules_inline/entity.mjs
|
|
2311
|
+
const DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
|
|
2312
|
+
const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
|
|
2313
|
+
function entity(state, silent) {
|
|
2314
|
+
const pos = state.pos;
|
|
2315
|
+
const max = state.posMax;
|
|
2316
|
+
if (state.src.charCodeAt(pos) !== 38) return false;
|
|
2317
|
+
if (pos + 1 >= max) return false;
|
|
2318
|
+
if (state.src.charCodeAt(pos + 1) === 35) {
|
|
2319
|
+
const match = state.src.slice(pos).match(DIGITAL_RE);
|
|
2320
|
+
if (match) {
|
|
2321
|
+
if (!silent) {
|
|
2322
|
+
const code = match[1][0].toLowerCase() === "x" ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
|
|
2323
|
+
const token = state.push("text_special", "", 0);
|
|
2324
|
+
token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(65533);
|
|
2325
|
+
token.markup = match[0];
|
|
2326
|
+
token.info = "entity";
|
|
2327
|
+
}
|
|
2328
|
+
state.pos += match[0].length;
|
|
2329
|
+
return true;
|
|
2330
|
+
}
|
|
2331
|
+
} else {
|
|
2332
|
+
const match = state.src.slice(pos).match(NAMED_RE);
|
|
2333
|
+
if (match) {
|
|
2334
|
+
const decoded = decodeHTML(match[0]);
|
|
2335
|
+
if (decoded !== match[0]) {
|
|
2336
|
+
if (!silent) {
|
|
2337
|
+
const token = state.push("text_special", "", 0);
|
|
2338
|
+
token.content = decoded;
|
|
2339
|
+
token.markup = match[0];
|
|
2340
|
+
token.info = "entity";
|
|
2341
|
+
}
|
|
2342
|
+
state.pos += match[0].length;
|
|
2343
|
+
return true;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
return false;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
// node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs
|
|
2351
|
+
function processDelimiters(delimiters) {
|
|
2352
|
+
const openersBottom = {};
|
|
2353
|
+
const max = delimiters.length;
|
|
2354
|
+
if (!max) return;
|
|
2355
|
+
let headerIdx = 0;
|
|
2356
|
+
let lastTokenIdx = -2;
|
|
2357
|
+
const jumps = [];
|
|
2358
|
+
for (let closerIdx = 0; closerIdx < max; closerIdx++) {
|
|
2359
|
+
const closer = delimiters[closerIdx];
|
|
2360
|
+
jumps.push(0);
|
|
2361
|
+
if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) headerIdx = closerIdx;
|
|
2362
|
+
lastTokenIdx = closer.token;
|
|
2363
|
+
closer.length = closer.length || 0;
|
|
2364
|
+
if (!closer.close) continue;
|
|
2365
|
+
if (!openersBottom.hasOwnProperty(closer.marker)) openersBottom[closer.marker] = [
|
|
2366
|
+
-1,
|
|
2367
|
+
-1,
|
|
2368
|
+
-1,
|
|
2369
|
+
-1,
|
|
2370
|
+
-1,
|
|
2371
|
+
-1
|
|
2372
|
+
];
|
|
2373
|
+
const minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + closer.length % 3];
|
|
2374
|
+
let openerIdx = headerIdx - jumps[headerIdx] - 1;
|
|
2375
|
+
let newMinOpenerIdx = openerIdx;
|
|
2376
|
+
for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
|
|
2377
|
+
const opener = delimiters[openerIdx];
|
|
2378
|
+
if (opener.marker !== closer.marker) continue;
|
|
2379
|
+
if (opener.open && opener.end < 0) {
|
|
2380
|
+
let isOddMatch = false;
|
|
2381
|
+
if (opener.close || closer.open) {
|
|
2382
|
+
if ((opener.length + closer.length) % 3 === 0) {
|
|
2383
|
+
if (opener.length % 3 !== 0 || closer.length % 3 !== 0) isOddMatch = true;
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
if (!isOddMatch) {
|
|
2387
|
+
const lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ? jumps[openerIdx - 1] + 1 : 0;
|
|
2388
|
+
jumps[closerIdx] = closerIdx - openerIdx + lastJump;
|
|
2389
|
+
jumps[openerIdx] = lastJump;
|
|
2390
|
+
closer.open = false;
|
|
2391
|
+
opener.end = closerIdx;
|
|
2392
|
+
opener.close = false;
|
|
2393
|
+
newMinOpenerIdx = -1;
|
|
2394
|
+
lastTokenIdx = -2;
|
|
2395
|
+
break;
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
if (newMinOpenerIdx !== -1) openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length || 0) % 3] = newMinOpenerIdx;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
function link_pairs(state) {
|
|
2403
|
+
const tokens_meta = state.tokens_meta;
|
|
2404
|
+
const max = state.tokens_meta.length;
|
|
2405
|
+
processDelimiters(state.delimiters);
|
|
2406
|
+
for (let curr = 0; curr < max; curr++) if (tokens_meta[curr] && tokens_meta[curr].delimiters) processDelimiters(tokens_meta[curr].delimiters);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
// node_modules/markdown-it/lib/rules_inline/fragments_join.mjs
|
|
2410
|
+
function fragments_join(state) {
|
|
2411
|
+
let curr, last;
|
|
2412
|
+
let level = 0;
|
|
2413
|
+
const tokens = state.tokens;
|
|
2414
|
+
const max = state.tokens.length;
|
|
2415
|
+
for (curr = last = 0; curr < max; curr++) {
|
|
2416
|
+
if (tokens[curr].nesting < 0) level--;
|
|
2417
|
+
tokens[curr].level = level;
|
|
2418
|
+
if (tokens[curr].nesting > 0) level++;
|
|
2419
|
+
if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
|
|
2420
|
+
else {
|
|
2421
|
+
if (curr !== last) tokens[last] = tokens[curr];
|
|
2422
|
+
last++;
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
if (curr !== last) tokens.length = last;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
// node_modules/markdown-it/lib/parser_inline.mjs
|
|
2429
|
+
const _rules = [
|
|
2430
|
+
["text", text],
|
|
2431
|
+
["linkify", unused],
|
|
2432
|
+
["newline", newline],
|
|
2433
|
+
["escape", escape],
|
|
2434
|
+
["backticks", backtick],
|
|
2435
|
+
["strikethrough", strikethrough_default.tokenize],
|
|
2436
|
+
["emphasis", emphasis_default.tokenize],
|
|
2437
|
+
["link", link],
|
|
2438
|
+
["image", image],
|
|
2439
|
+
["autolink", autolink$1],
|
|
2440
|
+
["html_inline", html_inline],
|
|
2441
|
+
["entity", entity]
|
|
2442
|
+
];
|
|
2443
|
+
const _rules2 = [
|
|
2444
|
+
["balance_pairs", link_pairs],
|
|
2445
|
+
["strikethrough", strikethrough_default.postProcess],
|
|
2446
|
+
["emphasis", emphasis_default.postProcess],
|
|
2447
|
+
["fragments_join", fragments_join]
|
|
2448
|
+
];
|
|
2449
|
+
function ParserInline() {
|
|
2450
|
+
this.ruler = new Ruler();
|
|
2451
|
+
for (let i = 0; i < _rules.length; i++) this.ruler.push(_rules[i][0], _rules[i][1]);
|
|
2452
|
+
this.ruler2 = new Ruler();
|
|
2453
|
+
for (let i = 0; i < _rules2.length; i++) this.ruler2.push(_rules2[i][0], _rules2[i][1]);
|
|
2454
|
+
}
|
|
2455
|
+
ParserInline.prototype.skipToken = function(state) {
|
|
2456
|
+
const pos = state.pos;
|
|
2457
|
+
const rules = this.ruler.getRules("");
|
|
2458
|
+
const len = rules.length;
|
|
2459
|
+
const maxNesting = state.md.options.maxNesting;
|
|
2460
|
+
const cache = state.cache;
|
|
2461
|
+
if (typeof cache[pos] !== "undefined") {
|
|
2462
|
+
state.pos = cache[pos];
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
let ok = false;
|
|
2466
|
+
if (state.level < maxNesting) for (let i = 0; i < len; i++) {
|
|
2467
|
+
state.level++;
|
|
2468
|
+
ok = rules[i](state, true);
|
|
2469
|
+
state.level--;
|
|
2470
|
+
if (ok) {
|
|
2471
|
+
if (pos >= state.pos) throw new Error("inline rule didn't increment state.pos");
|
|
2472
|
+
break;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
else state.pos = state.posMax;
|
|
2476
|
+
if (!ok) state.pos++;
|
|
2477
|
+
cache[pos] = state.pos;
|
|
2478
|
+
};
|
|
2479
|
+
ParserInline.prototype.tokenize = function(state) {
|
|
2480
|
+
const rules = this.ruler.getRules("");
|
|
2481
|
+
const len = rules.length;
|
|
2482
|
+
const end = state.posMax;
|
|
2483
|
+
const maxNesting = state.md.options.maxNesting;
|
|
2484
|
+
while (state.pos < end) {
|
|
2485
|
+
const prevPos = state.pos;
|
|
2486
|
+
let ok = false;
|
|
2487
|
+
if (state.level < maxNesting) for (let i = 0; i < len; i++) {
|
|
2488
|
+
ok = rules[i](state, false);
|
|
2489
|
+
if (ok) {
|
|
2490
|
+
if (prevPos >= state.pos) throw new Error("inline rule didn't increment state.pos");
|
|
2491
|
+
break;
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
if (ok) {
|
|
2495
|
+
if (state.pos >= end) break;
|
|
2496
|
+
continue;
|
|
2497
|
+
}
|
|
2498
|
+
state.pending += state.src[state.pos++];
|
|
2499
|
+
}
|
|
2500
|
+
if (state.pending) state.pushPending();
|
|
2501
|
+
};
|
|
2502
|
+
ParserInline.prototype.parse = function(str, md, env, outTokens) {
|
|
2503
|
+
const state = new this.State(str, md, env, outTokens);
|
|
2504
|
+
this.tokenize(state);
|
|
2505
|
+
const rules = this.ruler2.getRules("");
|
|
2506
|
+
const len = rules.length;
|
|
2507
|
+
for (let i = 0; i < len; i++) rules[i](state);
|
|
2508
|
+
};
|
|
2509
|
+
ParserInline.prototype.State = StateInline;
|
|
2510
|
+
|
|
2511
|
+
// scripts/punycode.js
|
|
2512
|
+
var punycode_default = {
|
|
2513
|
+
toASCII: (s) => s,
|
|
2514
|
+
toUnicode: (s) => s
|
|
2515
|
+
};
|
|
2516
|
+
|
|
2517
|
+
// node_modules/markdown-it/lib/presets/default.mjs
|
|
2518
|
+
var default_default = {
|
|
2519
|
+
options: {
|
|
2520
|
+
html: false,
|
|
2521
|
+
xhtmlOut: false,
|
|
2522
|
+
breaks: false,
|
|
2523
|
+
langPrefix: "language-",
|
|
2524
|
+
linkify: false,
|
|
2525
|
+
typographer: false,
|
|
2526
|
+
quotes: "“”‘’",
|
|
2527
|
+
highlight: null,
|
|
2528
|
+
maxNesting: 100
|
|
2529
|
+
},
|
|
2530
|
+
components: {
|
|
2531
|
+
core: {},
|
|
2532
|
+
block: {},
|
|
2533
|
+
inline: {}
|
|
2534
|
+
}
|
|
2535
|
+
};
|
|
2536
|
+
|
|
2537
|
+
// node_modules/markdown-it/lib/presets/zero.mjs
|
|
2538
|
+
var zero_default = {
|
|
2539
|
+
options: {
|
|
2540
|
+
html: false,
|
|
2541
|
+
xhtmlOut: false,
|
|
2542
|
+
breaks: false,
|
|
2543
|
+
langPrefix: "language-",
|
|
2544
|
+
linkify: false,
|
|
2545
|
+
typographer: false,
|
|
2546
|
+
quotes: "“”‘’",
|
|
2547
|
+
highlight: null,
|
|
2548
|
+
maxNesting: 20
|
|
2549
|
+
},
|
|
2550
|
+
components: {
|
|
2551
|
+
core: { rules: [
|
|
2552
|
+
"normalize",
|
|
2553
|
+
"block",
|
|
2554
|
+
"inline",
|
|
2555
|
+
"text_join"
|
|
2556
|
+
] },
|
|
2557
|
+
block: { rules: ["paragraph"] },
|
|
2558
|
+
inline: {
|
|
2559
|
+
rules: ["text"],
|
|
2560
|
+
rules2: ["balance_pairs", "fragments_join"]
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2565
|
+
// node_modules/markdown-it/lib/presets/commonmark.mjs
|
|
2566
|
+
var commonmark_default = {
|
|
2567
|
+
options: {
|
|
2568
|
+
html: true,
|
|
2569
|
+
xhtmlOut: true,
|
|
2570
|
+
breaks: false,
|
|
2571
|
+
langPrefix: "language-",
|
|
2572
|
+
linkify: false,
|
|
2573
|
+
typographer: false,
|
|
2574
|
+
quotes: "“”‘’",
|
|
2575
|
+
highlight: null,
|
|
2576
|
+
maxNesting: 20
|
|
2577
|
+
},
|
|
2578
|
+
components: {
|
|
2579
|
+
core: { rules: [
|
|
2580
|
+
"normalize",
|
|
2581
|
+
"block",
|
|
2582
|
+
"inline",
|
|
2583
|
+
"text_join"
|
|
2584
|
+
] },
|
|
2585
|
+
block: { rules: [
|
|
2586
|
+
"blockquote",
|
|
2587
|
+
"code",
|
|
2588
|
+
"fence",
|
|
2589
|
+
"heading",
|
|
2590
|
+
"hr",
|
|
2591
|
+
"html_block",
|
|
2592
|
+
"lheading",
|
|
2593
|
+
"list",
|
|
2594
|
+
"reference",
|
|
2595
|
+
"paragraph"
|
|
2596
|
+
] },
|
|
2597
|
+
inline: {
|
|
2598
|
+
rules: [
|
|
2599
|
+
"autolink",
|
|
2600
|
+
"backticks",
|
|
2601
|
+
"emphasis",
|
|
2602
|
+
"entity",
|
|
2603
|
+
"escape",
|
|
2604
|
+
"html_inline",
|
|
2605
|
+
"image",
|
|
2606
|
+
"link",
|
|
2607
|
+
"newline",
|
|
2608
|
+
"text"
|
|
2609
|
+
],
|
|
2610
|
+
rules2: [
|
|
2611
|
+
"balance_pairs",
|
|
2612
|
+
"emphasis",
|
|
2613
|
+
"fragments_join"
|
|
2614
|
+
]
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
};
|
|
2618
|
+
|
|
2619
|
+
// node_modules/markdown-it/lib/index.mjs
|
|
2620
|
+
const config = {
|
|
2621
|
+
default: default_default,
|
|
2622
|
+
zero: zero_default,
|
|
2623
|
+
commonmark: commonmark_default
|
|
2624
|
+
};
|
|
2625
|
+
const BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
|
|
2626
|
+
const GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
|
|
2627
|
+
function validateLink(url) {
|
|
2628
|
+
const str = url.trim().toLowerCase();
|
|
2629
|
+
return BAD_PROTO_RE.test(str) ? GOOD_DATA_RE.test(str) : true;
|
|
2630
|
+
}
|
|
2631
|
+
const RECODE_HOSTNAME_FOR = [
|
|
2632
|
+
"http:",
|
|
2633
|
+
"https:",
|
|
2634
|
+
"mailto:"
|
|
2635
|
+
];
|
|
2636
|
+
function normalizeLink(url) {
|
|
2637
|
+
const parsed = parse(url, true);
|
|
2638
|
+
if (parsed.hostname) {
|
|
2639
|
+
if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) try {
|
|
2640
|
+
parsed.hostname = punycode_default.toASCII(parsed.hostname);
|
|
2641
|
+
} catch (er) {}
|
|
2642
|
+
}
|
|
2643
|
+
return encode(format(parsed));
|
|
2644
|
+
}
|
|
2645
|
+
function normalizeLinkText(url) {
|
|
2646
|
+
const parsed = parse(url, true);
|
|
2647
|
+
if (parsed.hostname) {
|
|
2648
|
+
if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) try {
|
|
2649
|
+
parsed.hostname = punycode_default.toUnicode(parsed.hostname);
|
|
2650
|
+
} catch (er) {}
|
|
2651
|
+
}
|
|
2652
|
+
return decode(format(parsed), decode.defaultChars + "%");
|
|
2653
|
+
}
|
|
2654
|
+
function MarkdownIt(presetName, options) {
|
|
2655
|
+
if (!(this instanceof MarkdownIt)) return new MarkdownIt(presetName, options);
|
|
2656
|
+
if (!options) {
|
|
2657
|
+
if (!isString(presetName)) {
|
|
2658
|
+
options = presetName || {};
|
|
2659
|
+
presetName = "default";
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
this.inline = new ParserInline();
|
|
2663
|
+
this.block = new ParserBlock();
|
|
2664
|
+
this.core = new Core();
|
|
2665
|
+
this.renderer = new unused();
|
|
2666
|
+
this.linkify = new unused();
|
|
2667
|
+
this.validateLink = validateLink;
|
|
2668
|
+
this.normalizeLink = normalizeLink;
|
|
2669
|
+
this.normalizeLinkText = normalizeLinkText;
|
|
2670
|
+
this.utils = utils_exports;
|
|
2671
|
+
this.helpers = assign({}, helpers_exports);
|
|
2672
|
+
this.options = {};
|
|
2673
|
+
this.configure(presetName);
|
|
2674
|
+
if (options) this.set(options);
|
|
2675
|
+
}
|
|
2676
|
+
MarkdownIt.prototype.set = function(options) {
|
|
2677
|
+
assign(this.options, options);
|
|
2678
|
+
return this;
|
|
2679
|
+
};
|
|
2680
|
+
MarkdownIt.prototype.configure = function(presets) {
|
|
2681
|
+
const self = this;
|
|
2682
|
+
if (isString(presets)) {
|
|
2683
|
+
const presetName = presets;
|
|
2684
|
+
presets = config[presetName];
|
|
2685
|
+
if (!presets) throw new Error("Wrong `markdown-it` preset \"" + presetName + "\", check name");
|
|
2686
|
+
}
|
|
2687
|
+
if (!presets) throw new Error("Wrong `markdown-it` preset, can't be empty");
|
|
2688
|
+
if (presets.options) self.set(presets.options);
|
|
2689
|
+
if (presets.components) Object.keys(presets.components).forEach(function(name) {
|
|
2690
|
+
if (presets.components[name].rules) self[name].ruler.enableOnly(presets.components[name].rules);
|
|
2691
|
+
if (presets.components[name].rules2) self[name].ruler2.enableOnly(presets.components[name].rules2);
|
|
2692
|
+
});
|
|
2693
|
+
return this;
|
|
2694
|
+
};
|
|
2695
|
+
MarkdownIt.prototype.enable = function(list, ignoreInvalid) {
|
|
2696
|
+
let result = [];
|
|
2697
|
+
if (!Array.isArray(list)) list = [list];
|
|
2698
|
+
[
|
|
2699
|
+
"core",
|
|
2700
|
+
"block",
|
|
2701
|
+
"inline"
|
|
2702
|
+
].forEach(function(chain) {
|
|
2703
|
+
result = result.concat(this[chain].ruler.enable(list, true));
|
|
2704
|
+
}, this);
|
|
2705
|
+
result = result.concat(this.inline.ruler2.enable(list, true));
|
|
2706
|
+
const missed = list.filter(function(name) {
|
|
2707
|
+
return result.indexOf(name) < 0;
|
|
2708
|
+
});
|
|
2709
|
+
if (missed.length && !ignoreInvalid) throw new Error("MarkdownIt. Failed to enable unknown rule(s): " + missed);
|
|
2710
|
+
return this;
|
|
2711
|
+
};
|
|
2712
|
+
MarkdownIt.prototype.disable = function(list, ignoreInvalid) {
|
|
2713
|
+
let result = [];
|
|
2714
|
+
if (!Array.isArray(list)) list = [list];
|
|
2715
|
+
[
|
|
2716
|
+
"core",
|
|
2717
|
+
"block",
|
|
2718
|
+
"inline"
|
|
2719
|
+
].forEach(function(chain) {
|
|
2720
|
+
result = result.concat(this[chain].ruler.disable(list, true));
|
|
2721
|
+
}, this);
|
|
2722
|
+
result = result.concat(this.inline.ruler2.disable(list, true));
|
|
2723
|
+
const missed = list.filter(function(name) {
|
|
2724
|
+
return result.indexOf(name) < 0;
|
|
2725
|
+
});
|
|
2726
|
+
if (missed.length && !ignoreInvalid) throw new Error("MarkdownIt. Failed to disable unknown rule(s): " + missed);
|
|
2727
|
+
return this;
|
|
2728
|
+
};
|
|
2729
|
+
MarkdownIt.prototype.use = function(plugin) {
|
|
2730
|
+
const args = [this].concat(Array.prototype.slice.call(arguments, 1));
|
|
2731
|
+
plugin.apply(plugin, args);
|
|
2732
|
+
return this;
|
|
2733
|
+
};
|
|
2734
|
+
MarkdownIt.prototype.parse = function(src, env) {
|
|
2735
|
+
if (typeof src !== "string") throw new Error("Input data should be a String");
|
|
2736
|
+
const state = new this.core.State(src, this, env);
|
|
2737
|
+
this.core.process(state);
|
|
2738
|
+
return state.tokens;
|
|
2739
|
+
};
|
|
2740
|
+
MarkdownIt.prototype.render = function(src, env) {
|
|
2741
|
+
env = env || {};
|
|
2742
|
+
return this.renderer.render(this.parse(src, env), this.options, env);
|
|
2743
|
+
};
|
|
2744
|
+
MarkdownIt.prototype.parseInline = function(src, env) {
|
|
2745
|
+
const state = new this.core.State(src, this, env);
|
|
2746
|
+
state.inlineMode = true;
|
|
2747
|
+
this.core.process(state);
|
|
2748
|
+
return state.tokens;
|
|
2749
|
+
};
|
|
2750
|
+
MarkdownIt.prototype.renderInline = function(src, env) {
|
|
2751
|
+
env = env || {};
|
|
2752
|
+
return this.renderer.render(this.parseInline(src, env), this.options, env);
|
|
2753
|
+
};
|
|
2754
|
+
|
|
2755
|
+
// scripts/autolink.js
|
|
2756
|
+
const D = "[^\\s!-,./:-@[-^`{-~]";
|
|
2757
|
+
const SCAN = /(?:https?:\/\/|ftp:\/\/|www\.)|(?:mailto|xmpp):(?=[\w.+-]+@)|[\w.+-]+@?/gi;
|
|
2758
|
+
const DOMAIN = new RegExp(`${D}+(?:\\.${D}+)*`, "uy");
|
|
2759
|
+
const PATH = /[^\s<]*/y;
|
|
2760
|
+
const EMAIL = /[\w.+-]+@[\w-]+(?:\.[\w-]+)+/y;
|
|
2761
|
+
const XMPP = /\/[\w@.-]*/y;
|
|
2762
|
+
const ENTITY = /^&[a-z\d]+;$/i;
|
|
2763
|
+
const TRAILING = "?!.,:*_~'\"";
|
|
2764
|
+
function exec(re, s, i) {
|
|
2765
|
+
re.lastIndex = i;
|
|
2766
|
+
return re.exec(s)?.[0] ?? null;
|
|
2767
|
+
}
|
|
2768
|
+
function linkAt(s, i, start) {
|
|
2769
|
+
if (start.endsWith("@") || start.endsWith(":")) {
|
|
2770
|
+
const scheme = start.endsWith(":") ? start : "", j = i + scheme.length;
|
|
2771
|
+
let email = exec(EMAIL, s, j);
|
|
2772
|
+
if (!email) return null;
|
|
2773
|
+
if (email.endsWith(".")) email = email.slice(0, -1);
|
|
2774
|
+
if (/[-_]$/.test(email)) return null;
|
|
2775
|
+
let end = j + email.length;
|
|
2776
|
+
if (/^xmpp/i.test(scheme)) {
|
|
2777
|
+
const r = exec(XMPP, s, end);
|
|
2778
|
+
if (r) end += r.replace(/\.$/, "").length;
|
|
2779
|
+
}
|
|
2780
|
+
return [end, (scheme || "mailto:") + s.slice(j, end)];
|
|
2781
|
+
}
|
|
2782
|
+
const www = /^www/i.test(start), host = i + (www ? 0 : start.length);
|
|
2783
|
+
const domain = exec(DOMAIN, s, host);
|
|
2784
|
+
if (!domain) return null;
|
|
2785
|
+
const segments = domain.split(".");
|
|
2786
|
+
if (/_/.test(segments.slice(-2).join("")) || www && segments.length < 3) return null;
|
|
2787
|
+
const from = host + domain.length;
|
|
2788
|
+
let end = from + exec(PATH, s, from).length, open = 0, close = 0;
|
|
2789
|
+
for (let k = i; k < end; k++) if (s[k] === "(") open++;
|
|
2790
|
+
else if (s[k] === ")") close++;
|
|
2791
|
+
while (end > from) {
|
|
2792
|
+
const c = s[end - 1];
|
|
2793
|
+
if (TRAILING.includes(c)) end--;
|
|
2794
|
+
else if (c === ")" && close > open) {
|
|
2795
|
+
close--;
|
|
2796
|
+
end--;
|
|
2797
|
+
} else if (c === ";") {
|
|
2798
|
+
const amp = s.lastIndexOf("&", end - 1);
|
|
2799
|
+
if (amp >= from && ENTITY.test(s.slice(amp, end))) end = amp;
|
|
2800
|
+
else break;
|
|
2801
|
+
} else break;
|
|
2802
|
+
}
|
|
2803
|
+
return [end, www ? "http://" + s.slice(i, end) : s.slice(i, end)];
|
|
2804
|
+
}
|
|
2805
|
+
function autolink(state) {
|
|
2806
|
+
for (const block of state.tokens) {
|
|
2807
|
+
if (block.type !== "inline") continue;
|
|
2808
|
+
const out = [];
|
|
2809
|
+
let inLink = 0;
|
|
2810
|
+
for (const t of block.children) {
|
|
2811
|
+
if (t.type === "link_open") inLink++;
|
|
2812
|
+
else if (t.type === "link_close") inLink--;
|
|
2813
|
+
else if (t.type === "html_inline") {
|
|
2814
|
+
if (/^<a[\s>]/i.test(t.content)) inLink++;
|
|
2815
|
+
else if (/^<\/a\s*>/i.test(t.content)) inLink--;
|
|
2816
|
+
}
|
|
2817
|
+
if (t.type !== "text" || inLink > 0) {
|
|
2818
|
+
out.push(t);
|
|
2819
|
+
continue;
|
|
2820
|
+
}
|
|
2821
|
+
const s = t.content;
|
|
2822
|
+
let pos = 0, m;
|
|
2823
|
+
SCAN.lastIndex = 0;
|
|
2824
|
+
while (m = SCAN.exec(s)) {
|
|
2825
|
+
const i = m.index, start = m[0], prev = i ? s[i - 1] : " ";
|
|
2826
|
+
const email = start.endsWith("@") || start.endsWith(":");
|
|
2827
|
+
if (!email && !/^(?:https?:|ftp:|www\.)/i.test(start)) continue;
|
|
2828
|
+
const r = (/^www/i.test(start) ? /[\s*_~(]/.test(prev) : email ? !/[\w.+-]/.test(prev) : !/[a-z\d]/i.test(prev)) && linkAt(s, i, start);
|
|
2829
|
+
if (!r) {
|
|
2830
|
+
if (!start.endsWith("@")) SCAN.lastIndex = i + 1;
|
|
2831
|
+
continue;
|
|
2832
|
+
}
|
|
2833
|
+
if (i > pos) out.push(token(state, "text", "", 0, t.level, s.slice(pos, i)));
|
|
2834
|
+
const open = token(state, "link_open", "a", 1, t.level, "");
|
|
2835
|
+
open.attrs = [["href", state.md.normalizeLink(r[1])]];
|
|
2836
|
+
out.push(open, token(state, "text", "", 0, t.level + 1, s.slice(i, r[0])), token(state, "link_close", "a", -1, t.level, ""));
|
|
2837
|
+
pos = SCAN.lastIndex = r[0];
|
|
2838
|
+
}
|
|
2839
|
+
if (pos === 0) out.push(t);
|
|
2840
|
+
else if (pos < s.length) out.push(token(state, "text", "", 0, t.level, s.slice(pos)));
|
|
2841
|
+
}
|
|
2842
|
+
block.children = out;
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
function token(state, type, tag, nesting, level, content) {
|
|
2846
|
+
const t = new state.Token(type, tag, nesting);
|
|
2847
|
+
t.level = level;
|
|
2848
|
+
t.content = content;
|
|
2849
|
+
if (tag === "a") {
|
|
2850
|
+
t.markup = "linkify";
|
|
2851
|
+
t.info = "auto";
|
|
2852
|
+
}
|
|
2853
|
+
return t;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
// scripts/parser-entry.js
|
|
2857
|
+
const md = new MarkdownIt({
|
|
2858
|
+
html: true,
|
|
2859
|
+
linkify: false
|
|
2860
|
+
});
|
|
2861
|
+
md.validateLink = () => true;
|
|
2862
|
+
md.normalizeLink = (u) => u;
|
|
2863
|
+
md.normalizeLinkText = (u) => u;
|
|
2864
|
+
md.core.ruler.push("autolink", autolink);
|
|
2865
|
+
const { unescapeAll } = md.utils;
|
|
2866
|
+
function tokenize(source) {
|
|
2867
|
+
const tokens = md.parse(source, {});
|
|
2868
|
+
for (const t of tokens) if (t.type === "fence") t.info = unescapeAll(t.info);
|
|
2869
|
+
return tokens;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
export { tokenize };
|