md2org 1.1.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/CHANGELOG.md +71 -0
- package/LICENSE +30 -0
- package/README.md +134 -0
- package/bin/md2org +91 -0
- package/package.json +53 -0
- package/src/md2org.js +82 -0
- package/src/org-escape.js +70 -0
- package/src/org-render.js +500 -0
- package/src/vendor/LICENSE-commonmark +89 -0
- package/src/vendor/commonmark-entities.js +1907 -0
- package/src/vendor/commonmark.js +401 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Vendored CommonMark parser (parse phase only).
|
|
3
|
+
*
|
|
4
|
+
* Source: commonmark.js 0.31.2, https://github.com/commonmark/commonmark.js
|
|
5
|
+
* License: BSD-2-Clause (see src/vendor/LICENSE-commonmark)
|
|
6
|
+
*
|
|
7
|
+
* Built from lib/blocks.js with md2org's fork patches (tools/build-vendor.js),
|
|
8
|
+
* and with upstream's entity table replaced by tools/entities-compact.js, which
|
|
9
|
+
* decodes nothing. Exposes __cmark.Parser; the HTML renderer is not included.
|
|
10
|
+
*
|
|
11
|
+
* Conformance: 639/652 CommonMark 0.31.2 spec examples,
|
|
12
|
+
* asserted by test/conformance.js. Every failure is a character reference that
|
|
13
|
+
* is not decoded.
|
|
14
|
+
*
|
|
15
|
+
* Regenerate: node tools/build-vendor.js
|
|
16
|
+
*/
|
|
17
|
+
var __cmark=(()=>{var He=Object.create;var T=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,Ge=Object.prototype.hasOwnProperty;var A=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(i){throw n=
|
|
18
|
+
[i],i}};var P=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){
|
|
19
|
+
throw t=0,n}},Ke=(e,t)=>{for(var n in t)T(e,n,{get:t[n],enumerable:!0})},Y=(e,t,n,i)=>{
|
|
20
|
+
if(t&&typeof t=="object"||typeof t=="function")for(let r of Fe(t))!Ge.call(e,r)&&
|
|
21
|
+
r!==n&&T(e,r,{get:()=>t[r],enumerable:!(i=$e(t,r))||i.enumerable});return e};var U=(e,t,n)=>(n=e!=null?He(Ze(e)):{},Y(t||!e||!e.__esModule?T(n,"default",{value:e,
|
|
22
|
+
enumerable:!0}):n,e)),qe=e=>Y(T({},"__esModule",{value:!0}),e);function J(e){switch(e._type){case"document":case"block_quote":case"list":case"i\
|
|
23
|
+
tem":case"paragraph":case"heading":case"emph":case"strong":case"strikethrough":case"\
|
|
24
|
+
table":case"table_row":case"table_cell":case"footnote_definition":case"link":case"\
|
|
25
|
+
image":case"custom_inline":case"custom_block":return!0;default:return!1}}var We,
|
|
26
|
+
Qe,Ve,g,p,c,z=A(()=>{"use strict";We=function(e,t){this.current=e,this.entering=
|
|
27
|
+
t===!0},Qe=function(){var e=this.current,t=this.entering;if(e===null)return null;
|
|
28
|
+
var n=J(e);return t&&n?e._firstChild?(this.current=e._firstChild,this.entering=!0):
|
|
29
|
+
this.entering=!1:e===this.root?this.current=null:e._next===null?(this.current=e.
|
|
30
|
+
_parent,this.entering=!1):(this.current=e._next,this.entering=!0),{entering:t,node:e}},
|
|
31
|
+
Ve=function(e){return{current:e,root:e,entering:!0,next:Qe,resumeAt:We}},g=function(e,t){
|
|
32
|
+
this._type=e,this._parent=null,this._firstChild=null,this._lastChild=null,this._prev=
|
|
33
|
+
null,this._next=null,this._sourcepos=t,this._open=!0,this._string_content=null,this.
|
|
34
|
+
_literal=null,this._listData={},this._info=null,this._destination=null,this._title=
|
|
35
|
+
null,this._isFenced=!1,this._fenceChar=null,this._fenceLength=0,this._fenceOffset=
|
|
36
|
+
null,this._level=null,this._onEnter=null,this._onExit=null},p=g.prototype;Object.
|
|
37
|
+
defineProperty(p,"isContainer",{get:function(){return J(this)}});Object.defineProperty(
|
|
38
|
+
p,"type",{get:function(){return this._type}});Object.defineProperty(p,"firstChil\
|
|
39
|
+
d",{get:function(){return this._firstChild}});Object.defineProperty(p,"lastChild",
|
|
40
|
+
{get:function(){return this._lastChild}});Object.defineProperty(p,"next",{get:function(){
|
|
41
|
+
return this._next}});Object.defineProperty(p,"prev",{get:function(){return this.
|
|
42
|
+
_prev}});Object.defineProperty(p,"parent",{get:function(){return this._parent}});
|
|
43
|
+
Object.defineProperty(p,"sourcepos",{get:function(){return this._sourcepos}});Object.
|
|
44
|
+
defineProperty(p,"literal",{get:function(){return this._literal},set:function(e){
|
|
45
|
+
this._literal=e}});Object.defineProperty(p,"destination",{get:function(){return this.
|
|
46
|
+
_destination},set:function(e){this._destination=e}});Object.defineProperty(p,"ti\
|
|
47
|
+
tle",{get:function(){return this._title},set:function(e){this._title=e}});Object.
|
|
48
|
+
defineProperty(p,"info",{get:function(){return this._info},set:function(e){this.
|
|
49
|
+
_info=e}});Object.defineProperty(p,"level",{get:function(){return this._level},set:function(e){
|
|
50
|
+
this._level=e}});Object.defineProperty(p,"listType",{get:function(){return this.
|
|
51
|
+
_listData.type},set:function(e){this._listData.type=e}});Object.defineProperty(p,
|
|
52
|
+
"listTight",{get:function(){return this._listData.tight},set:function(e){this._listData.
|
|
53
|
+
tight=e}});Object.defineProperty(p,"listStart",{get:function(){return this._listData.
|
|
54
|
+
start},set:function(e){this._listData.start=e}});Object.defineProperty(p,"listDe\
|
|
55
|
+
limiter",{get:function(){return this._listData.delimiter},set:function(e){this._listData.
|
|
56
|
+
delimiter=e}});Object.defineProperty(p,"onEnter",{get:function(){return this._onEnter},
|
|
57
|
+
set:function(e){this._onEnter=e}});Object.defineProperty(p,"onExit",{get:function(){
|
|
58
|
+
return this._onExit},set:function(e){this._onExit=e}});g.prototype.appendChild=function(e){
|
|
59
|
+
e.unlink(),e._parent=this,this._lastChild?(this._lastChild._next=e,e._prev=this.
|
|
60
|
+
_lastChild,this._lastChild=e):(this._firstChild=e,this._lastChild=e)};g.prototype.
|
|
61
|
+
prependChild=function(e){e.unlink(),e._parent=this,this._firstChild?(this._firstChild.
|
|
62
|
+
_prev=e,e._next=this._firstChild,this._firstChild=e):(this._firstChild=e,this._lastChild=
|
|
63
|
+
e)};g.prototype.unlink=function(){this._prev?this._prev._next=this._next:this._parent&&
|
|
64
|
+
(this._parent._firstChild=this._next),this._next?this._next._prev=this._prev:this.
|
|
65
|
+
_parent&&(this._parent._lastChild=this._prev),this._parent=null,this._next=null,
|
|
66
|
+
this._prev=null};g.prototype.insertAfter=function(e){e.unlink(),e._next=this._next,
|
|
67
|
+
e._next&&(e._next._prev=e),e._prev=this,this._next=e,e._parent=this._parent,e._next||
|
|
68
|
+
(e._parent._lastChild=e)};g.prototype.insertBefore=function(e){e.unlink(),e._prev=
|
|
69
|
+
this._prev,e._prev&&(e._prev._next=e),e._next=this,this._prev=e,e._parent=this._parent,
|
|
70
|
+
e._prev||(e._parent._firstChild=e)};g.prototype.walker=function(){var e=new Ve(this);
|
|
71
|
+
return e};c=g});var ne=P((qn,te)=>{"use strict";var ee={};function Xe(e){var t,n,i=ee[e];if(i)return i;
|
|
72
|
+
for(i=ee[e]=[],t=0;t<128;t++)n=String.fromCharCode(t),/^[0-9a-z]$/i.test(n)?i.push(
|
|
73
|
+
n):i.push("%"+("0"+t.toString(16).toUpperCase()).slice(-2));for(t=0;t<e.length;t++)
|
|
74
|
+
i[e.charCodeAt(t)]=e[t];return i}function w(e,t,n){var i,r,s,l,a,o="";for(typeof t!=
|
|
75
|
+
"string"&&(n=t,t=w.defaultChars),typeof n>"u"&&(n=!0),a=Xe(t),i=0,r=e.length;i<r;i++){
|
|
76
|
+
if(s=e.charCodeAt(i),n&&s===37&&i+2<r&&/^[0-9a-f]{2}$/i.test(e.slice(i+1,i+3))){
|
|
77
|
+
o+=e.slice(i,i+3),i+=2;continue}if(s<128){o+=a[s];continue}if(s>=55296&&s<=57343){
|
|
78
|
+
if(s>=55296&&s<=56319&&i+1<r&&(l=e.charCodeAt(i+1),l>=56320&&l<=57343)){o+=encodeURIComponent(
|
|
79
|
+
e[i]+e[i+1]),i++;continue}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[i])}return o}
|
|
80
|
+
w.defaultChars=";/?:@&=+$,-_.!~*'()#";w.componentChars="-_.!~*'()";te.exports=w});var R=P((Wn,re)=>{function ie(e){return e}re.exports={decodeHTML:ie,decodeHTMLStrict:ie,
|
|
81
|
+
encodeHTML:e=>e,escape:e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":"&\
|
|
82
|
+
gt;",'"':"""})[t])}});var se,ae,Ye,j,le,Je,et,tt,nt,it,rt,st,I,M,at,lt,ot,ht,ct,oe,ut,H,ft,pt,Qn,dt,y,
|
|
83
|
+
he,$=A(()=>{"use strict";se=U(ne(),1),ae=U(R(),1),Ye=92,j="&(?:#x[a-f0-9]{1,6}|#\
|
|
84
|
+
[0-9]{1,7}|[a-z][a-z0-9]{1,31});",le="[A-Za-z][A-Za-z0-9-]*",Je="[a-zA-Z_:][a-zA\
|
|
85
|
+
-Z0-9:._-]*",et="[^\"'=<>`\\x00-\\x20]+",tt="'[^']*'",nt='"[^"]*"',it="(?:"+et+"\
|
|
86
|
+
|"+tt+"|"+nt+")",rt="(?:\\s*=\\s*"+it+")",st="(?:\\s+"+Je+rt+"?)",I="<"+le+st+"*\
|
|
87
|
+
\\s*/?>",M="</"+le+"\\s*[>]",at="<!-->|<!--->|<!--[\\s\\S]*?-->",lt="[<][?][\\s\\S\
|
|
88
|
+
]*?[?][>]",ot="<![A-Za-z]+[^>]*>",ht="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",ct="(?:"+I+
|
|
89
|
+
"|"+M+"|"+at+"|"+lt+"|"+ot+"|"+ht+")",oe=new RegExp("^"+ct),ut=/[\\&]/,H="[!\"#$%\
|
|
90
|
+
&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",ft=new RegExp("\\\\"+H+"|"+j,"gi"),pt='[&<>"]',
|
|
91
|
+
Qn=new RegExp(pt,"g"),dt=function(e){return e.charCodeAt(0)===Ye?e.charAt(1):(0,ae.decodeHTMLStrict)(
|
|
92
|
+
e)},y=function(e){return ut.test(e)?e.replace(ft,dt):e},he=function(e){try{return(0,se.default)(
|
|
93
|
+
e)}catch{return e}}});function E(e){return F(e)}var F,ce,ue,fe=A(()=>{"use strict";String.fromCodePoint?
|
|
94
|
+
F=function(e){try{return String.fromCodePoint(e)}catch(t){if(t instanceof RangeError)
|
|
95
|
+
return"\uFFFD";throw t}}:(ce=String.fromCharCode,ue=Math.floor,F=function(){var e=16384,
|
|
96
|
+
t=[],n,i,r=-1,s=arguments.length;if(!s)return"";for(var l="";++r<s;){var a=Number(
|
|
97
|
+
arguments[r]);if(!isFinite(a)||a<0||a>1114111||ue(a)!==a)return"\uFFFD";a<=65535?
|
|
98
|
+
t.push(a):(a-=65536,n=(a>>10)+55296,i=a%1024+56320,t.push(n,i)),(r+1===s||t.length>
|
|
99
|
+
e)&&(l+=ce.apply(null,t),t.length=0)}return l})});function un(e){return{subject:"",delimiters:null,brackets:null,pos:0,refmap:{},match:It,
|
|
100
|
+
peek:Mt,spnl:Ht,parseBackticks:$t,parseBackslash:Ft,parseAutolink:Zt,parseHtmlTag:Gt,
|
|
101
|
+
scanDelims:Kt,handleDelim:qt,parseLinkTitle:Vt,parseLinkDestination:Xt,parseLinkLabel:Yt,
|
|
102
|
+
parseOpenBracket:Jt,parseBang:en,parseCloseBracket:tn,addBracket:nn,removeBracket:rn,
|
|
103
|
+
parseEntity:sn,parseString:an,parseNewline:ln,parseReference:on,parseInline:hn,processEmphasis:Qt,
|
|
104
|
+
removeDelimiter:Wt,options:e||{},parse:cn}}var me,O,G,ge,K,B,_t,Ce,mt,xe,gt,ke,Ct,
|
|
105
|
+
Le,q,xt,C,x,W,Ne,Z,kt,Lt,pe,Nt,At,Ae,Et,bt,Tt,wt,yt,Ot,Bt,Dt,Ee,de,St,Pt,ve,Ut,zt,
|
|
106
|
+
Rt,jt,d,be,It,Mt,Ht,$t,Ft,Zt,Gt,Kt,qt,Wt,_e,Qt,Vt,Xt,Yt,Jt,en,tn,nn,rn,sn,an,ln,
|
|
107
|
+
on,hn,cn,Te,we=A(()=>{"use strict";z();$();fe();me=U(R(),1),O=he,G=y,ge=10,K=42,
|
|
108
|
+
B=95,_t=96,Ce=91,mt=93,xe=60,gt=33,ke=92,Ct=38,Le=40,q=41,xt=58,C=39,x=34,W=126,
|
|
109
|
+
Ne=H,Z="\\\\"+Ne,kt=j,Lt=oe,pe=new RegExp(/^[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\p{P}\p{S}]/u),
|
|
110
|
+
Nt=new RegExp('^(?:"('+Z+`|\\\\[^\\\\]|[^\\\\"\\x00])*"|'(`+Z+"|\\\\[^\\\\]|[^\\\\'\\x0\
|
|
111
|
+
0])*'|\\(("+Z+"|\\\\[^\\\\]|[^\\\\()\\x00])*\\))"),At=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,
|
|
112
|
+
Ae=new RegExp("^"+Ne),Et=new RegExp("^"+kt,"i"),bt=/`+/,Tt=/^`+/,wt=/\.\.\./g,yt=
|
|
113
|
+
/--+/g,Ot=/^<([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])?)*)>/,
|
|
114
|
+
Bt=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,Dt=/^ *(?:\n *)?/,Ee=/^[ \t\n\x0b\x0c\x0d]/,
|
|
115
|
+
de=/^\s/,St=/ *$/,Pt=/^ */,ve=/^ *(?:\n|$)/,Ut=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/s,
|
|
116
|
+
zt=/^\\\((?:(?!\\\))[\s\S])+\\\)/,Rt=/^\\\[(?:(?!\\\])[\s\S])+\\\](?=[ \t]*(?:\n|$))/,
|
|
117
|
+
jt=/^[^\n`\[\]\\!<&*_'"~]+/m,d=function(e){var t=new c("text");return t._literal=
|
|
118
|
+
e,t},be=function(e){return e.slice(1,e.length-1).trim().replace(/[ \t\r\n]+/g," ").
|
|
119
|
+
toLowerCase().toUpperCase()},It=function(e){var t=e.exec(this.subject.slice(this.
|
|
120
|
+
pos));return t===null?null:(this.pos+=t.index+t[0].length,t[0])},Mt=function(){return this.
|
|
121
|
+
pos<this.subject.length?this.subject.charCodeAt(this.pos):-1},Ht=function(){return this.
|
|
122
|
+
match(Dt),!0},$t=function(e){var t=this.match(Tt);if(t===null)return!1;for(var n=this.
|
|
123
|
+
pos,i,r,s;(i=this.match(bt))!==null;)if(i===t)return r=new c("code"),s=this.subject.
|
|
124
|
+
slice(n,this.pos-t.length).replace(/\n/gm," "),s.length>0&&s.match(/[^ ]/)!==null&&
|
|
125
|
+
s[0]==" "&&s[s.length-1]==" "?r._literal=s.slice(1,s.length-1):r._literal=s,e.appendChild(
|
|
126
|
+
r),!0;return this.pos=n,e.appendChild(d(t)),!0},Ft=function(e){var t=this.subject,
|
|
127
|
+
n,i=t.charAt(this.pos+1),r=i==="("?this.match(zt):i==="["&&(this.pos===0||t.charAt(
|
|
128
|
+
this.pos-1)===`
|
|
129
|
+
`)?this.match(Rt):null;return r?(n=new c("math"),n._literal=r,e.appendChild(n),!0):
|
|
130
|
+
(this.pos+=1,this.peek()===ge?(this.pos+=1,n=new c("linebreak"),e.appendChild(n)):
|
|
131
|
+
Ae.test(t.charAt(this.pos))?(e.appendChild(d(t.charAt(this.pos))),this.pos+=1):e.
|
|
132
|
+
appendChild(d("\\")),!0)},Zt=function(e){var t,n,i;return(t=this.match(Ot))?(n=t.
|
|
133
|
+
slice(1,t.length-1),i=new c("link"),i._destination=O("mailto:"+n),i._title="",i.
|
|
134
|
+
appendChild(d(n)),e.appendChild(i),!0):(t=this.match(Bt))?(n=t.slice(1,t.length-
|
|
135
|
+
1),i=new c("link"),i._destination=O(n),i._title="",i.appendChild(d(n)),e.appendChild(
|
|
136
|
+
i),!0):!1},Gt=function(e){var t=this.match(Lt);if(t===null)return!1;var n=new c(
|
|
137
|
+
"html_inline");return n._literal=t,e.appendChild(n),!0},Kt=function(e){var t=0,n,
|
|
138
|
+
i,r,s=this.pos,l,a,o,h,u,v,f,_;if(e===C||e===x)t++,this.pos++;else for(;this.peek()===
|
|
139
|
+
e;)t++,this.pos++;return t===0?null:(n=s===0?`
|
|
140
|
+
`:this.subject.charAt(s-1),r=this.peek(),r===-1?i=`
|
|
141
|
+
`:i=E(r),u=de.test(i),v=pe.test(i),f=de.test(n),_=pe.test(n),l=!u&&(!v||f||_),a=
|
|
142
|
+
!f&&(!_||u||v),e===B?(o=l&&(!a||_),h=a&&(!l||v)):e===C||e===x?(o=l&&!a,h=a):(o=l,
|
|
143
|
+
h=a),this.pos=s,{numdelims:t,can_open:o,can_close:h})},qt=function(e,t){var n=this.
|
|
144
|
+
scanDelims(e);if(!n)return!1;var i=n.numdelims,r=this.pos,s;this.pos+=i,e===C?s=
|
|
145
|
+
"\u2019":e===x?s="\u201C":s=this.subject.slice(r,this.pos);var l=d(s);return t.appendChild(
|
|
146
|
+
l),(n.can_open||n.can_close)&&(this.options.smart||e!==C&&e!==x)&&(this.delimiters=
|
|
147
|
+
{cc:e,numdelims:i,origdelims:i,node:l,previous:this.delimiters,next:null,can_open:n.
|
|
148
|
+
can_open,can_close:n.can_close},this.delimiters.previous!==null&&(this.delimiters.
|
|
149
|
+
previous.next=this.delimiters)),!0},Wt=function(e){e.previous!==null&&(e.previous.
|
|
150
|
+
next=e.next),e.next===null?this.delimiters=e.previous:e.next.previous=e.previous},
|
|
151
|
+
_e=function(e,t){e.next!==t&&(e.next=t,t.previous=e)},Qt=function(e){for(var t,n,
|
|
152
|
+
i,r,s,l,a,o,h,u,v=[],f,_=!1,k=0;k<14;k++)v[k]=e;for(n=this.delimiters;n!==null&&
|
|
153
|
+
n.previous!==e;)n=n.previous;for(;n!==null;){var L=n.cc;if(!n.can_close)n=n.next;else{
|
|
154
|
+
switch(t=n.previous,u=!1,L){case C:f=0;break;case x:f=1;break;case B:f=2+(n.can_open?
|
|
155
|
+
3:0)+n.origdelims%3;break;case K:f=8+(n.can_open?3:0)+n.origdelims%3;break;case W:
|
|
156
|
+
f=14;break}for(;t!==null&&t!==e&&t!==v[f];){if(_=(n.can_open||t.can_close)&&n.origdelims%
|
|
157
|
+
3!==0&&(t.origdelims+n.origdelims)%3===0,t.cc===n.cc&&t.can_open&&!_){u=!0;break}
|
|
158
|
+
t=t.previous}if(i=n,L===W)if(!u||n.numdelims<2||t.numdelims<2)n=n.next;else{r=t.
|
|
159
|
+
node,s=n.node,t.numdelims-=2,n.numdelims-=2,r._literal=r._literal.slice(0,r._literal.
|
|
160
|
+
length-2),s._literal=s._literal.slice(0,s._literal.length-2);for(var V=new c("st\
|
|
161
|
+
rikethrough"),N=r._next;N&&N!==s;){var Me=N._next;V.appendChild(N),N=Me}r.insertAfter(
|
|
162
|
+
V),_e(t,n),t.numdelims===0&&(r.unlink(),this.removeDelimiter(t)),n.numdelims===0&&
|
|
163
|
+
(s.unlink(),l=n.next,this.removeDelimiter(n),n=l)}else if(L===K||L===B)if(!u)n=n.
|
|
164
|
+
next;else{a=n.numdelims>=2&&t.numdelims>=2?2:1,r=t.node,s=n.node,t.numdelims-=a,
|
|
165
|
+
n.numdelims-=a,r._literal=r._literal.slice(0,r._literal.length-a),s._literal=s._literal.
|
|
166
|
+
slice(0,s._literal.length-a);var X=new c(a===1?"emph":"strong");for(o=r._next;o&&
|
|
167
|
+
o!==s;)h=o._next,o.unlink(),X.appendChild(o),o=h;r.insertAfter(X),_e(t,n),t.numdelims===
|
|
168
|
+
0&&(r.unlink(),this.removeDelimiter(t)),n.numdelims===0&&(s.unlink(),l=n.next,this.
|
|
169
|
+
removeDelimiter(n),n=l)}else L===C?(n.node._literal="\u2019",u&&(t.node._literal=
|
|
170
|
+
"\u2018"),n=n.next):L===x&&(n.node._literal="\u201D",u&&(t.node.literal="\u201C"),
|
|
171
|
+
n=n.next);u||(v[f]=i.previous,i.can_open||this.removeDelimiter(i))}}for(;this.delimiters!==
|
|
172
|
+
null&&this.delimiters!==e;)this.removeDelimiter(this.delimiters)},Vt=function(){
|
|
173
|
+
var e=this.match(Nt);return e===null?null:G(e.slice(1,-1))},Xt=function(){var e=this.
|
|
174
|
+
match(At);if(e===null){if(this.peek()===xe)return null;for(var t=this.pos,n=0,i;(i=
|
|
175
|
+
this.peek())!==-1;)if(i===ke&&Ae.test(this.subject.charAt(this.pos+1)))this.pos+=
|
|
176
|
+
1,this.peek()!==-1&&(this.pos+=1);else if(i===Le)this.pos+=1,n+=1;else if(i===q){
|
|
177
|
+
if(n<1)break;this.pos+=1,n-=1}else{if(Ee.exec(E(i))!==null)break;this.pos+=1}return this.
|
|
178
|
+
pos===t&&i!==q||n!==0?null:(e=this.subject.slice(t,this.pos),O(G(e)))}else return O(
|
|
179
|
+
G(e.slice(1,-1)))},Yt=function(){var e=this.match(Ut);return e===null||e.length>
|
|
180
|
+
1001?0:e.length},Jt=function(e){var t=this.pos,n=this.match(/^\[\^[^\]]+\]/);if(n){
|
|
181
|
+
var i=new c("footnote_reference");return i._label=n.slice(2,-1),e.appendChild(i),
|
|
182
|
+
!0}this.pos+=1;var r=d("[");return e.appendChild(r),this.addBracket(r,t,!1),!0},
|
|
183
|
+
en=function(e){var t=this.pos;if(this.pos+=1,this.peek()===Ce){this.pos+=1;var n=d(
|
|
184
|
+
"![");e.appendChild(n),this.addBracket(n,t+1,!0)}else e.appendChild(d("!"));return!0},
|
|
185
|
+
tn=function(e){var t,n,i,r,s=!1,l,a;if(this.pos+=1,t=this.pos,a=this.brackets,a===
|
|
186
|
+
null)return e.appendChild(d("]")),!0;if(!a.active)return e.appendChild(d("]")),this.
|
|
187
|
+
removeBracket(),!0;n=a.image;var o=this.pos;if(this.peek()===Le&&(this.pos++,this.
|
|
188
|
+
spnl()&&(i=this.parseLinkDestination())!==null&&this.spnl()&&(Ee.test(this.subject.
|
|
189
|
+
charAt(this.pos-1))&&(r=this.parseLinkTitle())||!0)&&this.spnl()&&this.peek()===
|
|
190
|
+
q?(this.pos+=1,s=!0):this.pos=o),!s){var h=this.pos,u=this.parseLinkLabel();if(u>
|
|
191
|
+
2?l=this.subject.slice(h,h+u):a.bracketAfter||(l=this.subject.slice(a.index,t)),
|
|
192
|
+
u===0&&(this.pos=o),l){var v=this.refmap[be(l)];v&&(i=v.destination,r=v.title,s=
|
|
193
|
+
!0)}}if(s){var f=new c(n?"image":"link");f._destination=i,f._title=r||"";var _,k;
|
|
194
|
+
for(_=a.node._next;_;)k=_._next,_.unlink(),f.appendChild(_),_=k;if(e.appendChild(
|
|
195
|
+
f),this.processEmphasis(a.previousDelimiter),this.removeBracket(),a.node.unlink(),
|
|
196
|
+
!n)for(a=this.brackets;a!==null;)a.image||(a.active=!1),a=a.previous;return!0}else
|
|
197
|
+
return this.removeBracket(),this.pos=t,e.appendChild(d("]")),!0},nn=function(e,t,n){
|
|
198
|
+
this.brackets!==null&&(this.brackets.bracketAfter=!0),this.brackets={node:e,previous:this.
|
|
199
|
+
brackets,previousDelimiter:this.delimiters,index:t,image:n,active:!0}},rn=function(){
|
|
200
|
+
this.brackets=this.brackets.previous},sn=function(e){var t;return(t=this.match(Et))?
|
|
201
|
+
(e.appendChild(d((0,me.decodeHTMLStrict)(t))),!0):!1},an=function(e){var t;return(t=
|
|
202
|
+
this.match(jt))?(this.options.smart?e.appendChild(d(t.replace(wt,"\u2026").replace(
|
|
203
|
+
yt,function(n){var i=0,r=0;return n.length%3===0?r=n.length/3:n.length%2===0?i=n.
|
|
204
|
+
length/2:n.length%3===2?(i=1,r=(n.length-2)/3):(i=2,r=(n.length-4)/3),"\u2014".repeat(
|
|
205
|
+
r)+"\u2013".repeat(i)}))):e.appendChild(d(t)),!0):!1},ln=function(e){this.pos+=1;
|
|
206
|
+
var t=e._lastChild;if(t&&t.type==="text"&&t._literal[t._literal.length-1]===" "){
|
|
207
|
+
var n=t._literal[t._literal.length-2]===" ";t._literal=t._literal.replace(St,""),
|
|
208
|
+
e.appendChild(new c(n?"linebreak":"softbreak"))}else e.appendChild(new c("softbr\
|
|
209
|
+
eak"));return this.match(Pt),!0},on=function(e,t){this.subject=e,this.pos=0;var n,
|
|
210
|
+
i,r,s,l=this.pos;if(s=this.parseLinkLabel(),s===0)return 0;if(n=this.subject.slice(
|
|
211
|
+
0,s),this.peek()===xt)this.pos++;else return this.pos=l,0;if(this.spnl(),i=this.
|
|
212
|
+
parseLinkDestination(),i===null)return this.pos=l,0;var a=this.pos;this.spnl(),this.
|
|
213
|
+
pos!==a&&(r=this.parseLinkTitle()),r===null&&(this.pos=a);var o=!0;if(this.match(
|
|
214
|
+
ve)===null&&(r===null?o=!1:(r=null,this.pos=a,o=this.match(ve)!==null)),!o)return this.
|
|
215
|
+
pos=l,0;var h=be(n);return h===""?(this.pos=l,0):(t[h]||(t[h]={destination:i,title:r===
|
|
216
|
+
null?"":r}),this.pos-l)},hn=function(e){var t=!1,n=this.peek();if(n===-1)return!1;
|
|
217
|
+
switch(n){case ge:t=this.parseNewline(e);break;case ke:t=this.parseBackslash(e);
|
|
218
|
+
break;case _t:t=this.parseBackticks(e);break;case K:case B:case W:t=this.handleDelim(
|
|
219
|
+
n,e);break;case C:case x:t=this.options.smart&&this.handleDelim(n,e);break;case Ce:
|
|
220
|
+
t=this.parseOpenBracket(e);break;case gt:t=this.parseBang(e);break;case mt:t=this.
|
|
221
|
+
parseCloseBracket(e);break;case xe:t=this.parseAutolink(e)||this.parseHtmlTag(e);
|
|
222
|
+
break;case Ct:t=this.parseEntity(e);break;default:t=this.parseString(e);break}return t||
|
|
223
|
+
(this.pos+=1,e.appendChild(d(E(n)))),!0},cn=function(e){for(this.subject=e._string_content.
|
|
224
|
+
trim(),this.pos=0,this.delimiters=null,this.brackets=null;this.parseInline(e););
|
|
225
|
+
e._string_content=null,this.processEmphasis(null)};Te=un});var Re={};Ke(Re,{default:()=>Fn});function $n(e){return{doc:new ze,blocks:Ue,blockStarts:Pn,
|
|
226
|
+
tip:this.doc,oldtip:this.doc,currentLine:"",lineNumber:0,offset:0,column:0,nextNonspace:0,
|
|
227
|
+
nextNonspaceColumn:0,indent:0,indented:!1,blank:!1,partiallyConsumedTab:!1,allClosed:!0,
|
|
228
|
+
lastMatchedContainer:this.doc,refmap:{},lastLineLength:0,inlineParser:new Te(e),
|
|
229
|
+
findNextNonspace:Rn,advanceOffset:Un,advanceNextNonspace:zn,addLine:wn,addChild:yn,
|
|
230
|
+
incorporateLine:jn,finalize:In,processInlines:Mn,closeUnmatchedBlocks:Dn,parse:Hn,
|
|
231
|
+
options:e||{}}}var D,Oe,fn,Be,pn,De,Se,dn,vn,_n,mn,gn,S,Cn,Pe,xn,kn,Ln,Nn,An,En,
|
|
232
|
+
bn,Tn,b,m,ye,wn,yn,On,Bn,Dn,Sn,Ue,Pn,Un,zn,Rn,jn,In,Mn,ze,Hn,Fn,je=A(()=>{"use s\
|
|
233
|
+
trict";z();$();we();D=4,Oe=9,fn=10,Be=62,pn=60,De=32,Se=91,dn=[/./,/^<(?:script|pre|textarea|style)(?:\s|>|$)/i,
|
|
234
|
+
/^<!--/,/^<[?]/,/^<![A-Za-z]/,/^<!\[CDATA\[/,/^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|search|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,
|
|
235
|
+
new RegExp("^(?:"+I+"|"+M+")\\s*$","i")],vn=[/./,/<\/(?:script|pre|textarea|style)>/i,
|
|
236
|
+
/-->/,/\?>/,/>/,/\]\]>/],_n=/^(?:\*[ \t]*){3,}$|^(?:_[ \t]*){3,}$|^(?:-[ \t]*){3,}$/,
|
|
237
|
+
mn=/^\[\^([^\]]+)\]:[ \t]*/,gn=/^\|?[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)*\|?[ \t]*$/,
|
|
238
|
+
S=function(e){var t=[],n="",i,r;for(e=e.trim().replace(/^\|/,"").replace(/\|[ \t]*$/,
|
|
239
|
+
""),i=0;i<e.length;i++)r=e.charAt(i),r==="\\"&&e.charAt(i+1)==="|"?(n+="|",i++):
|
|
240
|
+
r==="|"?(t.push(n.trim()),n=""):n+=r;return t.push(n.trim()),t},Cn=/^[#`~*+_=<>0-9|:[-]/,
|
|
241
|
+
Pe=/[^ \t\f\v\r\n]/,xn=/^[*+-]/,kn=/^(\d{1,9})([.)])/,Ln=/^#{1,6}(?:[ \t]+|$)/,Nn=
|
|
242
|
+
/^`{3,}(?!.*`)|^~{3,}/,An=/^(?:`{3,}|~{3,})(?=[ \t]*$)/,En=/^(?:=+|-+)[ \t]*$/,bn=
|
|
243
|
+
/\r\n|\n|\r/,Tn=function(e){return!Pe.test(e)},b=function(e){return e===De||e===
|
|
244
|
+
Oe},m=function(e,t){return t<e.length?e.charCodeAt(t):-1},ye=function(e){return e.
|
|
245
|
+
next&&e.sourcepos[1][0]!==e.next.sourcepos[0][0]-1},wn=function(){if(this.partiallyConsumedTab){
|
|
246
|
+
this.offset+=1;var e=4-this.column%4;this.tip._string_content+=" ".repeat(e)}this.
|
|
247
|
+
tip._string_content+=this.currentLine.slice(this.offset)+`
|
|
248
|
+
`},yn=function(e,t){for(;!this.blocks[this.tip.type].canContain(e);)this.finalize(
|
|
249
|
+
this.tip,this.lineNumber-1);var n=t+1,i=new c(e,[[this.lineNumber,n],[0,0]]);return i.
|
|
250
|
+
_string_content="",this.tip.appendChild(i),this.tip=i,i},On=function(e,t){var n=e.
|
|
251
|
+
currentLine.slice(e.nextNonspace),i,r,s,l,a={type:null,tight:!0,bulletChar:null,
|
|
252
|
+
start:null,delimiter:null,padding:null,markerOffset:e.indent};if(e.indent>=4)return null;
|
|
253
|
+
if(i=n.match(xn))a.type="bullet",a.bulletChar=i[0][0];else if((i=n.match(kn))&&(t.
|
|
254
|
+
type!=="paragraph"||i[1]==1))a.type="ordered",a.start=parseInt(i[1]),a.delimiter=
|
|
255
|
+
i[2];else return null;if(r=m(e.currentLine,e.nextNonspace+i[0].length),!(r===-1||
|
|
256
|
+
r===Oe||r===De)||t.type==="paragraph"&&!e.currentLine.slice(e.nextNonspace+i[0].
|
|
257
|
+
length).match(Pe))return null;e.advanceNextNonspace(),e.advanceOffset(i[0].length,
|
|
258
|
+
!0),s=e.column,l=e.offset;do e.advanceOffset(1,!0),r=m(e.currentLine,e.offset);while(e.
|
|
259
|
+
column-s<5&&b(r));var o=m(e.currentLine,e.offset)===-1,h=e.column-s;return h>=5||
|
|
260
|
+
h<1||o?(a.padding=i[0].length+1,e.column=s,e.offset=l,b(m(e.currentLine,e.offset))&&
|
|
261
|
+
e.advanceOffset(1,!0)):a.padding=i[0].length+h,a},Bn=function(e,t){return e.type===
|
|
262
|
+
t.type&&e.delimiter===t.delimiter&&e.bulletChar===t.bulletChar},Dn=function(){if(!this.
|
|
263
|
+
allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var e=this.oldtip._parent;
|
|
264
|
+
this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=e}this.allClosed=!0}},Sn=
|
|
265
|
+
function(e,t){for(var n,i,r=t.walker(),s=[];n=r.next();)if(i=n.node,n.entering&&
|
|
266
|
+
i.type==="paragraph"){for(var l,a=!1;m(i._string_content,0)===Se&&(l=e.inlineParser.
|
|
267
|
+
parseReference(i._string_content,e.refmap));){let o=i._string_content.slice(0,l);
|
|
268
|
+
i._string_content=i._string_content.slice(l),a=!0;let h=o.split(`
|
|
269
|
+
`);i.sourcepos[0][0]+=h.length-1}a&&Tn(i._string_content)&&s.push(i)}for(i of s)
|
|
270
|
+
i.unlink()},Ue={document:{continue:function(){return 0},finalize:function(e,t){Sn(
|
|
271
|
+
e,t)},canContain:function(e){return e!=="item"},acceptsLines:!1},list:{continue:function(){
|
|
272
|
+
return 0},finalize:function(e,t){for(var n=t._firstChild;n;){if(n._next&&ye(n)){
|
|
273
|
+
t._listData.tight=!1;break}for(var i=n._firstChild;i;){if(i._next&&ye(i)){t._listData.
|
|
274
|
+
tight=!1;break}i=i._next}n=n._next}t.sourcepos[1]=t._lastChild.sourcepos[1]},canContain:function(e){
|
|
275
|
+
return e==="item"},acceptsLines:!1},block_quote:{continue:function(e){var t=e.currentLine;
|
|
276
|
+
if(!e.indented&&m(t,e.nextNonspace)===Be)e.advanceNextNonspace(),e.advanceOffset(
|
|
277
|
+
1,!1),b(m(t,e.offset))&&e.advanceOffset(1,!0);else return 1;return 0},finalize:function(){},
|
|
278
|
+
canContain:function(e){return e!=="item"},acceptsLines:!1},item:{continue:function(e,t){
|
|
279
|
+
if(e.blank){if(t._firstChild==null)return 1;e.advanceNextNonspace()}else if(e.indent>=
|
|
280
|
+
t._listData.markerOffset+t._listData.padding)e.advanceOffset(t._listData.markerOffset+
|
|
281
|
+
t._listData.padding,!0);else return 1;return 0},finalize:function(e,t){t._lastChild?
|
|
282
|
+
t.sourcepos[1]=t._lastChild.sourcepos[1]:(t.sourcepos[1][0]=t.sourcepos[0][0],t.
|
|
283
|
+
sourcepos[1][1]=t._listData.markerOffset+t._listData.padding)},canContain:function(e){
|
|
284
|
+
return e!=="item"},acceptsLines:!1},heading:{continue:function(){return 1},finalize:function(){},
|
|
285
|
+
canContain:function(){return!1},acceptsLines:!1},thematic_break:{continue:function(){
|
|
286
|
+
return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},
|
|
287
|
+
code_block:{continue:function(e,t){var n=e.currentLine,i=e.indent;if(t._isFenced){
|
|
288
|
+
var r=i<=3&&n.charAt(e.nextNonspace)===t._fenceChar&&n.slice(e.nextNonspace).match(
|
|
289
|
+
An);if(r&&r[0].length>=t._fenceLength)return e.lastLineLength=e.offset+i+r[0].length,
|
|
290
|
+
e.finalize(t,e.lineNumber),2;for(var s=t._fenceOffset;s>0&&b(m(n,e.offset));)e.advanceOffset(
|
|
291
|
+
1,!0),s--}else if(i>=D)e.advanceOffset(D,!0);else if(e.blank)e.advanceNextNonspace();else
|
|
292
|
+
return 1;return 0},finalize:function(e,t){if(t._isFenced){var n=t._string_content,
|
|
293
|
+
i=n.indexOf(`
|
|
294
|
+
`),r=n.slice(0,i),s=n.slice(i+1);t.info=y(r.trim()),t._literal=s}else{for(var l=t.
|
|
295
|
+
_string_content.split(`
|
|
296
|
+
`);/^[ \t]*$/.test(l[l.length-1]);)l.pop();t._literal=l.join(`
|
|
297
|
+
`)+`
|
|
298
|
+
`,t.sourcepos[1][0]=t.sourcepos[0][0]+l.length-1,t.sourcepos[1][1]=t.sourcepos[0][1]+
|
|
299
|
+
l[l.length-1].length-1}t._string_content=null},canContain:function(){return!1},acceptsLines:!0},
|
|
300
|
+
html_block:{continue:function(e,t){return e.blank&&(t._htmlBlockType===6||t._htmlBlockType===
|
|
301
|
+
7)?1:0},finalize:function(e,t){t._literal=t._string_content.replace(/\n$/,""),t.
|
|
302
|
+
_string_content=null},canContain:function(){return!1},acceptsLines:!0},footnote_definition:{
|
|
303
|
+
continue:function(e){return e.blank?0:e.indent>=4?(e.advanceOffset(4,!0),0):e.tip.
|
|
304
|
+
type==="paragraph"?0:1},finalize:function(){},canContain:function(e){return e!==
|
|
305
|
+
"item"&&e!=="footnote_definition"},acceptsLines:!1},table:{continue:function(e){
|
|
306
|
+
return e.blank?1:0},finalize:function(e,t){var n=t._string_content.replace(/\n$/,
|
|
307
|
+
"").split(`
|
|
308
|
+
`),i=S(n[1]),r=i.map(function(u){var v=u.charAt(0)===":",f=u.charAt(u.length-1)===
|
|
309
|
+
":";return v&&f?"center":f?"right":v?"left":null}),s,l,a,o,h;for(s=0;s<n.length;s++)
|
|
310
|
+
if(s!==1){for(a=S(n[s]),o=new c("table_row"),o._isHeading=s===0,l=0;l<i.length;l++)
|
|
311
|
+
h=new c("table_cell"),h._align=r[l],h._string_content=a[l]===void 0?"":a[l],o.appendChild(
|
|
312
|
+
h);t.appendChild(o)}t._string_content=null},canContain:function(e){return e==="t\
|
|
313
|
+
able_row"},acceptsLines:!0},paragraph:{continue:function(e){return e.blank?1:0},
|
|
314
|
+
finalize:function(){},canContain:function(){return!1},acceptsLines:!0}},Pn=[function(e){
|
|
315
|
+
if(e.indented)return 0;var t=e.currentLine.slice(e.nextNonspace).match(mn);if(!t)
|
|
316
|
+
return 0;e.closeUnmatchedBlocks(),e.advanceNextNonspace(),e.advanceOffset(t[0].length,
|
|
317
|
+
!1);var n=e.addChild("footnote_definition",e.nextNonspace);return n._label=t[1],
|
|
318
|
+
1},function(e,t){if(e.indented||t.type!=="paragraph")return 0;var n=e.currentLine.
|
|
319
|
+
slice(e.nextNonspace);if(n.indexOf("|")===-1||!gn.test(n))return 0;var i=t._string_content.
|
|
320
|
+
replace(/\n$/,"").split(`
|
|
321
|
+
`),r=i[i.length-1];if(!r||r.indexOf("|")===-1||S(r).length!==S(n).length)return 0;
|
|
322
|
+
var s=i.slice(0,i.length-1).join(`
|
|
323
|
+
`);t._string_content=s===""?"":s+`
|
|
324
|
+
`,e.closeUnmatchedBlocks();var l=s==="",a=e.addChild("table",e.nextNonspace);return l&&
|
|
325
|
+
t.unlink(),a._string_content=r+`
|
|
326
|
+
`,2},function(e){return!e.indented&&m(e.currentLine,e.nextNonspace)===Be?(e.advanceNextNonspace(),
|
|
327
|
+
e.advanceOffset(1,!1),b(m(e.currentLine,e.offset))&&e.advanceOffset(1,!0),e.closeUnmatchedBlocks(),
|
|
328
|
+
e.addChild("block_quote",e.nextNonspace),1):0},function(e){var t;if(!e.indented&&
|
|
329
|
+
(t=e.currentLine.slice(e.nextNonspace).match(Ln))){e.advanceNextNonspace(),e.advanceOffset(
|
|
330
|
+
t[0].length,!1),e.closeUnmatchedBlocks();var n=e.addChild("heading",e.nextNonspace);
|
|
331
|
+
return n.level=t[0].trim().length,n._string_content=e.currentLine.slice(e.offset).
|
|
332
|
+
replace(/^[ \t]*#+[ \t]*$/,"").replace(/[ \t]+#+[ \t]*$/,""),e.advanceOffset(e.currentLine.
|
|
333
|
+
length-e.offset),2}else return 0},function(e){var t;if(!e.indented&&(t=e.currentLine.
|
|
334
|
+
slice(e.nextNonspace).match(Nn))){var n=t[0].length;e.closeUnmatchedBlocks();var i=e.
|
|
335
|
+
addChild("code_block",e.nextNonspace);return i._isFenced=!0,i._fenceLength=n,i._fenceChar=
|
|
336
|
+
t[0][0],i._fenceOffset=e.indent,e.advanceNextNonspace(),e.advanceOffset(n,!1),2}else
|
|
337
|
+
return 0},function(e,t){if(!e.indented&&m(e.currentLine,e.nextNonspace)===pn){var n=e.
|
|
338
|
+
currentLine.slice(e.nextNonspace),i;for(i=1;i<=7;i++)if(dn[i].test(n)&&(i<7||t.type!==
|
|
339
|
+
"paragraph"&&!(!e.allClosed&&!e.blank&&e.tip.type==="paragraph"))){e.closeUnmatchedBlocks();
|
|
340
|
+
var r=e.addChild("html_block",e.offset);return r._htmlBlockType=i,2}}return 0},function(e,t){
|
|
341
|
+
var n;if(!e.indented&&t.type==="paragraph"&&(n=e.currentLine.slice(e.nextNonspace).
|
|
342
|
+
match(En))){e.closeUnmatchedBlocks();for(var i;m(t._string_content,0)===Se&&(i=e.
|
|
343
|
+
inlineParser.parseReference(t._string_content,e.refmap));)t._string_content=t._string_content.
|
|
344
|
+
slice(i);if(t._string_content.length>0){var r=new c("heading",t.sourcepos);return r.
|
|
345
|
+
level=n[0][0]==="="?1:2,r._string_content=t._string_content,t.insertAfter(r),t.unlink(),
|
|
346
|
+
e.tip=r,e.advanceOffset(e.currentLine.length-e.offset,!1),2}else return 0}else return 0},
|
|
347
|
+
function(e){return!e.indented&&_n.test(e.currentLine.slice(e.nextNonspace))?(e.closeUnmatchedBlocks(),
|
|
348
|
+
e.addChild("thematic_break",e.nextNonspace),e.advanceOffset(e.currentLine.length-
|
|
349
|
+
e.offset,!1),2):0},function(e,t){var n;return(!e.indented||t.type==="list")&&(n=
|
|
350
|
+
On(e,t))?(e.closeUnmatchedBlocks(),(e.tip.type!=="list"||!Bn(t._listData,n))&&(t=
|
|
351
|
+
e.addChild("list",e.nextNonspace),t._listData=n),t=e.addChild("item",e.nextNonspace),
|
|
352
|
+
t._listData=n,1):0},function(e){return e.indented&&e.tip.type!=="paragraph"&&!e.
|
|
353
|
+
blank?(e.advanceOffset(D,!0),e.closeUnmatchedBlocks(),e.addChild("code_block",e.
|
|
354
|
+
offset),2):0}],Un=function(e,t){for(var n=this.currentLine,i,r,s;e>0&&(s=n[this.
|
|
355
|
+
offset]);)s===" "?(i=4-this.column%4,t?(this.partiallyConsumedTab=i>e,r=i>e?e:i,
|
|
356
|
+
this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,e-=r):(this.partiallyConsumedTab=
|
|
357
|
+
!1,this.column+=i,this.offset+=1,e-=1)):(this.partiallyConsumedTab=!1,this.offset+=
|
|
358
|
+
1,this.column+=1,e-=1)},zn=function(){this.offset=this.nextNonspace,this.column=
|
|
359
|
+
this.nextNonspaceColumn,this.partiallyConsumedTab=!1},Rn=function(){for(var e=this.
|
|
360
|
+
currentLine,t=this.offset,n=this.column,i;(i=e.charAt(t))!=="";)if(i===" ")t++,n++;else if(i===
|
|
361
|
+
" ")t++,n+=4-n%4;else break;this.blank=i===`
|
|
362
|
+
`||i==="\r"||i==="",this.nextNonspace=t,this.nextNonspaceColumn=n,this.indent=this.
|
|
363
|
+
nextNonspaceColumn-this.column,this.indented=this.indent>=D},jn=function(e){var t=!0,
|
|
364
|
+
n,i=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.
|
|
365
|
+
partiallyConsumedTab=!1,this.lineNumber+=1,e.indexOf("\0")!==-1&&(e=e.replace(/\0/g,
|
|
366
|
+
"\uFFFD")),this.currentLine=e;for(var r;(r=i._lastChild)&&r._open;){switch(i=r,this.
|
|
367
|
+
findNextNonspace(),this.blocks[i.type].continue(this,i)){case 0:break;case 1:t=!1;
|
|
368
|
+
break;case 2:return;default:throw"continue returned illegal value, must be 0, 1,\
|
|
369
|
+
or 2"}if(!t){i=i._parent;break}}this.allClosed=i===this.oldtip,this.lastMatchedContainer=
|
|
370
|
+
i;for(var s=i.type!=="paragraph"&&i.type!=="table"&&Ue[i.type].acceptsLines,l=this.
|
|
371
|
+
blockStarts,a=l.length;!s;){if(this.findNextNonspace(),!this.indented&&!Cn.test(
|
|
372
|
+
e.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var o=0;o<a;){
|
|
373
|
+
var h=l[o](this,i);if(h===1){i=this.tip;break}else if(h===2){i=this.tip,s=!0;break}else
|
|
374
|
+
o++}if(o===a){this.advanceNextNonspace();break}}!this.allClosed&&!this.blank&&this.
|
|
375
|
+
tip.type==="paragraph"?this.addLine():(this.closeUnmatchedBlocks(),n=i.type,this.
|
|
376
|
+
blocks[n].acceptsLines?(this.addLine(),n==="html_block"&&i._htmlBlockType>=1&&i.
|
|
377
|
+
_htmlBlockType<=5&&vn[i._htmlBlockType].test(this.currentLine.slice(this.offset))&&
|
|
378
|
+
(this.lastLineLength=e.length,this.finalize(i,this.lineNumber))):this.offset<e.length&&
|
|
379
|
+
!this.blank&&(i=this.addChild("paragraph",this.offset),this.advanceNextNonspace(),
|
|
380
|
+
this.addLine())),this.lastLineLength=e.length},In=function(e,t){var n=e._parent;
|
|
381
|
+
e._open=!1,e.sourcepos[1]=[t,this.lastLineLength],this.blocks[e.type].finalize(this,
|
|
382
|
+
e),this.tip=n},Mn=function(e){var t,n,i,r=e.walker();for(this.inlineParser.refmap=
|
|
383
|
+
this.refmap,this.inlineParser.options=this.options;n=r.next();)t=n.node,i=t.type,
|
|
384
|
+
!n.entering&&(i==="paragraph"||i==="heading"||i==="table_cell")&&this.inlineParser.
|
|
385
|
+
parse(t)},ze=function(){var e=new c("document",[[1,1],[0,0]]);return e},Hn=function(e){
|
|
386
|
+
this.doc=new ze,this.tip=this.doc,this.refmap={},this.lineNumber=0,this.lastLineLength=
|
|
387
|
+
0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine=
|
|
388
|
+
"",this.options.time&&console.time("preparing input");var t=e.split(bn),n=t.length;
|
|
389
|
+
e.charCodeAt(e.length-1)===fn&&(n-=1),this.options.time&&console.timeEnd("prepar\
|
|
390
|
+
ing input"),this.options.time&&console.time("block parsing");for(var i=0;i<n;i++)
|
|
391
|
+
this.incorporateLine(t[i]);for(;this.tip;)this.finalize(this.tip,n);return this.
|
|
392
|
+
options.time&&console.timeEnd("block parsing"),this.options.time&&console.time("\
|
|
393
|
+
inline parsing"),this.processInlines(this.doc),this.options.time&&console.timeEnd(
|
|
394
|
+
"inline parsing"),this.doc};Fn=$n});var Zn=P((ii,Ie)=>{var Q=(je(),qe(Re));Ie.exports={Parser:Q.Parser||Q.default||Q}});return Zn();})();
|
|
395
|
+
/*! Bundled license information:
|
|
396
|
+
|
|
397
|
+
commonmark/lib/from-code-point.js:
|
|
398
|
+
(*! http://mths.be/fromcodepoint v0.2.1 by @mathias *)
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
if (typeof module !== "undefined" && module.exports) { module.exports = __cmark; }
|