Permalink
Browse files

Fix for partially indent nested lists

  • Loading branch information...
1 parent a71df57 commit 2551dd1998ddcf625a43425954328234225b111f Brad Robinson committed Apr 10, 2011
View
13 MarkdownDeep/BlockProcessor.cs
@@ -330,6 +330,13 @@ internal List<Block> ScanLines()
case BlockType.ol_li:
case BlockType.ul_li:
+ if (b.blockType!=BlockType.ol_li && b.blockType!=BlockType.ul_li)
+ {
+ CollapseLines(blocks, lines);
+ }
+ lines.Add(b);
+ break;
+
case BlockType.dd:
case BlockType.footnote:
if (b.blockType != currentBlockType)
@@ -1255,7 +1262,7 @@ private Block BuildList(List<Block> lines)
{
// Join plain paragraphs
if ((lines[i].blockType == BlockType.p) &&
- (lines[i - 1].blockType == BlockType.p || lines[i - 1].blockType == listType))
+ (lines[i - 1].blockType == BlockType.p || lines[i - 1].blockType == BlockType.ul_li || lines[i - 1].blockType==BlockType.ol_li))
{
lines[i - 1].contentEnd = lines[i].contentEnd;
FreeBlock(lines[i]);
@@ -1287,7 +1294,7 @@ private Block BuildList(List<Block> lines)
// Process all lines in the range
for (int i = 0; i < lines.Count; i++)
{
- System.Diagnostics.Debug.Assert(lines[i].blockType == listType);
+ System.Diagnostics.Debug.Assert(lines[i].blockType == BlockType.ul_li || lines[i].blockType==BlockType.ol_li);
// Find start of item, including leading blanks
int start_of_li = i;
@@ -1296,7 +1303,7 @@ private Block BuildList(List<Block> lines)
// Find end of the item, including trailing blanks
int end_of_li = i;
- while (end_of_li < lines.Count - 1 && lines[end_of_li + 1].blockType != listType)
+ while (end_of_li < lines.Count - 1 && lines[end_of_li + 1].blockType != BlockType.ul_li && lines[end_of_li + 1].blockType != BlockType.ol_li)
end_of_li++;
// Is this a simple or complex list item?
View
9 MarkdownDeepJS/MarkdownDeep.js
@@ -3107,6 +3107,11 @@ var MarkdownDeep = new function () {
case BlockType_ol_li:
case BlockType_ul_li:
+ if (b.blockType != BlockType_ol_li && b.blockType != BlockType_ul_li) {
+ this.CollapseLines(blocks, lines);
+ }
+ lines.push(b);
+ break;
case BlockType_dd:
case BlockType_footnote:
if (b.blockType != currentBlockType) {
@@ -3924,7 +3929,7 @@ var MarkdownDeep = new function () {
for (var i = 1; i < lines.length; i++) {
// Join plain paragraphs
if ((lines[i].blockType == BlockType_p) &&
- (lines[i - 1].blockType == BlockType_p || lines[i - 1].blockType == listType)) {
+ (lines[i - 1].blockType == BlockType_p || lines[i - 1].blockType == BlockType_ul_li || lines[i - 1].blockType == BlockType_ol_li)) {
lines[i - 1].set_contentEnd(lines[i].get_contentEnd());
this.FreeBlock(lines[i]);
lines.splice(i, 1);
@@ -3960,7 +3965,7 @@ var MarkdownDeep = new function () {
// Find end of the item, including trailing blanks
var end_of_li = i;
- while (end_of_li < lines.length - 1 && lines[end_of_li + 1].blockType != listType)
+ while (end_of_li < lines.length - 1 && lines[end_of_li + 1].blockType != BlockType_ul_li && lines[end_of_li + 1].blockType != BlockType_ol_li)
end_of_li++;
// Is this a simple or complex list item?
View
125 MarkdownDeepJS/MarkdownDeep.min.js
@@ -217,68 +217,69 @@ v=14;e.push(b)}else{b.aY();c.push(b)}continue}var h=c.length>0?c[0].v:0;if(b.v==
if(g.v==0){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10:case 11:case 13:case 25:case 28:c.push(b);break}
break;case 9:if(h!=9)this.S(e,c);c.push(b);break;case 10:case 11:switch(h){case 0:c.push(b);break;case 12:case 9:var g=c
[c.length-1];if(g.v==0||this.bx==10||this.bx==11||this.bx==25){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10
-:case 11:case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:this.S(e,c);c.push(b);break}break;case 25:case 28
-:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;default:b.aY();c.push(b);break}break;default:this.
-S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);return e};a.T=function(c){var b;if(this.bw.bC.length>
-1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c
-<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[
-c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.
-pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1
-].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n
-.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M(b));break;case 25:if(c.length>0){var j=c[c.length-1]
-;switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);
-break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0]
-.an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.
-length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=
-this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.
-by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.
-ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(
--1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5
-(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e==
-"~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0
-)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.
-by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.
-R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H
-())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();
-b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var
-v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e
-==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(
-".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();
-if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.
-bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.attributes.markdown;if(b==undefined)if(this.bo)return 3;else
- return 0;delete c.attributes.markdown;if(b=="1")return(c.ap()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;
-if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.
-by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==
-o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;
-c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.
-v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=n-g;e.C=[];e.C.push(c)}break}return true}}else k++}
-return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)return false;if(h.closing)return false;var m=false;if(
-this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R
-;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase(
-)=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J())
-{if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)
-continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==
-null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j
-.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8();b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.
-by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.
-substr(t,s-t);this.bw.HeadBlockContent=this.bw.HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;
-return true}c.v=15;c.N=b.by-c.R;return true}}else p++}return 0};a.M=function(b){var m=b[0].v,t=b[0].aq();for(var c=1;c<b
-.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==m)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}
-if(b[c].v!=13&&b[c].v!=0){var s=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var g=this.T(0
-);g.v=m==11?21:20;g.C=[];for(var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var h=c;while(h<b.length-1&&b[h+
-1].v!=m)h++;if(k==h)g.C.push(this.T().V(b[c]));else{var p=false,o=this.bw.as();for(var e=k;e<=h;e++){var n=b[e];o.x(n.E.
-substr(n.R,n.N));o.x("\n");if(b[e].v==0)p=true}var j=this.T();j.v=19;j.ay=b[k].ay;var q=new D(this.bw);q.bx=m;j.C=q.aH(o
-.bh());if(!p)for(var e=0;e<j.C.length;e++){var r=j.C[e];if(r.v==12)r.v=17}g.C.push(j)}c=h}g.ay=g.C[0].ay;this.aj(b);b.
-length=0;return g};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c
-].ao());this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=
-this.bw.as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var
-j=new D(this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.
-length;b++)switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b])
-;e.splice(b,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12
-||c[b-1].v==28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length
-;b++){var g=c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X
-;e.C=j.aH(h.bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.
-W();if(g.length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
+:case 11:if(b.v!=10&&b.v!=11)this.S(e,c);c.push(b);break;case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:
+this.S(e,c);c.push(b);break}break;case 25:case 28:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;
+default:b.aY();c.push(b);break}break;default:this.S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);
+return e};a.T=function(c){var b;if(this.bw.bC.length>1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(
+b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){
+var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function
+(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[
+0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(
+this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M
+(b));break;case 25:if(c.length>0){var j=c[c.length-1];switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.
+T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;
+case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0].an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.
+substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(
+c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();
+return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(
+1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.
+id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(-1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j
+-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var
+s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e=="~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b
+.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;
+return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){
+if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var
+k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this
+.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"
+&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")
+&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;
+return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.
+bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;
+return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.
+attributes.markdown;if(b==undefined)if(this.bo)return 3;else return 0;delete c.attributes.markdown;if(b=="1")return(c.ap
+()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b
+.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m
+==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e
+.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new
+ D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=
+n-g;e.C=[];e.C.push(c)}break}return true}}else k++}return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)
+return false;if(h.closing)return false;var m=false;if(this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)
+return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())
+return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase()=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.
+ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J()){if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.
+a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=
+this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.
+N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8(
+);b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.
+push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.substr(t,s-t);this.bw.HeadBlockContent=this.bw.
+HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;return true}c.v=15;c.N=b.by-c.R;return true}}
+else p++}return 0};a.M=function(b){var r=b[0].v,t=b[0].aq();for(var c=1;c<b.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[
+c-1].v==11||b[c-1].v==10)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}if(b[c].v!=13&&b[c].v!=0){var s
+=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var h=this.T(0);h.v=r==11?21:20;h.C=[];for(
+var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var g=c;while(g<b.length-1&&b[g+1].v!=11&&b[g+1].v!=10)g++;
+if(k==g)h.C.push(this.T().V(b[c]));else{var o=false,n=this.bw.as();for(var e=k;e<=g;e++){var m=b[e];n.x(m.E.substr(m.R,m
+.N));n.x("\n");if(b[e].v==0)o=true}var j=this.T();j.v=19;j.ay=b[k].ay;var p=new D(this.bw);p.bx=r;j.C=p.aH(n.bh());if(!o
+)for(var e=0;e<j.C.length;e++){var q=j.C[e];if(q.v==12)q.v=17}h.C.push(j)}c=g}h.ay=h.C[0].ay;this.aj(b);b.length=0;
+return h};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c].ao());
+this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=this.bw.
+as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var j=new D(
+this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.length;b++)
+switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b]);e.splice(b
+,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12||c[b-1].v==
+28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length;b++){var g=
+c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X;e.C=j.aH(h.
+bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.W();if(g.
+length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
return false;var h=b.by;b.a5(g.length);b.a8();if(!b.Y())return false;e.v=18;e.C=[];h--;var c=this.T(k);c.v=13;c.E=b.E;c.
R=j;c.N=h-j;e.C.push(c);return true};function H(){this.bp=[];this.bu=null;this.bA=[]}a=H.prototype;a.ax=false;a.bk=false
;a.aG=function(b){b.a8();if(b.Y())return null;var e=this.ax;if(this.ax&&!b.aW("|")){e=true;return null}var c=[];while(!b
View
125 MarkdownDeepJS/MarkdownDeepLib.min.js
@@ -217,68 +217,69 @@ v=14;e.push(b)}else{b.aY();c.push(b)}continue}var h=c.length>0?c[0].v:0;if(b.v==
if(g.v==0){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10:case 11:case 13:case 25:case 28:c.push(b);break}
break;case 9:if(h!=9)this.S(e,c);c.push(b);break;case 10:case 11:switch(h){case 0:c.push(b);break;case 12:case 9:var g=c
[c.length-1];if(g.v==0||this.bx==10||this.bx==11||this.bx==25){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10
-:case 11:case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:this.S(e,c);c.push(b);break}break;case 25:case 28
-:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;default:b.aY();c.push(b);break}break;default:this.
-S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);return e};a.T=function(c){var b;if(this.bw.bC.length>
-1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c
-<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[
-c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.
-pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1
-].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n
-.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M(b));break;case 25:if(c.length>0){var j=c[c.length-1]
-;switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);
-break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0]
-.an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.
-length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=
-this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.
-by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.
-ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(
--1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5
-(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e==
-"~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0
-)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.
-by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.
-R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H
-())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();
-b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var
-v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e
-==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(
-".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();
-if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.
-bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.attributes.markdown;if(b==undefined)if(this.bo)return 3;else
- return 0;delete c.attributes.markdown;if(b=="1")return(c.ap()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;
-if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.
-by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==
-o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;
-c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.
-v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=n-g;e.C=[];e.C.push(c)}break}return true}}else k++}
-return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)return false;if(h.closing)return false;var m=false;if(
-this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R
-;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase(
-)=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J())
-{if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)
-continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==
-null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j
-.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8();b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.
-by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.
-substr(t,s-t);this.bw.HeadBlockContent=this.bw.HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;
-return true}c.v=15;c.N=b.by-c.R;return true}}else p++}return 0};a.M=function(b){var m=b[0].v,t=b[0].aq();for(var c=1;c<b
-.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==m)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}
-if(b[c].v!=13&&b[c].v!=0){var s=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var g=this.T(0
-);g.v=m==11?21:20;g.C=[];for(var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var h=c;while(h<b.length-1&&b[h+
-1].v!=m)h++;if(k==h)g.C.push(this.T().V(b[c]));else{var p=false,o=this.bw.as();for(var e=k;e<=h;e++){var n=b[e];o.x(n.E.
-substr(n.R,n.N));o.x("\n");if(b[e].v==0)p=true}var j=this.T();j.v=19;j.ay=b[k].ay;var q=new D(this.bw);q.bx=m;j.C=q.aH(o
-.bh());if(!p)for(var e=0;e<j.C.length;e++){var r=j.C[e];if(r.v==12)r.v=17}g.C.push(j)}c=h}g.ay=g.C[0].ay;this.aj(b);b.
-length=0;return g};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c
-].ao());this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=
-this.bw.as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var
-j=new D(this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.
-length;b++)switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b])
-;e.splice(b,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12
-||c[b-1].v==28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length
-;b++){var g=c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X
-;e.C=j.aH(h.bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.
-W();if(g.length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
+:case 11:if(b.v!=10&&b.v!=11)this.S(e,c);c.push(b);break;case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:
+this.S(e,c);c.push(b);break}break;case 25:case 28:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;
+default:b.aY();c.push(b);break}break;default:this.S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);
+return e};a.T=function(c){var b;if(this.bw.bC.length>1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(
+b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){
+var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function
+(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[
+0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(
+this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M
+(b));break;case 25:if(c.length>0){var j=c[c.length-1];switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.
+T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;
+case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0].an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.
+substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(
+c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();
+return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(
+1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.
+id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(-1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j
+-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var
+s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e=="~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b
+.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;
+return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){
+if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var
+k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this
+.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"
+&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")
+&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;
+return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.
+bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;
+return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.
+attributes.markdown;if(b==undefined)if(this.bo)return 3;else return 0;delete c.attributes.markdown;if(b=="1")return(c.ap
+()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b
+.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m
+==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e
+.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new
+ D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=
+n-g;e.C=[];e.C.push(c)}break}return true}}else k++}return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)
+return false;if(h.closing)return false;var m=false;if(this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)
+return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())
+return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase()=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.
+ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J()){if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.
+a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=
+this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.
+N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8(
+);b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.
+push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.substr(t,s-t);this.bw.HeadBlockContent=this.bw.
+HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;return true}c.v=15;c.N=b.by-c.R;return true}}
+else p++}return 0};a.M=function(b){var r=b[0].v,t=b[0].aq();for(var c=1;c<b.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[
+c-1].v==11||b[c-1].v==10)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}if(b[c].v!=13&&b[c].v!=0){var s
+=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var h=this.T(0);h.v=r==11?21:20;h.C=[];for(
+var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var g=c;while(g<b.length-1&&b[g+1].v!=11&&b[g+1].v!=10)g++;
+if(k==g)h.C.push(this.T().V(b[c]));else{var o=false,n=this.bw.as();for(var e=k;e<=g;e++){var m=b[e];n.x(m.E.substr(m.R,m
+.N));n.x("\n");if(b[e].v==0)o=true}var j=this.T();j.v=19;j.ay=b[k].ay;var p=new D(this.bw);p.bx=r;j.C=p.aH(n.bh());if(!o
+)for(var e=0;e<j.C.length;e++){var q=j.C[e];if(q.v==12)q.v=17}h.C.push(j)}c=g}h.ay=h.C[0].ay;this.aj(b);b.length=0;
+return h};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c].ao());
+this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=this.bw.
+as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var j=new D(
+this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.length;b++)
+switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b]);e.splice(b
+,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12||c[b-1].v==
+28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length;b++){var g=
+c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X;e.C=j.aH(h.
+bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.W();if(g.
+length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
return false;var h=b.by;b.a5(g.length);b.a8();if(!b.Y())return false;e.v=18;e.C=[];h--;var c=this.T(k);c.v=13;c.E=b.E;c.
R=j;c.N=h-j;e.C.push(c);return true};function H(){this.bp=[];this.bu=null;this.bA=[]}a=H.prototype;a.ax=false;a.bk=false
;a.aG=function(b){b.a8();if(b.Y())return null;var e=this.ax;if(this.ax&&!b.aW("|")){e=true;return null}var c=[];while(!b
View
9 MarkdownDeepTests/JSTestResources/MarkdownDeep.js
@@ -3107,6 +3107,11 @@ var MarkdownDeep = new function () {
case BlockType_ol_li:
case BlockType_ul_li:
+ if (b.blockType != BlockType_ol_li && b.blockType != BlockType_ul_li) {
+ this.CollapseLines(blocks, lines);
+ }
+ lines.push(b);
+ break;
case BlockType_dd:
case BlockType_footnote:
if (b.blockType != currentBlockType) {
@@ -3924,7 +3929,7 @@ var MarkdownDeep = new function () {
for (var i = 1; i < lines.length; i++) {
// Join plain paragraphs
if ((lines[i].blockType == BlockType_p) &&
- (lines[i - 1].blockType == BlockType_p || lines[i - 1].blockType == listType)) {
+ (lines[i - 1].blockType == BlockType_p || lines[i - 1].blockType == BlockType_ul_li || lines[i - 1].blockType == BlockType_ol_li)) {
lines[i - 1].set_contentEnd(lines[i].get_contentEnd());
this.FreeBlock(lines[i]);
lines.splice(i, 1);
@@ -3960,7 +3965,7 @@ var MarkdownDeep = new function () {
// Find end of the item, including trailing blanks
var end_of_li = i;
- while (end_of_li < lines.length - 1 && lines[end_of_li + 1].blockType != listType)
+ while (end_of_li < lines.length - 1 && lines[end_of_li + 1].blockType != BlockType_ul_li && lines[end_of_li + 1].blockType != BlockType_ol_li)
end_of_li++;
// Is this a simple or complex list item?
View
125 MarkdownDeepTests/JSTestResources/MarkdownDeep.min.js
@@ -217,68 +217,69 @@ v=14;e.push(b)}else{b.aY();c.push(b)}continue}var h=c.length>0?c[0].v:0;if(b.v==
if(g.v==0){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10:case 11:case 13:case 25:case 28:c.push(b);break}
break;case 9:if(h!=9)this.S(e,c);c.push(b);break;case 10:case 11:switch(h){case 0:c.push(b);break;case 12:case 9:var g=c
[c.length-1];if(g.v==0||this.bx==10||this.bx==11||this.bx==25){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10
-:case 11:case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:this.S(e,c);c.push(b);break}break;case 25:case 28
-:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;default:b.aY();c.push(b);break}break;default:this.
-S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);return e};a.T=function(c){var b;if(this.bw.bC.length>
-1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c
-<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[
-c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.
-pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1
-].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n
-.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M(b));break;case 25:if(c.length>0){var j=c[c.length-1]
-;switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);
-break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0]
-.an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.
-length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=
-this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.
-by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.
-ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(
--1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5
-(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e==
-"~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0
-)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.
-by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.
-R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H
-())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();
-b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var
-v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e
-==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(
-".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();
-if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.
-bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.attributes.markdown;if(b==undefined)if(this.bo)return 3;else
- return 0;delete c.attributes.markdown;if(b=="1")return(c.ap()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;
-if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.
-by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==
-o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;
-c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.
-v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=n-g;e.C=[];e.C.push(c)}break}return true}}else k++}
-return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)return false;if(h.closing)return false;var m=false;if(
-this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R
-;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase(
-)=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J())
-{if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)
-continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==
-null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j
-.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8();b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.
-by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.
-substr(t,s-t);this.bw.HeadBlockContent=this.bw.HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;
-return true}c.v=15;c.N=b.by-c.R;return true}}else p++}return 0};a.M=function(b){var m=b[0].v,t=b[0].aq();for(var c=1;c<b
-.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==m)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}
-if(b[c].v!=13&&b[c].v!=0){var s=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var g=this.T(0
-);g.v=m==11?21:20;g.C=[];for(var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var h=c;while(h<b.length-1&&b[h+
-1].v!=m)h++;if(k==h)g.C.push(this.T().V(b[c]));else{var p=false,o=this.bw.as();for(var e=k;e<=h;e++){var n=b[e];o.x(n.E.
-substr(n.R,n.N));o.x("\n");if(b[e].v==0)p=true}var j=this.T();j.v=19;j.ay=b[k].ay;var q=new D(this.bw);q.bx=m;j.C=q.aH(o
-.bh());if(!p)for(var e=0;e<j.C.length;e++){var r=j.C[e];if(r.v==12)r.v=17}g.C.push(j)}c=h}g.ay=g.C[0].ay;this.aj(b);b.
-length=0;return g};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c
-].ao());this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=
-this.bw.as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var
-j=new D(this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.
-length;b++)switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b])
-;e.splice(b,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12
-||c[b-1].v==28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length
-;b++){var g=c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X
-;e.C=j.aH(h.bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.
-W();if(g.length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
+:case 11:if(b.v!=10&&b.v!=11)this.S(e,c);c.push(b);break;case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:
+this.S(e,c);c.push(b);break}break;case 25:case 28:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;
+default:b.aY();c.push(b);break}break;default:this.S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);
+return e};a.T=function(c){var b;if(this.bw.bC.length>1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(
+b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){
+var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function
+(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[
+0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(
+this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M
+(b));break;case 25:if(c.length>0){var j=c[c.length-1];switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.
+T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;
+case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0].an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.
+substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(
+c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();
+return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(
+1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.
+id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(-1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j
+-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var
+s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e=="~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b
+.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;
+return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){
+if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var
+k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this
+.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"
+&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")
+&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;
+return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.
+bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;
+return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.
+attributes.markdown;if(b==undefined)if(this.bo)return 3;else return 0;delete c.attributes.markdown;if(b=="1")return(c.ap
+()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b
+.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m
+==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e
+.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new
+ D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=
+n-g;e.C=[];e.C.push(c)}break}return true}}else k++}return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)
+return false;if(h.closing)return false;var m=false;if(this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)
+return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())
+return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase()=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.
+ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J()){if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.
+a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=
+this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.
+N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8(
+);b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.
+push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.substr(t,s-t);this.bw.HeadBlockContent=this.bw.
+HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;return true}c.v=15;c.N=b.by-c.R;return true}}
+else p++}return 0};a.M=function(b){var r=b[0].v,t=b[0].aq();for(var c=1;c<b.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[
+c-1].v==11||b[c-1].v==10)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}if(b[c].v!=13&&b[c].v!=0){var s
+=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var h=this.T(0);h.v=r==11?21:20;h.C=[];for(
+var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var g=c;while(g<b.length-1&&b[g+1].v!=11&&b[g+1].v!=10)g++;
+if(k==g)h.C.push(this.T().V(b[c]));else{var o=false,n=this.bw.as();for(var e=k;e<=g;e++){var m=b[e];n.x(m.E.substr(m.R,m
+.N));n.x("\n");if(b[e].v==0)o=true}var j=this.T();j.v=19;j.ay=b[k].ay;var p=new D(this.bw);p.bx=r;j.C=p.aH(n.bh());if(!o
+)for(var e=0;e<j.C.length;e++){var q=j.C[e];if(q.v==12)q.v=17}h.C.push(j)}c=g}h.ay=h.C[0].ay;this.aj(b);b.length=0;
+return h};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c].ao());
+this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=this.bw.
+as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var j=new D(
+this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.length;b++)
+switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b]);e.splice(b
+,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12||c[b-1].v==
+28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length;b++){var g=
+c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X;e.C=j.aH(h.
+bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.W();if(g.
+length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
return false;var h=b.by;b.a5(g.length);b.a8();if(!b.Y())return false;e.v=18;e.C=[];h--;var c=this.T(k);c.v=13;c.E=b.E;c.
R=j;c.N=h-j;e.C.push(c);return true};function H(){this.bp=[];this.bu=null;this.bA=[]}a=H.prototype;a.ax=false;a.bk=false
;a.aG=function(b){b.a8();if(b.Y())return null;var e=this.ax;if(this.ax&&!b.aW("|")){e=true;return null}var c=[];while(!b
View
125 MarkdownDeepTests/JSTestResources/MarkdownDeepLib.min.js
@@ -217,68 +217,69 @@ v=14;e.push(b)}else{b.aY();c.push(b)}continue}var h=c.length>0?c[0].v:0;if(b.v==
if(g.v==0){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10:case 11:case 13:case 25:case 28:c.push(b);break}
break;case 9:if(h!=9)this.S(e,c);c.push(b);break;case 10:case 11:switch(h){case 0:c.push(b);break;case 12:case 9:var g=c
[c.length-1];if(g.v==0||this.bx==10||this.bx==11||this.bx==25){this.S(e,c);c.push(b)}else{b.aY();c.push(b)}break;case 10
-:case 11:case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:this.S(e,c);c.push(b);break}break;case 25:case 28
-:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;default:b.aY();c.push(b);break}break;default:this.
-S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);return e};a.T=function(c){var b;if(this.bw.bC.length>
-1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c
-<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[
-c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.
-pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1
-].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n
-.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M(b));break;case 25:if(c.length>0){var j=c[c.length-1]
-;switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);
-break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0]
-.an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.
-length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=
-this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.
-by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.
-ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(
--1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5
-(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e==
-"~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0
-)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.
-by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.
-R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H
-())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();
-b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var
-v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e
-==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(
-".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();
-if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.
-bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.attributes.markdown;if(b==undefined)if(this.bo)return 3;else
- return 0;delete c.attributes.markdown;if(b=="1")return(c.ap()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;
-if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.
-by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==
-o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;
-c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.
-v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=n-g;e.C=[];e.C.push(c)}break}return true}}else k++}
-return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)return false;if(h.closing)return false;var m=false;if(
-this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R
-;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase(
-)=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J())
-{if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)
-continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==
-null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j
-.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8();b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.
-by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.
-substr(t,s-t);this.bw.HeadBlockContent=this.bw.HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;
-return true}c.v=15;c.N=b.by-c.R;return true}}else p++}return 0};a.M=function(b){var m=b[0].v,t=b[0].aq();for(var c=1;c<b
-.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==m)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}
-if(b[c].v!=13&&b[c].v!=0){var s=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var g=this.T(0
-);g.v=m==11?21:20;g.C=[];for(var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var h=c;while(h<b.length-1&&b[h+
-1].v!=m)h++;if(k==h)g.C.push(this.T().V(b[c]));else{var p=false,o=this.bw.as();for(var e=k;e<=h;e++){var n=b[e];o.x(n.E.
-substr(n.R,n.N));o.x("\n");if(b[e].v==0)p=true}var j=this.T();j.v=19;j.ay=b[k].ay;var q=new D(this.bw);q.bx=m;j.C=q.aH(o
-.bh());if(!p)for(var e=0;e<j.C.length;e++){var r=j.C[e];if(r.v==12)r.v=17}g.C.push(j)}c=h}g.ay=g.C[0].ay;this.aj(b);b.
-length=0;return g};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c
-].ao());this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=
-this.bw.as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var
-j=new D(this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.
-length;b++)switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b])
-;e.splice(b,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12
-||c[b-1].v==28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length
-;b++){var g=c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X
-;e.C=j.aH(h.bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.
-W();if(g.length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
+:case 11:if(b.v!=10&&b.v!=11)this.S(e,c);c.push(b);break;case 25:case 28:if(b.v!=h)this.S(e,c);c.push(b);break;case 13:
+this.S(e,c);c.push(b);break}break;case 25:case 28:switch(h){case 0:case 12:case 25:case 28:this.S(e,c);c.push(b);break;
+default:b.aY();c.push(b);break}break;default:this.S(e,c);e.push(b);break}}this.S(e,c);if(this.bw.ExtraMode)this.I(e);
+return e};a.T=function(c){var b;if(this.bw.bC.length>1)b=this.bw.bC.pop();else b=new B();b.ay=c;return b};a.ai=function(
+b){this.bw.bC.push(b)};a.aj=function(b){for(var c=0;c<b.length;c++)this.bw.bC.push(b[c]);b.length=0};a.aQ=function(g){
+var b=this.bw.as();for(var c=0;c<g.length;c++){var e=g[c];b.x(e.E.substr(e.R,e.N));b.x("\n")}return b.bh()};a.S=function
+(c,b){while(b.length>0&&b[b.length-1].v==0)this.ai(b.pop());if(b.length==0)return;switch(b[0].v){case 12:var h=this.T(b[
+0].ay);h.v=12;h.E=b[0].E;h.R=b[0].R;h.a3(b[b.length-1].ao());c.push(h);this.aj(b);break;case 9:var p=this.aQ(b),o=new D(
+this.bw,this.bo);o.bx=9;var n=this.T(b[0].ay);n.v=9;n.C=o.aH(p);this.aj(b);c.push(n);break;case 10:case 11:c.push(this.M
+(b));break;case 25:if(c.length>0){var j=c[c.length-1];switch(j.v){case 12:j.v=26;break;case 25:break;default:var k=this.
+T(j.ay);k.v=26;k.C=[];k.C.push(j);c.pop();c.push(k);break}}c.push(this.G(b));break;case 28:this.bw.z(this.L(b));break;
+case 13:var e=this.T(b[0].ay);e.v=18;e.C=[];var g=b[0].an();if(g.substr(0,2)=="{{"&&g.substr(g.length-2,2)=="}}"){e.X=g.
+substr(2,g.length-4);b.splice(0,1)}for(var m=0;m<b.length;m++)e.C.push(b[m]);c.push(e);b.length=0;break}};a.ab=function(
+c){var b=this.T(c.by);b.E=c.E;b.R=c.by;b.N=-1;b.v=this.ac(c,b);if(b.N<0){c.bb();b.N=c.by-b.R}b.aA=c.by-b.ay;c.aZ();
+return b};a.ac=function(b,c){if(b.Y())return 0;var h=b.by,e=b.H();if(e=="#"){var j=1;b.a5(1);while(b.H()=="#"){j++;b.a5(
+1)}if(j>6)j=6;b.a8();c.R=b.by;b.bb();if(this.bw.ExtraMode&&!this.bw.SafeMode){var m=at(b.E,c.R,b.by);if(m!=null){c.X=m.
+id;b.by=m.end}}while(b.by>c.R&&b.F(-1)=="#")b.a5(-1);while(b.by>c.R&&ad(b.F(-1)))b.a5(-1);c.N=b.by-c.R;b.bb();return 1+j
+-1}if(e=="-"||e=="="){var k=e;while(b.H()==k)b.a5(1);b.a8();if(b.Y())return k=="="?7:8;b.by=h}if(this.bw.ExtraMode){var
+s=av(b);if(s!=null){c.X=s;return 24}b.by=h;if(e=="~"){if(this.aJ(b,c))return c.v;b.by=h}}var g=-1,r=0;while(!b.Y()){if(b
+.H()==" "){if(g<0)r++}else if(b.H()=="\t"){if(g<0)g=b.by}else break;b.a5(1)}if(b.Y()){c.N=0;return 0}if(r>=4){c.R=h+4;
+return 13}if(g>=0&&g-h<4){c.R=g+1;return 13}c.R=b.by;e=b.H();if(e=="<"){if(this.a0(b,c))return c.v;b.by=c.R}if(e==">"){
+if(ab(b.F(1))){b.a5(2);c.R=b.by;return 9}b.a5(1);c.R=b.by;return 9}if(e=="-"||e=="_"||e=="*"){var o=0;while(!b.Y()){var
+k=b.H();if(b.H()==e){o++;b.a5(1);continue}if(ab(b.H())){b.a5(1);continue}break}if(b.Y()&&o>=3)return 14;b.by=c.R}if(this
+.bw.ExtraMode&&e=="*"&&b.F(1)=="["){b.a5(2);b.a8();b.az();while(!b.Y()&&b.H()!="]")b.a5(1);var n=ay(b.W());if(b.H()=="]"
+&&b.F(1)==":"&&n){b.a5(2);b.a8();b.az();b.bb();var v=b.W();this.bw.y(n,v);return 0}b.by=c.R}if((e=="*"||e=="+"||e=="-")
+&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;return 11}if(e==":"&&this.bw.ExtraMode&&ab(b.F(1))){b.a5(1);b.a8();c.R=b.by;
+return 25}if(X(e)){b.a5(1);while(X(b.H()))b.a5(1);if(b.aW(".")&&b.a8()){c.R=b.by;return 10}b.by=c.R}if(e=="["){if(this.
+bw.ExtraMode&&b.F(1)=="^"){var t=b.by;b.a5(2);var p=b.a4();if(p!=null&&b.aW("]")&&b.aW(":")){b.a8();c.R=b.by;c.X=p;
+return 28}b.by=t}var q=an(b,this.bw.ExtraMode);if(q!=null){this.bw.A(q);return 0}}return 12};a.ar=function(c){var b=c.
+attributes.markdown;if(b==undefined)if(this.bo)return 3;else return 0;delete c.attributes.markdown;if(b=="1")return(c.ap
+()&8)!=0?2:1;if(b=="block")return 1;if(b=="deep")return 3;if(b=="span")return 2;return 4};a.aK=function(b,e,o,m){var g=b
+.by,k=1,j=false;while(!b.J()){if(!b.Z("<"))break;var n=b.by,h=ag(b);if(h==null){b.a5(1);continue}if(this.bw.SafeMode&&m
+==4&&!j)if(!h.at())j=true;if(h.closed)continue;if(h.name==o.name)if(h.closing){k--;if(k==0){b.a8();b.aZ();e.v=22;e.X=o;e
+.a3(b.by);switch(m){case 2:var c=this.T(g);c.E=b.E;c.v=17;c.R=g;c.N=n-g;e.C=[];e.C.push(c);break;case 1:case 3:var p=new
+ D(this.bw,m==3);e.C=p.aL(b.E,g,n-g);break;case 4:if(j){e.v=16;e.a3(b.by)}else{var c=this.T(g);c.E=b.E;c.v=15;c.R=g;c.N=
+n-g;e.C=[];e.C.push(c)}break}return true}}else k++}return false};a.a0=function(b,c){var g=b.by,h=ag(b);if(h==null)
+return false;if(h.closing)return false;var m=false;if(this.bw.SafeMode&&!h.at())m=true;var q=h.ap();if((q&1)==0)
+return false;if((q&4)!=0||h.closed){b.a8();b.aZ();c.N=b.by-c.R;c.v=m?16:15;return true}if((q&2)!=0){b.a8();if(!b.Y())
+return false}var o=this.bw.ExtractHeadBlocks&&h.name.toLowerCase()=="head",t=b.by;if(!o&&this.bw.ExtraMode){var n=this.
+ar(h);if(n!=0)return this.aK(b,c,h,n)}var k=null,p=1;while(!b.J()){if(!b.Z("<"))break;var s=b.by,j=ag(b);if(j==null){b.
+a5(1);continue}if(this.bw.SafeMode&&!j.at())m=true;if(j.closed)continue;if(!o&&!j.closing&&this.bw.ExtraMode&&!m){var n=
+this.ar(j);if(n!=0){var r=this.T(g);if(this.aK(b,r,j,n)){if(k==null)k=[];if(s>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.
+N=s-g;k.push(e)}k.push(r);g=b.by;continue}else this.ai(r)}}if(j.name==h.name&&!j.closed)if(j.closing){p--;if(p==0){b.a8(
+);b.aZ();if(m){c.v=16;c.a3(b.by);return true}if(k!=null){if(b.by>g){var e=this.T(g);e.E=b.E;e.v=15;e.R=g;e.N=b.by-g;k.
+push(e)}c.v=23;c.a3(b.by);c.C=k;return true}if(o){var v=b.E.substr(t,s-t);this.bw.HeadBlockContent=this.bw.
+HeadBlockContent+ay(v)+"\n";c.v=15;c.R=b.bK;c.contentEnd=b.bK;c.ay=b.bK;return true}c.v=15;c.N=b.by-c.R;return true}}
+else p++}return 0};a.M=function(b){var r=b[0].v,t=b[0].aq();for(var c=1;c<b.length;c++){if(b[c].v==12&&(b[c-1].v==12||b[
+c-1].v==11||b[c-1].v==10)){b[c-1].a3(b[c].ao());this.ai(b[c]);b.splice(c,1);c--;continue}if(b[c].v!=13&&b[c].v!=0){var s
+=b[c].aq();if(s>t){b[c].v=13;var v=b[c].ao();b[c].R=b[c].ay+s;b[c].a3(v)}}}var h=this.T(0);h.v=r==11?21:20;h.C=[];for(
+var c=0;c<b.length;c++){var k=c;while(k>0&&b[k-1].v==0)k--;var g=c;while(g<b.length-1&&b[g+1].v!=11&&b[g+1].v!=10)g++;
+if(k==g)h.C.push(this.T().V(b[c]));else{var o=false,n=this.bw.as();for(var e=k;e<=g;e++){var m=b[e];n.x(m.E.substr(m.R,m
+.N));n.x("\n");if(b[e].v==0)o=true}var j=this.T();j.v=19;j.ay=b[k].ay;var p=new D(this.bw);p.bx=r;j.C=p.aH(n.bh());if(!o
+)for(var e=0;e<j.C.length;e++){var q=j.C[e];if(q.v==12)q.v=17}h.C.push(j)}c=g}h.ay=h.C[0].ay;this.aj(b);b.length=0;
+return h};a.G=function(b){for(var c=1;c<b.length;c++)if(b[c].v==12&&(b[c-1].v==12||b[c-1].v==25)){b[c-1].a3(b[c].ao());
+this.ai(b[c]);b.splice(c,1);c--;continue}var k=b[0].X;if(b.length==1&&!k){var m=b[0];b.length=0;return m}var h=this.bw.
+as();for(var c=0;c<b.length;c++){var g=b[c];h.x(g.E.substr(g.R,g.N));h.x("\n")}var e=this.T(b[0].ay);e.v=25;var j=new D(
+this.bw);j.bx=25;e.C=j.aH(h.bh());this.aj(b);b.length=0;return e};a.I=function(e){var c=null;for(var b=0;b<e.length;b++)
+switch(e[b].v){case 26:case 25:if(c==null){c=this.T(e[b].ay);c.v=27;c.C=[];e.splice(b,0,c);b++}c.C.push(e[b]);e.splice(b
+,1);b--;break;default:c=null;break}};a.L=function(c){for(var b=1;b<c.length;b++)if(c[b].v==12&&(c[b-1].v==12||c[b-1].v==
+28)){c[b-1].a3(c[b].ao());this.ai(c[b]);c.splice(b,1);b--;continue}var h=this.bw.as();for(var b=0;b<c.length;b++){var g=
+c[b];h.x(g.E.substr(g.R,g.N));h.x("\n")}var j=new D(this.bw);j.bx=28;var e=this.T(c[0].ay);e.v=28;e.X=c[0].X;e.C=j.aH(h.
+bh());this.aj(c);c.length=0;return e};a.aJ=function(b,e){var k=b.by;b.az();while(b.H()=="~")b.a5(1);var g=b.W();if(g.
+length<3)return false;b.a8();if(!b.Y())return false;b.aZ();var j=b.by;if(!b.Z(g))return false;if(!Y(b.F(-1)))
return false;var h=b.by;b.a5(g.length);b.a8();if(!b.Y())return false;e.v=18;e.C=[];h--;var c=this.T(k);c.v=13;c.E=b.E;c.
R=j;c.N=h-j;e.C.push(c);return true};function H(){this.bp=[];this.bu=null;this.bA=[]}a=H.prototype;a.ax=false;a.bk=false
;a.aG=function(b){b.a8();if(b.Y())return null;var e=this.ax;if(this.ax&&!b.aW("|")){e=true;return null}var c=[];while(!b
View
2 MarkdownDeepTests/MarkdownDeepTests.csproj
@@ -402,6 +402,8 @@
<Content Include="JSTestResources\MarkdownDeep.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <EmbeddedResource Include="testfiles\blocktests\PartiallyIndentedLists.html" />
+ <EmbeddedResource Include="testfiles\blocktests\PartiallyIndentedLists.txt" />
<EmbeddedResource Include="testfiles\blocktests\HtmlAttributeWithoutValue.txt" />
<EmbeddedResource Include="testfiles\blocktests\HtmlAttributeWithoutValue.html" />
<EmbeddedResource Include="testfiles\spantests\LinkedImage.txt" />
View
53 MarkdownDeepTests/testfiles/blocktests/PartiallyIndentedLists.html
@@ -0,0 +1,53 @@
+<p>pre</p>
+
+<ol>
+<li>
+Outer 1
+<ul>
+<li>Inner 1</li>
+<li>Inner 2</li>
+</ul>
+</li>
+<li>Outer 2</li>
+</ol>
+
+<p>between</p>
+
+<ul>
+<li>
+Outer 1
+<ol>
+<li>Inner 1</li>
+<li>Inner 2</li>
+</ol>
+</li>
+<li>Outer 2</li>
+</ul>
+
+<p>between</p>
+
+<ul>
+<li>
+Outer 1
+<ul>
+<li>Inner 1</li>
+<li>Inner 2</li>
+</ul>
+</li>
+<li>Outer 2</li>
+</ul>
+
+<p>between</p>
+
+<ol>
+<li>
+Outer 1
+<ol>
+<li>Inner 1</li>
+<li>Inner 2</li>
+</ol>
+</li>
+<li>Outer 2</li>
+</ol>
+
+<p>post</p>
View
29 MarkdownDeepTests/testfiles/blocktests/PartiallyIndentedLists.txt
@@ -0,0 +1,29 @@
+pre
+
+1. Outer 1
+ - Inner 1
+ - Inner 2
+2. Outer 2
+
+between
+
+* Outer 1
+ 1. Inner 1
+ 2. Inner 2
+* Outer 2
+
+between
+
+* Outer 1
+ * Inner 1
+ * Inner 2
+* Outer 2
+
+between
+
+1. Outer 1
+ 1. Inner 1
+ 2. Inner 2
+2. Outer 2
+
+post
View
5 MarkdownDevBed/input.txt
@@ -1 +1,4 @@
-[![img.png]()](blah)
+* List Item 1
+ 1. List 2 - Item 1
+ 2. List 2 - Item 2
+* List Item 2

0 comments on commit 2551dd1

Please sign in to comment.