Permalink
Browse files

Fix for the non-ASCII bug in SnuOwnd.

* Fix for the non-ASCII bug in SnuOwnd.
* Included SnuOwnd is less aggressively minified to aid debugging.
  • Loading branch information...
1 parent bdac20e commit dfde146c20126e7f3a60b4c0a6cb969902994c36 @gamefreak committed May 1, 2012
Showing with 90 additions and 56 deletions.
  1. +90 −56 lib/reddit_enhancement_suite.user.js
View
146 lib/reddit_enhancement_suite.user.js
@@ -7246,62 +7246,96 @@ modules['commentPreview'] = {
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
var SnuOwnd={};
-(function(){function t(b){return" "==b||"\n"==b}function s(b){return/[A-Za-z0-9]/.test(b)}function ca(b){return/[\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]/.test(b)}function I(b,c){var a,e=0,d=b.length;if(3>d||"<"!=b[0])return HTML_TAG_NONE;a=1;"/"==b[a]&&(e=1,a++);for(var f=0;a<d&&!(f>=c.length);++a,++f)if(b[a]!=c[f])return HTML_TAG_NONE;return a==d?HTML_TAG_NONE:/\s/.test(b[a])||">"==b[a]?e?HTML_TAG_CLOSE:HTML_TAG_OPEN:HTML_TAG_NONE}function da(b,c){for(var a=0,e;a<c.s.length;){for(e=a;a<c.s.length&&
-"\\"!=c.s[a];)a++;a>e&&(b.s+=c.s.slice(e,a));if(a+1>=c.s.length)break;b.s+=c.s[a+1];a+=2}}function w(b,c,a){for(var e=0,d,f=0;e<c.length;){for(d=e;e<c.length&&0==(f=ea[c.charCodeAt(e)]);)e++;e>d&&(b.s+=c.slice(d,e));if(e>=c.length)break;"/"==c[e]&&!a?b.s+="/":7!=ea[c.charCodeAt(e)]&&(b.s+=Aa[f]);e++}}function J(b,c){for(var a=0,e,d=["$","",""];a<c.length;){for(e=a;a<c.length&&0!=fa[c.charCodeAt(a)];)a++;a>e&&(b.s+=c.slice(e,a));if(a>=c.length)break;if(2!=fa[c.charCodeAt(a)])switch(c[a]){case "&":b.s+=
-"&amp;";break;case "'":b.s+="&#x27;";break;default:e=c.charCodeAt(a),d[1]="0123456789ABCDEF"[e>>4&15],d[2]="0123456789ABCDEF"[e&15],b.s+=d.join("")}a++}}function K(b,c){var a,e=0;for(a=0;a<c;++a)if("<"==b[a]){c=a;break}for(;0<c;)if(-1!="?!.,".indexOf(b[c-1]))c--;else if(";"==b[c-1]){for(a=c-2;0<a&&/[A-Za-z]/.test(b[a]);)a--;a<c-2&&"&"==b[a]?c=a:c--}else break;if(0==c)return 0;a=b[c-1];switch(a){case '"':e='"';break;case "'":e="'";break;case ")":e="(";break;case "]":e="[";break;case "}":e="{"}if(0!=
-e){for(var d=0,f=0,g=0;g<c;)b[g]==e?f++:b[g]==a&&d++,g++;d!=f&&c--}return c}function ga(b){var c,a=0;if(!s(b[0]))return 0;for(c=1;c<b.length-1;++c)if("."==b[c])a++;else if(!s(b[c])&&"-"!=b[c])break;return a?c:0}function L(b){var c="http://,https://,ftp://,mailto://,/,git://,steam://,irc://,news://,mumble://,ssh://,ircs://,#".split(","),a;for(a=0;a<c.length;++a){var e=c[a].length;if(b.length>e&&0==b.toLowerCase().indexOf(c[a])&&/[A-Za-z0-9#\/?]/.test(b[e]))return 1}return 0}function Ba(){return{nofollow:0,
-target:null,tocData:{headerCount:0,currentLevel:0},flags:M|N|D|O|z,link_attributes:function(b,c,a){a.nofollow&&(b.s+=' rel="nofollow"');null!=a.target&&(b.s+=' target="'+a.target+'"')}}}function p(b){this.s=b||""}function E(){this.spanStack=[];this.blockStack=[];this.extensions=P|Q|R|S|T;this.context=Ba();this.inLinkBody=0;this.activeChars={};for(var b=0;256>b;b++)this.activeChars[String.fromCharCode(b)]=0;this.refs={}}function x(b){var c;for(c=0;c<b.length&&"\n"!=b[c];c++)if(" "!=b[c])return 0;return c+
-1}function U(b){var c=0,a=0,e;if(3>b.length)return 0;" "==b[0]&&(c++," "==b[1]&&(c++," "==b[2]&&c++));if(c+2>=b.length||"*"!=b[c]&&"-"!=b[c]&&"_"!=b[c])return 0;for(e=b[c];c<b.length&&"\n"!=b[c];){if(b[c]==e)a++;else if(" "!=b[c])return 0;c++}return 3<=a}function ha(b,c){var a=0,e=0,d;if(3>b.length)return 0;" "==b[0]&&(a++," "==b[1]&&(a++," "==b[2]&&a++));if(a+2>=b.length||!("~"==b[a]||"`"==b[a]))return 0;for(d=b[a];a<b.length&&b[a]==d;)e++,a++;if(3>e)return 0;if(c){for(d=0;a<b.length&&" "==b[a];)a++;
-e=a;if(a<size&&"{"==b[a]){a++;for(e++;a<b.length&&"}"!=b[a]&&"\n"!=b[a];)d++,a++;if(a==size||"}"!=b[a])return 0;for(;0<d&&t(b[e+0]);)e++,d--;for(;0<d&&t(b[e+d-1]);)d--;a++}else for(;a<b.length&&!t(b[a]);)d++,a++;c.s=b.substr(e,d)}for(;a<b.length&&"\n"!=b[a];){if(!t(b[a]))return 0;a++}return a+1}function V(b,c){for(var a=1;a<b.length;){for(;a<b.length&&b[a]!=c&&"`"!=b[a]&&"["!=b[a];)a++;if(a==b.length)break;if(b[a]==c)return a;if(a&&"\\"==b[a-1])a++;else if("`"==b[a]){for(var e=0,d,f=0;a<b.length&&
-"`"==b[a];)a++,e++;if(a>=b.length)break;for(d=0;a<b.length&&d<e;)!f&&b[a]==c&&(f=a),"`"==b[a]?d++:d=0,a++;if(a>=b.length)return f}else if("["==b[a]){f=0;for(a++;a<b.length&&"]"!=b[a];)!f&&b[a]==c&&(f=a),a++;for(a++;a<b.length&&(" "==b[a]||"\n"==b[a]);)a++;if(a>=b.length)return f;switch(b[a]){case "[":e="]";break;case "(":e=")";break;default:if(f)return f;continue}for(a++;a<b.length&&b[a]!=e;)!f&&b[a]==c&&(f=a),a++;if(a>=b.length)return f;a++}}return 0}function ia(b,c,a,e){var d=a.slice(1),a=0,f;if(!c.callbacks.emphasis)return 0;
-for(1<d.length&&d[0]==e&&d[1]==e&&(a=1);a<d.length;){f=V(d.slice(a),e);if(!f)break;a+=f;if(a>=d.length)break;if(d[a]==e&&!t(d[a-1])&&(!(c.extensions&P&&"_"==e)||a+1==d.length||t(d[a+1])||ca(d[a+1])))return e=new p,c.spanStack.push(e),y(e,c,d.slice(0,a)),b=c.callbacks.emphasis(b,e,c.context),c.spanStack.pop(),b?a+1:0}return 0}function ja(b,c,a,e){var d=a.slice(2),a=0,f,g="~"==e?c.callbacks.strikethrough:c.callbacks.double_emphasis;if(!g)return 0;for(;a<d.length;){f=V(d.slice(a),e);if(!f)break;a+=f;
-if(a+1<d.length&&d[a]==e&&d[a+1]==e&&a&&!t(d[a-1]))return e=new p,c.spanStack.push(e),y(e,c,d.slice(0,a)),b=g(b,e,c.context),c.spanStack.pop(),b?a+2:0;a++}return 0}function ka(b,c){if("#"!=c[0])return!1;if(b.extensions&la){for(var a=0;a<c.length&&6>a&&"#"==c[a];)a++;if(a<c.length&&" "!=c[a])return!1}return!0}function ma(b){var c=0,a=b.length;if("="==b[c]){for(c=1;c<a&&"="==b[c];c++);for(;c<a&&" "==b[c];)c++;return c>=a||"\n"==b[c]?1:0}if("-"==b[c]){for(c=1;c<a&&"-"==b[c];c++);for(;c<a&&" "==b[c];)c++;
-return c>=a||"\n"==b[c]?2:0}return 0}function na(b){for(var c=b.length,a=0;a<c&&"\n"!=b[a];)a++;return++a>=c?0:ma(b.slice(a))}function F(b){var c=0,a=b.length;c<a&&" "==b[c]&&c++;c<a&&" "==b[c]&&c++;c<a&&" "==b[c]&&c++;return c<a&&">"==b[c]?c+1<a&&" "==b[c+1]?c+2:c+1:0}function oa(b){return 3<b.length&&" "==b[0]&&" "==b[1]&&" "==b[2]&&" "==b[3]?4:0}function W(b){var c=b.length,a=0;a<c&&" "==b[a]&&a++;a<c&&" "==b[a]&&a++;a<c&&" "==b[a]&&a++;if(a>=c||"0">b[a]||"9"<b[a])return 0;for(;a<c&&"0"<=b[a]&&
-"9">=b[a];)a++;return a+1>=c||"."!=b[a]||" "!=b[a+1]||na(b.slice(a))?0:a+2}function X(b){var c=b.length,a=0;a<c&&" "==b[a]&&a++;a<c&&" "==b[a]&&a++;a<c&&" "==b[a]&&a++;return a+1>=c||"*"!=b[a]&&"+"!=b[a]&&"-"!=b[a]||" "!=b[a+1]||na(b.slice(a))?0:a+2}function Ca(b,c){var a,e;if(3>b.length||"<"!=b[0])return 0;a="/"==b[1]?2:1;if(!s(b[a]))return 0;for(c.p=A;a<b.length&&(s(b[a])||"."==b[a]||"+"==b[a]||"-"==b[a]);)a++;if(1<a&&"@"==b[a]){a:{e=b.slice(a);for(var d=0,f=0,d=0;d<e.length;++d)if(!s(e[d]))switch(e[d]){case "@":f++;
-case "-":case ".":case "_":break;case ">":e=1==f?d+1:0;break a;default:e=0;break a}e=0}if(0!=e)return c.p=G,a+e}2<a&&":"==b[a]&&(c.p=H,a++);if(a>=b.length)c.p=A;else if(c.p){for(e=a;a<b.length;)if("\\"==b[a])a+=2;else if(">"==b[a]||"'"==b[a]||'"'==b[a]||" "==b[a]||"\n"==b[a])break;else a++;if(a>=b.length)return 0;if(a>e&&">"==b[a])return a+1;c.p=A}for(;a<b.length&&">"!=b[a];)a++;return a>=b.length?0:a+1}function y(b,c,a){var e=0,d=0,f=0,g=new p;if(!(c.spanStack.length+c.blockStack.length>c.nestingLimit))for(;e<
-a.length;){for(;d<a.length&&0==(f=c.activeChars[a[d]]);)d++;c.callbacks.normal_text?(g.s=a.slice(e,d),c.callbacks.normal_text(b,g,c.context)):b.s+=a.slice(e,d);if(d>=a.length)break;e=d;d=(d=Da[f](b,c,a,e))?e+=d:e+1}}function pa(b,c,a,e){var d,f=0,g=null,j,k=new p(a);if(2>a.length||"<"!=a[0])return 0;for(d=1;d<a.length&&">"!=a[d]&&" "!=a[d];)d++;d<a.length&&(d=a.slice(1),g=-1!="p,dl,div,math,table,ul,del,form,blockquote,figure,ol,fieldset,h1,h6,pre,script,h5,noscript,style,iframe,h4,ins,h3,h2".split(",").indexOf(d.toLowerCase())?
-d.toLowerCase():"");if(!g){if(5<a.length&&"!"==a[1]&&"-"==a[2]&&"-"==a[3]){for(d=5;d<a.length&&!("-"==a[d-2]&&"-"==a[d-1]&&">"==a[d]);)d++;d++;d<size&&(f=x(a.slice(d)));if(f)return k.s=a.slice(0,d+f),e&&c.callbacks.blockhtml&&c.callbacks.blockhtml(b,k,c.context),k.s.length}if(4<a.length&&("h"==a[1]||"H"==a[1])&&("r"==a[2]||"R"==a[2])){for(d=3;d<a.length&&">"!=a[d];)d++;if(d+1<a.length&&(d++,f=x(a.slice(d))))return k.s=a.slice(0,d+f),e&&c.callbacks.blockhtml&&c.callbacks.blockhtml(b,k,c.context),k.s.length}return 0}d=
-1;j=0;if("ins"!=g&&"del"!=g){g=g.length;for(d=1;d<a.length;){for(d++;d<a.length&&!("<"==a[d-1]&&"/"==a[d]);)d++;if(d+2+g>=a.length)break;a:{var f=tag,h=c,i=a.slice(d-1),l=void 0,m=void 0;if(f.length+3>=i.length||i.slice(2).toLowerCase()!=f||">"!=i[f.length+2])f=0;else if(l=f.length+3,m=0,l<i.length&&0==(m=x(i.slice(l))))f=0;else{l+=m;m=0;if(h.extensions&Y)l<i.length&&(m=x(i.slice(l)));else if(l<i.length&&0==(m=x(i.slice(l)))){f=0;break a}f=l+m}}if(f){d+=f-1;j=1;break}}}if(!j)return 0;k.s=k.s.slice(0,
-d);e&&c.callbacks.blockhtml&&c.callbacks.blockhtml(b,k,c.context);return d}function qa(b,c,a,e){var d=a.length,f=0,g,j=null;for(c.blockStack.push(j=new p);f<d;){e={p:e};g=j;for(var k=c,h=a.slice(f),i=e,l=h.length,m=null,o=null,v=0,n=void 0,u=void 0,r=0,t=0,q=void 0,s=0,w=0,z=void 0,A=void 0;3>t&&t<l&&" "==h[t];)t++;(v=X(h))||(v=W(h));if(v){for(n=v;n<l&&"\n"!=h[n-1];)n++;k.spanStack.push(m=new p);k.spanStack.push(o=new p);m.s+=h.slice(v,n);for(v=n;v<l;){for(n++;n<l&&"\n"!=h[n-1];)n++;if(x(h.slice(v,
-n)))s=1;else{for(q=0;4>q&&v+q<n&&" "==h[v+q];)q++;u=q;z=X(h.slice(v+q,n));A=W(h.slice(v+q,n));if(s&&(i.p&C&&z||!(i.p&C)&&A)){i.p|=Z;break}if(z&&!U(h.slice(v+q,n))||A){s&&(w=1);if(u==t)break;r||(r=m.s.length)}else if(s&&4>q){i.p|=Z;break}else s&&(m.s+="\n",w=1);s=0;m.s+=h.slice(v+q,n)}v=n}w&&(i.p|=ra);i.p&ra?r&&r<m.s.length?(B(o,k,m.s.slice(0,r)),B(o,k,m.s.slice(r))):B(o,k,m.s):r&&r<m.s.length?(y(o,k,m.s.slice(0,r)),B(o,k,m.s.slice(r))):y(o,k,m.s);k.callbacks.listitem&&k.callbacks.listitem(g,o,i.p,
-k.context);k.spanStack.pop();k.spanStack.pop();g=v}else g=0;e=e.p;f+=g;if(!g||e&Z)break}c.callbacks.list&&c.callbacks.list(b,j,e,c.context);c.blockStack.pop();return f}function sa(b,c,a,e,d){var f=0,g,j=null;if(c.callbacks.table_cell&&c.callbacks.table_row){c.spanStack.push(j=new p);f<a.length&&"|"==a[f]&&f++;for(g=0;g<e.length&&f<a.length;++g){var k,h,i;for(c.spanStack.push(i=new p);f<a.length&&t(a[f]);)f++;for(k=f;f<a.length&&"|"!=a[f];)f++;for(h=f-1;h>k&&t(a[h]);)h--;y(i,c,a.slice(k,1+h));c.callbacks.table_cell(j,
-i,e[g]|d,c.context);c.spanStack.pop();f++}for(;g<e.length;++g)c.callbacks.table_cell(j,null,e[g]|d,c.context);c.callbacks.table_row(b,j,c.context);c.spanStack.pop()}}function B(b,c,a){var e=0,d,f;if(!(c.spanStack.length+c.blockStack.length>c.nestingLimit))for(;e<a.length;)if(f=a.slice(e),ka(c,f)){for(var g=b,j=c,k=0,h=void 0,i=void 0,l=void 0;k<f.length&&6>k&&"#"==f[k];)k++;for(h=k;h<f.length&&" "==f[h];h++);for(i=h;i<f.length&&"\n"!=f[i];i++);for(l=i;i&&"#"==f[i-1];)i--;for(;i&&" "==f[i-1];)i--;
-if(i>h){var m=new p;j.spanStack.push(m);y(m,j,f.slice(h,i));j.callbacks.header&&j.callbacks.header(g,m,k,j.context);j.spanStack.pop()}e+=l}else if("<"==a[e]&&c.callbacks.blockhtml&&0!=(d=pa(b,c,f,1)))e+=d;else if(0!=(d=x(f)))e+=d;else if(U(f)){for(c.callbacks.hrule&&c.callbacks.hrule(b,c.context);e<a.length&&"\n"!=a[e];)e++;e++}else{if(g=0!=(c.extensions&ta)){d=b;g=c;j=f;l=i=void 0;k=null;h=new p;i=ha(j,h);if(0==i)d=0;else{k=new p;for(g.blockStack.push(k);i<j.length;){l=ha(j.slice(i),null);if(0!=
-l){i+=l;break}for(l=i+1;l<j.length&&"\n"!=j[l-1];l++);i<l&&(i=j.slice(i,l),k.s=x(i)?k.s+"\n":k.s+i);i=l}k.s.length&&"\n"!=k.s[k.s.length-1]&&(k.s+="\n");g.callbacks.blockcode&&g.callbacks.blockcode(d,k,h.s.length?h:null,g.context);g.blockStack.pop();d=i}g=0!=d}if(g)e+=d;else{if(g=0!=(c.extensions&T)){d=b;g=c;j=f;h=k=l=void 0;i={p:null};g.spanStack.push(k=new p);g.blockStack.push(h=new p);for(var l=k,m=g,o=j,q=i,n=0,u=void 0,r=u=void 0,r=0;n<o.length&&"\n"!=o[n];)"|"==o[n++]&&r++;if(n==o.length||0==
-r)l=0;else{for(u=n;0<u&&t(o[u-1]);)u--;"|"==o[0]&&r--;u&&"|"==o[u-1]&&r--;q.p=Array(r+1);for(u=0;u<q.p.length;u++)q.p[u]=0;n++;n<o.length&&"|"==o[n]&&n++;for(r=n;r<o.length&&"\n"!=o[r];)r++;for(u=0;u<q.p.length&&n<r;++u){for(var s=0;n<r&&" "==o[n];)n++;":"==o[n]&&(n++,q.p[u]|=ua,s++);for(;n<r&&"-"==o[n];)n++,s++;n<r&&":"==o[n]&&(n++,q.p[u]|=va,s++);for(;n<r&&" "==o[n];)n++;if(n<r&&"|"!=o[n])break;if(1>s)break;n++}u<q.p.length?l=0:(sa(l,m,o,q.p,$),l=r+1)}if(0<l){for(;l<j.length;){o=0;for(m=l;l<j.length&&
-"\n"!=j[l];)"|"==j[l++]&&o++;if(0==o||l==j.length){l=m;break}sa(h,g,j.slice(m,l),i.p,0);l++}g.callbacks.table&&g.callbacks.table(d,k,h,g.context)}g.spanStack.pop();g.blockStack.pop();g=0!=(d=l)}if(g)e+=d;else if(F(f)){g=b;j=c;k=f.length;h=void 0;i=0;l=void 0;m="";o=new p;j.blockStack.push(o);for(h=0;h<k;){for(i=h+1;i<k&&"\n"!=f[i-1];i++);if(l=F(f.slice(h,i)))h+=l;else if(x(f.slice(h,i))&&(i>=k||0==F(f.slice(i))&&!x(f.slice(i))))break;h<i&&(m+=f.slice(h,i));h=i}B(o,j,m);j.callbacks.blockquote&&j.callbacks.blockquote(g,
-o,j.context);j.blockStack.pop();e+=i}else if(oa(f)){g=b;j=c;h=f;i=h.length;m=l=f=void 0;k=null;j.blockStack.push(k=new p);for(f=0;f<i;){for(l=f+1;l<i&&"\n"!=h[l-1];l++);if(m=oa(h.slice(f,l)))f+=m;else if(!x(h.slice(f,l)))break;f<l&&(k.s=x(h.slice(f,l))?k.s+"\n":k.s+h.slice(f,l));f=l}for(h=k.s.length;h&&"\n"==k.s[h-1];)h-=1;k.s=k.s.slice(0,h);k.s+="\n";j.callbacks.blockcode&&j.callbacks.blockcode(g,k,null,j.context);j.blockStack.pop();e+=f}else if(X(f))e+=qa(b,c,f,0);else if(W(f))e+=qa(b,c,f,C);else{g=
-b;j=c;i=f;k=f=l=0;m=i.length;for(h=new p(i);l<m;){for(f=l+1;f<m&&"\n"!=i[f-1];f++);if(0!=F(i.slice(l,f))){f=l;break}o=i.slice(l);if(x(o)||0!=(k=ma(o)))break;if(j.extensions&Y&&"<"==i[l]&&j.callbacks.blockhtml&&pa(g,j,o,null)){f=l;break}if(ka(j,o)||U(o)){f=l;break}l=f}for(m=l;m&&"\n"==i[m-1];)m--;h.s=h.s.slice(0,m);if(k){l=null;if(h.size){o=void 0;for(l=h.s.length;m&&"\n"!=i[m];)m-=1;for(o=m+1;m&&"\n"==i[m-1];)m-=1;h.s=h.s.slice(0,m);0<m?(i=new p,j.blockStack.push(i),y(i,j,h.s),j.callbacks.paragraph&&
-j.callbacks.paragraph(g,i,j.context),j.blockStack.pop(),h.s=h.s.slice(o,l)):h.s=h.s.slice(0,l)}l=new p;j.spanStack.push(l);y(l,j,h.s);j.callbacks.header&&j.callbacks.header(g,l,k,j.context);j.spanStack.pop()}else i=new p,j.blockStack.push(i),y(i,j,h.s),j.callbacks.paragraph&&j.callbacks.paragraph(g,i,j.context),j.blockStack.pop();e+=f}}}}function Ea(b,c,a,e){var d=0,f,g,j,k,h,i;if(c+3>=a||" "==b[c]&&(d=1," "==b[c+1]&&(d=2," "==b[c+2]&&(d=3," "==b[c+3]))))return 0;d+=c;if("["!=b[d])return 0;d++;for(f=
-d;d<a&&"\n"!=b[d]&&"\r"!=b[d]&&"]"!=b[d];)d++;if(d>=a||"]"!=b[d])return 0;g=d;d++;if(d>=a||":"!=b[d])return 0;for(d++;d<a&&" "==b[d];)d++;if(d<a&&("\n"==b[d]||"\r"==b[d]))d++,d<a&&"\r"==b[d]&&"\n"==b[d-1]&&d++;for(;d<a&&" "==b[d];)d++;if(d>=a)return 0;"<"==b[d]&&d++;for(j=d;d<a&&" "!=b[d]&&"\n"!=b[d]&&"\r"!=b[d];)d++;for(k=">"==b[d-1]?d-1:d;d<a&&" "==b[d];)d++;if(d<a&&"\n"!=b[d]&&"\r"!=b[d]&&"'"!=b[d]&&'"'!=b[d]&&"("!=b[d])return 0;i=0;if(d>=a||"\r"==b[d]||"\n"==b[d])i=d;d+1<a&&"\n"==b[d]&&"\r"==
-b[d+1]&&(i=d+1);if(i)for(d=i+1;d<a&&" "==b[d];)d++;c=h=0;if(d+1<a&&("'"==b[d]||'"'==b[d]||"("==b[d])){d++;for(c=d;d<a&&"\n"!=b[d]&&"\r"!=b[d];)d++;h=d+1<a&&"\n"==b[d]&&"\r"==b[d+1]?d+1:d;for(d-=1;d>c&&" "==b[d];)d-=1;if(d>c&&("'"==b[d]||'"'==b[d]||")"==b[d]))i=h,h=d}if(!i||k==j)return 0;a=b.slice(f,g);d=b.slice(j,k);j=null;h>c&&(j=b.slice(c,h));e.refs[a]={id:a,link:new p(d),title:new p(j)};return i}var ea=[7,7,7,7,7,7,7,7,7,0,0,7,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,1,0,0,0,2,3,0,0,0,0,0,0,
-0,4,0,0,0,0,0,0,0,0,0,0,0,0,5,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Aa=",&quot;,&amp;,&#39;,&#47;,&lt;,&gt;,".split(","),fa=[2,2,2,2,2,2,2,2,2,0,0,2,
-2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],aa={blockcode:function(b,
-c,a){b.s.length&&(b.s+="\n");if(a&&a.s.length){var e,d;b.s+='<pre><code class="';for(d=e=0;e<a.s.length;++e,++d){for(;e<a.s.length&&/\s/.test(a.s[e]);)e++;if(e<a.s.length){for(var f=e;e<a.s.length&&!/\s/.test(a.s[e]);)e++;"."==a.s[f]&&f++;d&&(b.s+=" ");w(b,a.s.slice(f,e),!1)}}b.s+='">'}else b.s+="<pre><code>";c&&w(b,c.s,!1);b.s+="</code></pre>\n"},blockquote:function(b,c){b.s.length&&(b.s+="\n");b.s+="<blockquote>\n";c&&(b.s+=c.s);b.s+="</blockquote>\n"},blockhtml:function(b,c){var a,e;if(c){for(e=
-c.s.length;0<e&&"\n"==c.s[e-1];)e--;for(a=0;a<e&&"\n"==c.s[a];)a++;a>=e||(b.s.length&&(b.s+="\n"),b.s+=c.s.slice(a,e),b.s+="\n")}},header:function(b,c,a,e){b.s.length&&(b.s+="\n");b.s=e.flags&wa?b.s+("<h"+ +a+'id="toc_'+e.tocData.headerCount++ +'">'):b.s+("<h"+ +a+">");c&&(b.s+=c.s);b.s+="</h"+ +a+">\n"},hrule:function(b,c){b.s.length&&(b.s+="\n");b.s+=c.flags&z?"<hr/>\n":"<hr>\n"},list:function(b,c,a){b.s.length&&(b.s+="\n");b.s+=a&C?"<ol>\n":"<ul>\n";c&&(b.s+=c.s);b.s+=a&C?"</ol>\n":"</ul>\n"},
-listitem:function(b,c){b.s+="<li>";if(c){for(var a=c.s.length;a&&"\n"==c.s[a-1];)a--;b.s+=c.s.slice(0,a)}b.s+="</li>\n"},paragraph:function(b,c,a){var e=0;b.s.length&&(b.s+="\n");if(c&&c.s.length){for(;e<c.s.length&&/\s/.test(c.s[e]);)e++;if(e!=c.s.length){b.s+="<p>";if(a.flags&xa)for(var d;e<c.s.length;){for(d=e;e<c.s.length&&"\n"!=c.data[e];)e++;e>d&&(b.s+=c.s.slice(d,e));if(e>=c.s.length-1)break;aa.linebreak(b,a);e++}else b.s+=c.s.slice(e);b.s+="</p>\n"}}},table:function(b,c,a){b.s.length&&(b.s+=
-"\n");b.s+="<table><thead>\n";c&&(b.s+=c.s);b.s+="</thead><tbody>\n";a&&(b.s+=a.s);b.s+="</tbody></table>\n"},table_row:function(b,c){b.s+="<tr>\n";c&&(b.s+=c.s);b.s+="</tr>\n"},table_cell:function(b,c,a){b.s=a&$?b.s+"<th":b.s+"<td";switch(a&Fa){case Ga:b.s+=' align="center">';break;case ua:b.s+=' align="left">';break;case va:b.s+=' align="right">';break;default:b.s+=">"}c&&(b.s+=c.s);b.s=a&$?b.s+"</th>\n":b.s+"</td>\n"},autolink:function(b,c,a,e){if(!c||!c.s.length||0!=(e.flags&D)&&!L(c.s)&&a!=G)return 0;
-b.s+='<a href="';a==G&&(b.s+="mailto:");J(b,c.s.slice(0));e.link_attributes?(b.s+='"',e.link_attributes(b,c,e),b.s+=">"):b.s+='">';0==c.s.indexOf("mailto:")?w(b,c.s.slice(7),!1):w(b,c.s,!1);b.s+="</a>";return 1},codespan:function(b,c){b.s+="<code>";c&&w(b,c.s,!1);b.s+="</code>";return 1},double_emphasis:function(b,c){if(!c||!c.s.length)return 0;b.s+="<strong>"+c.s+"</strong>";return 1},emphasis:function(b,c){if(!c||!c.s.length)return 0;b.s+="<em>"+c.s+"</em>";return 1},image:function(b,c,a,e,d){if(!c||
-!c.s.length)return 0;b.s+='<img src="';J(b,c.s);b.s+='" alt="';e&&e.s.length&&w(b,e.s,!1);a&&a.s.length&&(b.s+='" title="',w(b,a.s,!1));b.s+=d.flags&z?'"/>':'">';return 1},linebreak:function(b,c){b.s+=c.flags&z?"<br/>\n":"<br>\n";return 1},link:function(b,c,a,e,d){if(null!=c&&0!=(d.flags&D)&&!L(c.s))return 0;b.s+='<a href="';c&&c.s.length&&J(b,c.s);a&&a.s.length&&(b.s+='" title="',w(b,a.s,!1));d.link_attributes?(b.s+='"',d.link_attributes(b,c,d),b.s+=">"):b.s+='">';e&&e.s.length&&(b.s+=e.s);b.s+=
-"</a>";return 1},raw_html_tag:function(b,c,a){if(0!=(a.flags&O))return w(b,text.s,!1),1;if(0!=(a.flags&M)||0!=(a.flags&ya)&&I(text.s,"style")||0!=(a.flags&za)&&I(text.s,"a")||0!=(a.flags&N)&&I(text.s,"img"))return 1;b.s+=text.s;return 1},triple_emphasis:function(b,c){if(!c||!c.s.length)return 0;b.s+="<strong><em>"+c.s+"</em></strong>";return 1},strikethrough:function(b,c){if(!c||!c.s.length)return 0;b.s+="<del>"+c.s+"</del>";return 1},superscript:function(b,c){if(!c||!c.s.length)return 0;b.s+="<sup>"+
-c.s+"</sup>";return 1},entity:null,normal_text:function(b,c){c&&w(b,c.s,!1)},doc_header:null,doc_footer:null},Da=[null,function(b,c,a,e){var a=a.slice(e),e=a[0],d;if(2<a.length&&a[1]!=e)c="~"==e||t(a[1])||0==(d=ia(b,c,a,e))?0:d+1;else if(3<a.length&&a[1]==e&&a[2]!=e)c=t(a[2])||0==(d=ja(b,c,a,e))?0:d+2;else if(4<a.length&&a[1]==e&&a[2]==e&&a[3]!=e){var f;if(!(f="~"==e))if(!(f=t(a[3]))){a:{f=a.slice(3);d=0;for(var g;d<f.length;){g=V(f.slice(d),e);if(!g)break;d+=g;if(!(f[d]!=e||t(f[d-1]))){if(d+2<f.length&&
-f[d+1]==e&&f[d+2]==e&&c.callbacks.triple_emphasis){a=new p;c.spanStack.push(a);y(a,c,f.slice(0,d));b=c.callbacks.triple_emphasis(b,a,c.context);c.spanStack.pop();c=b?d+3:0;break a}if(d+1<f.length&&f[d+1]==e){if(g=ia(b,c,a.slice(1),e)){c=g-2;break a}}else if(g=ja(b,c,f.slice(2),e)){c=g-1;break a}break}}c=0}f=0==(d=c)}c=f?0:d+3}else c=0;return c},function(b,c,a,e){for(var e=a.slice(e),d=0,f,g;d<e.length&&"`"==e[d];)d++;f=0;for(a=d;a<e.length&&f<d;a++)"`"==e[a]?f++:f=0;if(f<d&&a>=e.length)return 0;for(f=
-d;f<a&&" "==e[f];)f++;for(g=a-d;g>d&&" "==e[g-1];)g--;f<g?(e=new p(e.slice(f,g)),c.callbacks.codespan(b,e,c.context)||(a=0)):c.callbacks.codespan(b,null,c.context)||(a=0);return a},function(b,c,a,e){a.slice(e);if(2>e||" "!=a[e-1]||" "!=a[e-2])return 0;b.s=b.s.trimRight();return c.callbacks.linebreak(b,c.context)?1:0},function(b,c,a,e){function d(){c.spanStack.length=q;return u?g:0}var a=a.slice(e),e=e&&"!"==a[e-1],f,g=1,j=0,k=0,h=0,i=0,l=null,m=null,o=null;f=null;var q=c.spanStack.length,n=0,u=0,
-r=0,s=0;if(e&&!c.callbacks.image||!e&&!c.callbacks.link)return d();for(f=1;g<a.length;g++)if("\n"==a[g])n=1;else if("\\"!=a[g-1])if("["==a[g])f++;else if("]"==a[g]&&(f--,0>=f))break;if(g>=a.length)return d();f=g;for(g++;g<a.length&&t(a[g]);)g++;if(g<a.length&&"("==a[g]){for(g++;g<a.length&&t(a[g]);)g++;for(j=g;g<a.length;)if("\\"==a[g])g+=2;else if(")"==a[g])break;else if(1<=g&&t(a[g-1])&&("'"==a[g]||'"'==a[g]))break;else g++;if(g>=a.length)return d();k=g;if("'"==a[g]||'"'==a[g]){s=a[g];r=1;g++;for(h=
-g;g<a.length;)if("\\"==a[g])g+=2;else if(a[g]==s)r=0,g++;else if(")"==a[g]&&!r)break;else g++;if(g>=a.length)return d();for(i=g-1;i>h&&t(a[i]);)i--;"'"!=a[i]&&'"'!=a[i]&&(h=i=0,k=g)}for(;k>j&&t(a[k-1]);)k--;"<"==a[j]&&j++;">"==a[k-1]&&k--;k>j&&(m=new p,c.spanStack.push(m),m.s+=a.slice(j,k));i>h&&(o=new p,c.spanStack.push(o),o.s+=a.slice(h,i));g++}else if(g<a.length&&"["==a[g]){m=new p;h=null;g++;for(j=g;g<a.length&&"]"!=a[g];)g++;if(g>=a.length)return d();k=g;if(j==k)if(n){n=new p;c.spanStack.push(n);
-for(h=1;h<f;h++)"\n"!=a[h]?n.s+=a[h]:" "!=a[h-1]&&(n.s+=" ");m.s=n.s}else m.s=a.slice(1);else m.s=a.slice(j,k);h=c.refs[m.s];if(!h)return d();m=h.link;o=h.title;g++}else{m=new p;h=null;if(n){n=new p;c.spanStack.push(n);for(h=1;h<f;h++)"\n"!=a[h]?n.s+=a[h]:" "!=a[h-1]&&(n.s+=" ");m.s=n.s}else m.s=a.slice(1,f);h=c.refs[m.s];if(!h)return d();m=h.link;o=h.title;g=f+1}1<f&&(l=new p,c.spanStack.push(l),e?l.s+=a.slice(1,f):(c.inLinkBody=1,y(l,c,a.slice(1,f)),c.inLinkBody=0));if(m)f=new p,c.spanStack.push(f),
-da(f,m);else return d();e?(b.s.length&&"!"==b.s[b.s.length-1]&&(b.s=b.s.slice(0,-1)),u=c.callbacks.image(b,f,o,l,c.context)):u=c.callbacks.link(b,f,o,l,c.context);return d()},function(b,c,a,e){var a=a.slice(e),e={p:A},d=Ca(a,e),f=new p(a.slice(0,d)),g=0;2<d&&(c.callbacks.autolink&&e.p!=A?(g=new p,c.spanStack.push(g),f.s=a.slice(1,d-2),da(g,f),g=c.callbacks.autolink(b,g,e.p,c.context),c.spanStack.pop()):c.callbacks.raw_html_tag&&(g=c.callbacks.raw_html_tag(b,f,c.context)));return g?d:0},function(b,
-c,a,e){a=a.slice(e);e=new p;if(1<a.length){if(-1=="\\`*_{}[]()#+-.!:|&<>/^~".indexOf(a[1]))return 0;c.callbacks.normal_text?(e.s=a[1],c.callbacks.normal_text(b,e,c.context)):b.s+=a[1]}else 1==a.length&&(b.s+=a[0]);return 2},function(b,c,a,e){var a=a.slice(e),e=1,d=new p;for(e<a.length&&"#"==a[e]&&e++;e<a.length&&s(a[e]);)e++;if(e<a.length&&";"==a[e])e++;else return 0;c.callbacks.entity?(d.s=a.slice(0,e),c.callbacks.entity(b,d,c.context)):b.s+=a.slice(0,e);return e},function(b,c,a,e){var d=a.slice(e),
-f=null,g=null;if(!c.callbacks.autolink||c.inLinkBody)return 0;f=new p;c.spanStack.push(f);var j=f,d=d.length,k=a.slice(e),h,i=0,l;if(4>d||"/"!=a[e+1]||"/"!=a[e+2])a=0;else{for(;i<e&&/[A-Za-z]/.test(a[e-i-1]);)i++;if(L(a.slice(e-i,d+i)))if(h=3,l=ga(k.slice(h)),0==l)a=0;else{for(h+=l;h<d&&!/\s/.test(a[e+h]);)h++;h=K(k,h);0==h?a=0:(j.s+=a.substr(e-i,h+i),g=i,a=h)}else a=0}0<a&&(0<g&&(b.s=b.s.slice(0,-g)),c.callbacks.autolink(b,f,H,c.context));c.spanStack.pop();return a},function(b,c,a,e){var d=a.slice(e),
-f=null,g=null;if(!c.callbacks.autolink||c.inLinkBody)return 0;f=new p;c.spanStack.push(f);var j=f,d=d.length,k=a.slice(e),h,i,l=0,m=0;for(i=0;i<e;++i){var o=a[e-i-1];if(!s(o)&&-1==".+-_".indexOf(o))break}if(0==i)a=0;else{for(h=0;h<d;++h)if(o=a[e+h],!s(o))if("@"==o)l++;else if("."==o&&h<d-1)m++;else if("-"!=o&&"_"!=o)break;2>h||1!=l||0==m?a=0:(h=K(k,h),0==h?a=0:(j.s+=a.substr(e-i,h+i),g=i,a=h))}0<a&&(0<g&&(b.s=b.s.slice(0,-g)),c.callbacks.autolink(b,f,G,c.context));c.spanStack.pop();return a},function(b,
-c,a,e){var d=a.slice(e),f=null,g=null,j=null,j=null;if(!c.callbacks.link||c.inLinkBody)return 0;f=new p;c.spanStack.push(f);var g=f,d=d.length,k=a.slice(e);if(0<e&&!ca(a[e-1])&&!/\s/.test(a[e-1]))a=0;else if(4>d||"www."!=k.slice(0,4))a=0;else if(a=ga(k),0==a)a=0;else{for(;a<d&&!/\s/.test(k[a]);)a++;a=K(k,a);0==a?a=0:(g.s+=k.slice(0,a),j=0)}0<a&&(g=new p,c.spanStack.push(g),g.s+="http://",g.s+=f.s,0<j&&(b.s=b.s.slice(0,b.s.length-j)),c.callbacks.normal_text?(j=new p,c.spanStack.push(j),c.callbacks.normal_text(j,
-f,c.context),c.callbacks.link(b,g,null,j,c.context),c.spanStack.pop()):c.callbacks.link(b,g,null,f,c.context),c.spanStack.pop());c.spanStack.pop();return a},function(b,c,a,e){var d=a.slice(e),f=null,g,j=null;if(!c.callbacks.autolink||c.inLinkBody)return 0;f=new p;c.spanStack.push(f);g=f;var k=d.length,h=a.slice(e),i;if(3>k)g=0;else if(0!=h.indexOf("/r/"))g=0;else if(i=3,s(h[i])){for(i+=1;i<k&&(s(h[i])||"_"==h[i]||"+"==h[i]);)i++;g.s+=h.slice(0,i);j=0;g=i}else g=0;if(0<g)0<j&&(b.s=b.s.slice(0,-j)),
-c.callbacks.autolink(b,f,H,c.context);else{g=f;d=d.length;a=a.slice(e);if(6>d)a=0;else if(0!=a.indexOf("/u/"))a=0;else if(e=3,!s(a[e])&&"_"!=a[e]&&"-"!=a[e])a=0;else{for(e+=1;e<d&&(s(a[e])||"_"==a[e]||"-"==a[e]);)e++;g.s+=a.slice(0,e);j=0;a=e}if(0<(g=a))0<j&&(b.s=b.s.slice(0,-j)),c.callbacks.autolink(b,f,H,c.context)}c.spanStack.pop();return g},function(b,c,a,e){var a=a.slice(e),e=a.length,d,f,g=null;if(!c.callbacks.superscript||2>e)return 0;if("("==a[1]){for(d=f=2;f<e&&")"!=a[f]&&"\\"!=a[f-1];)f++;
-if(f==e)return 0}else for(d=f=1;f<e&&!t(a[f]);)f++;if(0==f-d)return 2==d?3:0;g=new p;c.spanStack.push(g);y(g,c,a.slice(d,f));c.callbacks.superscript(b,g,c.context);c.spanStack.pop();return 2==d?f+1:f}],C=1,ra=2,Z=8,q=0;q++;var ba=q++,Ha=q++,Ia=q++,Ja=q++,Ka=q++,La=q++,Ma=q++,Na=q++,Oa=q++,Pa=q++,Qa=q++,Ra=q++,q=0,A=q++,H=q++,G=q++,P=1,T=2,ta=4,R=8,S=16,Y=32,la=64,Q=128,M=1,ya=2,N=4,za=8,D=32,wa=64,xa=128,z=256,O=512,ua=1,va=2,Ga=3,Fa=3,$=4;E.prototype.callbacks=aa;E.prototype.nestingLimit=16;E.prototype.render=
-function(b){var c=new p,a=0,e;for(this.refs={};a<b.length;){if(!(e=Ea(b,a,b.length,this))){for(e=a;e<b.length&&"\n"!=b[e]&&"\r"!=b[e];)e++;if(e>a)for(var d=c,a=b.slice(a,e),f=0,g=0;f<a.length;){for(var j=f;f<a.length&&"\t"!=a[f];)f++,g++;f>j&&(d.s+=a.slice(j,f));if(f>=a.length)break;do d.s+=" ",g++;while(g%4);f++}for(;e<b.length&&("\n"==b[e]||"\r"==b[e]);){if("\n"==b[e]||e+1<b.length&&"\n"!=b[e+1])c.s+="\n";e++}}a=e}b=new p;this.callbacks.doc_header&&this.callbacks.doc_header(b,this.context);c.s.length&&
-("\n"!=c.s[c.s.length-1]&&"\r"!=c.s[c.s.length-1]&&(c.s+="\n"),B(b,this,c.s));this.callbacks.doc_footer&&this.callbacks.doc_footer(b,this.context);return b.s};SnuOwnd.defaultCallbacks=aa;SnuOwnd.getParser=function(b,c,a,e){var d=new E;b&&(d.callbacks=b);a&&(d.nestingLimit=a);e&&(d.context=e);void 0!=c&&null!=c&&(d.extensions=c);b=d.callbacks;if(b.emphasis||b.double_emphasis||b.triple_emphasis)d.activeChars["*"]=ba,d.activeChars._=ba,d.extensions&S&&(d.activeChars["~"]=ba);b.codespan&&(d.activeChars["`"]=
-Ha);b.linebreak&&(d.activeChars["\n"]=Ia);if(b.image||b.link)d.activeChars["["]=Ja;d.activeChars["<"]=Ka;d.activeChars["\\"]=La;d.activeChars["&"]=Ma;d.extensions&R&&(d.activeChars[":"]=Na,d.activeChars["@"]=Oa,d.activeChars.w=Pa,d.activeChars["/"]=Qa);d.extensions&Q&&(d.activeChars["^"]=Ra);return d};SnuOwnd.HTML_SKIP_HTML=M;SnuOwnd.HTML_SKIP_STYLE=ya;SnuOwnd.HTML_SKIP_IMAGES=N;SnuOwnd.HTML_SKIP_LINKS=za;SnuOwnd.HTML_EXPAND_TABS=16;SnuOwnd.HTML_SAFELINK=D;SnuOwnd.HTML_TOC=wa;SnuOwnd.HTML_HARD_WRAP=
-xa;SnuOwnd.HTML_USE_XHTML=z;SnuOwnd.HTML_ESCAPE=O;SnuOwnd.MKDEXT_NO_INTRA_EMPHASIS=P;SnuOwnd.MKDEXT_TABLES=T;SnuOwnd.MKDEXT_FENCED_CODE=ta;SnuOwnd.MKDEXT_AUTOLINK=R;SnuOwnd.MKDEXT_STRIKETHROUGH=S;SnuOwnd.MKDEXT_LAX_HTML_BLOCKS=Y;SnuOwnd.MKDEXT_SPACE_HEADERS=la;SnuOwnd.MKDEXT_SUPERSCRIPT=Q})();
+(function(){function _isspace(c){return c==" "||c=="\n"}function isspace(c){return/\s/.test(c)}function isalnum(c){return/[A-Za-z0-9]/.test(c)}function isalpha(c){return/[A-Za-z]/.test(c)}function ispunct(c){return/[\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]/.test(c)}function find_block_tag(str){var wordList=["p","dl","div","math","table","ul","del","form","blockquote","figure","ol","fieldset","h1","h6","pre","script","h5","noscript","style","iframe","h4","ins","h3","h2"];if(wordList.indexOf(str.toLowerCase())!=-1)return str.toLowerCase();
+return""}function sdhtml_is_tag(tag_data,tagname){var i;var closed=0;var tag_size=tag_data.length;if(tag_size<3||tag_data[0]!="<")return HTML_TAG_NONE;i=1;if(tag_data[i]=="/"){closed=1;i++}var tagname_c=0;for(;i<tag_size;++i,++tagname_c){if(tagname_c>=tagname.length)break;if(tag_data[i]!=tagname[tagname_c])return HTML_TAG_NONE}if(i==tag_size)return HTML_TAG_NONE;if(isspace(tag_data[i])||tag_data[i]==">")return closed?HTML_TAG_CLOSE:HTML_TAG_OPEN;return HTML_TAG_NONE}function unscape_text(out,src){var i=
+0,org;while(i<src.s.length){org=i;while(i<src.s.length&&src.s[i]!="\\")i++;if(i>org)out.s+=src.s.slice(org,i);if(i+1>=src.s.length)break;out.s+=src.s[i+1];i+=2}}var HTML_ESCAPE_TABLE=[7,7,7,7,7,7,7,7,7,0,0,7,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,1,0,0,0,2,3,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,5,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var HTML_ESCAPES=["","&quot;","&amp;","&#39;","&#47;","&lt;","&gt;",""];function escape_html(out,src,secure){var i=0,org,esc=0;while(i<src.length){org=i;while(i<src.length&&!(esc=HTML_ESCAPE_TABLE[src.charCodeAt(i)]))i++;if(i>org)out.s+=src.slice(org,i);if(i>=src.length)break;if(src[i]=="/"&&!secure)out.s+=
+"/";else if(HTML_ESCAPE_TABLE[src.charCodeAt(i)]==7);else out.s+=HTML_ESCAPES[esc];i++}}var HREF_SAFE=[2,2,2,2,2,2,2,2,2,0,0,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function escape_href(out,src){var hex_chars="0123456789ABCDEF";var i=0,org;var hex_str=["$","",""];while(i<src.length){org=i;while(i<src.length&&HREF_SAFE[src.charCodeAt(i)]!=0)i++;if(i>org)out.s+=src.slice(org,i);if(i>=src.length)break;if(HREF_SAFE[src.charCodeAt(i)]==2){i++;continue}switch(src[i]){case "&":out.s+="&amp;";break;case "'":out.s+="&#x27;";break;default:var cc=src.charCodeAt(i);
+hex_str[1]=hex_chars[cc>>4&15];hex_str[2]=hex_chars[cc&15];out.s+=hex_str.join("")}i++}}function autolink_delim(data,link_end){var cclose,copen=0;var i;for(i=0;i<link_end;++i)if(data[i]=="<"){link_end=i;break}while(link_end>0)if("?!.,".indexOf(data[link_end-1])!=-1)link_end--;else if(data[link_end-1]==";"){var new_end=link_end-2;while(new_end>0&&isalpha(data[new_end]))new_end--;if(new_end<link_end-2&&data[new_end]=="&")link_end=new_end;else link_end--}else break;if(link_end==0)return 0;cclose=data[link_end-
+1];switch(cclose){case '"':copen='"';break;case "'":copen="'";break;case ")":copen="(";break;case "]":copen="[";break;case "}":copen="{";break}if(copen!=0){var closing=0;var opening=0;var j=0;while(j<link_end){if(data[j]==copen)opening++;else if(data[j]==cclose)closing++;j++}if(closing!=opening)link_end--}return link_end}function check_domain(data){var i,np=0;if(!isalnum(data[0]))return 0;for(i=1;i<data.length-1;++i)if(data[i]==".")np++;else if(!isalnum(data[i])&&data[i]!="-")break;return np?i:0}
+function sd_autolink_issafe(link){var valid_uris=["http://","https://","ftp://","mailto://","/","git://","steam://","irc://","news://","mumble://","ssh://","ircs://","#"];var i;for(i=0;i<valid_uris.length;++i){var len=valid_uris[i].length;if(link.length>len&&link.toLowerCase().indexOf(valid_uris[i])==0&&/[A-Za-z0-9#\/?]/.test(link[len]))return 1}return 0}function sd_autolink__url(rewind_p,link,data_,offset,size){var data=data_.slice(offset);var link_end,rewind=0,domain_len;if(size<4||data_[offset+
+1]!="/"||data_[offset+2]!="/")return 0;while(rewind<offset&&isalpha(data_[offset-rewind-1]))rewind++;if(!sd_autolink_issafe(data_.slice(offset-rewind,size+rewind)))return 0;link_end="://".length;domain_len=check_domain(data.slice(link_end));if(domain_len==0)return 0;link_end+=domain_len;while(link_end<size&&!isspace(data_[offset+link_end]))link_end++;link_end=autolink_delim(data,link_end);if(link_end==0)return 0;link.s+=data_.substr(offset-rewind,link_end+rewind);rewind_p.p=rewind;return link_end}
+function sd_autolink__subreddit(rewind_p,link,data_,offset,size){var data=data_.slice(offset);var link_end;if(size<3)return 0;if(data.indexOf("/r/")!=0)return 0;link_end="/r/".length;if(!isalnum(data[link_end]))return 0;link_end+=1;while(link_end<size&&(isalnum(data[link_end])||data[link_end]=="_"||data[link_end]=="+"))link_end++;link.s+=data.slice(0,link_end);rewind_p.p=0;return link_end}function sd_autolink__username(rewind_p,link,data_,offset,size){var data=data_.slice(offset);var link_end;if(size<
+6)return 0;if(data.indexOf("/u/")!=0)return 0;link_end="/u/".length;if(!isalnum(data[link_end])&&data[link_end]!="_"&&data[link_end]!="-")return 0;link_end+=1;while(link_end<size&&(isalnum(data[link_end])||data[link_end]=="_"||data[link_end]=="-"))link_end++;link.s+=data.slice(0,link_end);rewind_p.p=0;return link_end}function sd_autolink__email(rewind_p,link,data_,offset,size){var data=data_.slice(offset);var link_end,rewind;var nb=0,np=0;for(rewind=0;rewind<offset;++rewind){var c=data_[offset-rewind-
+1];if(isalnum(c))continue;if(".+-_".indexOf(c)!=-1)continue;break}if(rewind==0)return 0;for(link_end=0;link_end<size;++link_end){var c=data_[offset+link_end];if(isalnum(c))continue;if(c=="@")nb++;else if(c=="."&&link_end<size-1)np++;else if(c!="-"&&c!="_")break}if(link_end<2||nb!=1||np==0)return 0;link_end=autolink_delim(data,link_end);if(link_end==0)return 0;link.s+=data_.substr(offset-rewind,link_end+rewind);rewind_p.p=rewind;return link_end}function sd_autolink__www(rewind_p,link,data_,offset,
+size){var data=data_.slice(offset);var link_end;if(offset>0&&!ispunct(data_[offset-1])&&!isspace(data_[offset-1]))return 0;if(size<4||data.slice(0,4)!="www.")return 0;link_end=check_domain(data);if(link_end==0)return 0;while(link_end<size&&!isspace(data[link_end]))link_end++;link_end=autolink_delim(data,link_end);if(link_end==0)return 0;link.s+=data.slice(0,link_end);rewind_p.p=0;return link_end}function getDefaultRenderOptions(){return{nofollow:0,target:null,tocData:{headerCount:0,currentLevel:0},
+flags:HTML_SKIP_HTML|HTML_SKIP_IMAGES|HTML_SAFELINK|HTML_ESCAPE|HTML_USE_XHTML,link_attributes:function link_attributes(out,url,options){if(options.nofollow)out.s+=' rel="nofollow"';if(options.target!=null)out.s+=' target="'+options.target+'"'}}}var defaultCallbacks={blockcode:function blockcode(out,text,lang,options){if(out.s.length)out.s+="\n";if(lang&&lang.s.length){var i,cls;out.s+='<pre><code class="';for(i=0,cls=0;i<lang.s.length;++i,++cls){while(i<lang.s.length&&isspace(lang.s[i]))i++;if(i<
+lang.s.length){var org=i;while(i<lang.s.length&&!isspace(lang.s[i]))i++;if(lang.s[org]==".")org++;if(cls)out.s+=" ";escape_html(out,lang.s.slice(org,i),false)}}out.s+='">'}else out.s+="<pre><code>";if(text)escape_html(out,text.s,false);out.s+="</code></pre>\n"},blockquote:function blockquote(out,text,lang,options){if(out.s.length)out.s+="\n";out.s+="<blockquote>\n";if(text)out.s+=text.s;out.s+="</blockquote>\n"},blockhtml:function blockhtml(out,text,options){var org,sz;if(!text)return;sz=text.s.length;
+while(sz>0&&text.s[sz-1]=="\n")sz--;org=0;while(org<sz&&text.s[org]=="\n")org++;if(org>=sz)return;if(out.s.length)out.s+="\n";out.s+=text.s.slice(org,sz);out.s+="\n"},header:function header(out,text,level,options){if(out.s.length)out.s+="\n";if(options.flags&HTML_TOC)out.s+="<h"+ +level+'id="toc_'+options.tocData.headerCount++ +'">';else out.s+="<h"+ +level+">";if(text)out.s+=text.s;out.s+="</h"+ +level+">\n"},hrule:function hrule(out,options){if(out.s.length)out.s+="\n";out.s+=options.flags&HTML_USE_XHTML?
+"<hr/>\n":"<hr>\n"},list:function list(out,text,flags,options){if(out.s.length)out.s+="\n";out.s+=flags&MKD_LIST_ORDERED?"<ol>\n":"<ul>\n";if(text)out.s+=text.s;out.s+=flags&MKD_LIST_ORDERED?"</ol>\n":"</ul>\n"},listitem:function listitem(out,text,flags,options){out.s+="<li>";if(text){var size=text.s.length;while(size&&text.s[size-1]=="\n")size--;out.s+=text.s.slice(0,size)}out.s+="</li>\n"},paragraph:function paragraph(out,text,options){var i=0;if(out.s.length)out.s+="\n";if(!text||!text.s.length)return;
+while(i<text.s.length&&isspace(text.s[i]))i++;if(i==text.s.length)return;out.s+="<p>";if(options.flags&HTML_HARD_WRAP){var org;while(i<text.s.length){org=i;while(i<text.s.length&&text.data[i]!="\n")i++;if(i>org)out.s+=text.s.slice(org,i);if(i>=text.s.length-1)break;defaultCallbacks.linebreak(out,options);i++}}else out.s+=text.s.slice(i);out.s+="</p>\n"},table:function table(out,header,body,options){if(out.s.length)out.s+="\n";out.s+="<table><thead>\n";if(header)out.s+=header.s;out.s+="</thead><tbody>\n";
+if(body)out.s+=body.s;out.s+="</tbody></table>\n"},table_row:function table_row(out,text,options){out.s+="<tr>\n";if(text)out.s+=text.s;out.s+="</tr>\n"},table_cell:function table_cell(out,text,flags,options){if(flags&MKD_TABLE_HEADER)out.s+="<th";else out.s+="<td";switch(flags&MKD_TABLE_ALIGNMASK){case MKD_TABLE_ALIGN_CENTER:out.s+=' align="center">';break;case MKD_TABLE_ALIGN_L:out.s+=' align="left">';break;case MKD_TABLE_ALIGN_R:out.s+=' align="right">';break;default:out.s+=">"}if(text)out.s+=
+text.s;if(flags&MKD_TABLE_HEADER)out.s+="</th>\n";else out.s+="</td>\n"},autolink:function autolink(out,link,type,options){var offset=0;if(!link||!link.s.length)return 0;if((options.flags&HTML_SAFELINK)!=0&&!sd_autolink_issafe(link.s)&&type!=MKDA_EMAIL)return 0;out.s+='<a href="';if(type==MKDA_EMAIL)out.s+="mailto:";escape_href(out,link.s.slice(offset));if(options.link_attributes){out.s+='"';options.link_attributes(out,link,options);out.s+=">"}else out.s+='">';if(link.s.indexOf("mailto:")==0)escape_html(out,
+link.s.slice(7),false);else escape_html(out,link.s,false);out.s+="</a>";return 1},codespan:function codespan(out,text,options){out.s+="<code>";if(text)escape_html(out,text.s,false);out.s+="</code>";return 1},double_emphasis:function double_emphasis(out,text,options){if(!text||!text.s.length)return 0;out.s+="<strong>"+text.s+"</strong>";return 1},emphasis:function emphasis(out,text,options){if(!text||!text.s.length)return 0;out.s+="<em>"+text.s+"</em>";return 1},image:function image(out,link,title,
+alt,options){if(!link||!link.s.length)return 0;out.s+='<img src="';escape_href(out,link.s);out.s+='" alt="';if(alt&&alt.s.length)escape_html(out,alt.s,false);if(title&&title.s.length){out.s+='" title="';escape_html(out,title.s,false)}out.s+=options.flags&HTML_USE_XHTML?'"/>':'">';return 1},linebreak:function linebreak(out,options){out.s+=options.flags&HTML_USE_XHTML?"<br/>\n":"<br>\n";return 1},link:function link(out,link,title,content,options){if(link!=null&&(options.flags&HTML_SAFELINK)!=0&&!sd_autolink_issafe(link.s))return 0;
+out.s+='<a href="';if(link&&link.s.length)escape_href(out,link.s);if(title&&title.s.length){out.s+='" title="';escape_html(out,title.s,false)}if(options.link_attributes){out.s+='"';options.link_attributes(out,link,options);out.s+=">"}else out.s+='">';if(content&&content.s.length)out.s+=content.s;out.s+="</a>";return 1},raw_html_tag:function raw_html_tag(out,tag,options){if((options.flags&HTML_ESCAPE)!=0){escape_html(out,text.s,false);return 1}if((options.flags&HTML_SKIP_HTML)!=0)return 1;if((options.flags&
+HTML_SKIP_STYLE)!=0&&sdhtml_is_tag(text.s,"style"))return 1;if((options.flags&HTML_SKIP_LINKS)!=0&&sdhtml_is_tag(text.s,"a"))return 1;if((options.flags&HTML_SKIP_IMAGES)!=0&&sdhtml_is_tag(text.s,"img"))return 1;out.s+=text.s;return 1},triple_emphasis:function triple_emphasis(out,text,options){if(!text||!text.s.length)return 0;out.s+="<strong><em>"+text.s+"</em></strong>";return 1},strikethrough:function strikethrough(out,text,options){if(!text||!text.s.length)return 0;out.s+="<del>"+text.s+"</del>";
+return 1},superscript:function superscript(out,text,options){if(!text||!text.s.length)return 0;out.s+="<sup>"+text.s+"</sup>";return 1},entity:null,normal_text:function normal_text(out,text,options){if(text)escape_html(out,text.s,false)},doc_header:null,doc_footer:null};function char_emphasis(out,md,data_,offset){var data=data_.slice(offset);var size=data.length;var c=data[0];var ret;if(size>2&&data[1]!=c){if(c=="~"||_isspace(data[1])||(ret=parse_emph1(out,md,data,c))==0)return 0;return ret+1}if(data.length>
+3&&data[1]==c&&data[2]!=c){if(_isspace(data[2])||(ret=parse_emph2(out,md,data,c))==0)return 0;return ret+2}if(data.length>4&&data[1]==c&&data[2]==c&&data[3]!=c){if(c=="~"||_isspace(data[3])||(ret=parse_emph3(out,md,data,c))==0)return 0;return ret+3}return 0}function char_codespan(out,md,data_,offset){var data=data_.slice(offset);var end,nb=0,i,f_begin,f_end;while(nb<data.length&&data[nb]=="`")nb++;i=0;for(end=nb;end<data.length&&i<nb;end++)if(data[end]=="`")i++;else i=0;if(i<nb&&end>=data.length)return 0;
+f_begin=nb;while(f_begin<end&&data[f_begin]==" ")f_begin++;f_end=end-nb;while(f_end>nb&&data[f_end-1]==" ")f_end--;if(f_begin<f_end){var work=new Buffer(data.slice(f_begin,f_end));if(!md.callbacks.codespan(out,work,md.context))end=0}else if(!md.callbacks.codespan(out,null,md.context))end=0;return end}function char_linebreak(out,md,data_,offset){var data=data_.slice(offset);if(offset<2||data_[offset-1]!=" "||data_[offset-2]!=" ")return 0;out.s=out.s.trimRight();return md.callbacks.linebreak(out,md.context)?
+1:0}function char_link(out,md,data_,offset){var data=data_.slice(offset);var is_img=offset&&data[offset-1]=="!",level;var i=1,txt_e,link_b=0,link_e=0,title_b=0,title_e=0;var content=null;var link=null;var title=null;var u_link=null;var org_work_size=md.spanStack.length;var text_has_nl=0,ret=0;var in_title=0,qtype=0;function cleanup(){md.spanStack.length=org_work_size;return ret?i:0}if(is_img&&!md.callbacks.image||!is_img&&!md.callbacks.link)return cleanup();for(level=1;i<data.length;i++)if(data[i]==
+"\n")text_has_nl=1;else if(data[i-1]=="\\")continue;else if(data[i]=="[")level++;else if(data[i]=="]"){level--;if(level<=0)break}if(i>=data.length)return cleanup();txt_e=i;i++;while(i<data.length&&_isspace(data[i]))i++;if(i<data.length&&data[i]=="("){i++;while(i<data.length&&_isspace(data[i]))i++;link_b=i;while(i<data.length)if(data[i]=="\\")i+=2;else if(data[i]==")")break;else if(i>=1&&_isspace(data[i-1])&&(data[i]=="'"||data[i]=='"'))break;else i++;if(i>=data.length)return cleanup();link_e=i;if(data[i]==
+"'"||data[i]=='"'){qtype=data[i];in_title=1;i++;title_b=i;while(i<data.length)if(data[i]=="\\")i+=2;else if(data[i]==qtype){in_title=0;i++}else if(data[i]==")"&&!in_title)break;else i++;if(i>=data.length)return cleanup();title_e=i-1;while(title_e>title_b&&_isspace(data[title_e]))title_e--;if(data[title_e]!="'"&&data[title_e]!='"'){title_b=title_e=0;link_e=i}}while(link_e>link_b&&_isspace(data[link_e-1]))link_e--;if(data[link_b]=="<")link_b++;if(data[link_e-1]==">")link_e--;if(link_e>link_b){link=
+new Buffer;md.spanStack.push(link);link.s+=data.slice(link_b,link_e)}if(title_e>title_b){title=new Buffer;md.spanStack.push(title);title.s+=data.slice(title_b,title_e)}i++}else if(i<data.length&&data[i]=="["){var id=new Buffer;var lr=null;i++;link_b=i;while(i<data.length&&data[i]!="]")i++;if(i>=data.length)return cleanup();link_e=i;if(link_b==link_e)if(text_has_nl){var b=new Buffer;md.spanStack.push(b);var j;for(j=1;j<txt_e;j++)if(data[j]!="\n")b.s+=data[j];else if(data[j-1]!=" ")b.s+=" ";id.s=b.s}else id.s=
+data.slice(1);else id.s=data.slice(link_b,link_e);lr=md.refs[id.s];if(!lr)return cleanup();link=lr.link;title=lr.title;i++}else{var id=new Buffer;var lr=null;if(text_has_nl){var b=new Buffer;md.spanStack.push(b);var j;for(j=1;j<txt_e;j++)if(data[j]!="\n")b.s+=data[j];else if(data[j-1]!=" ")b.s+=" ";id.s=b.s}else id.s=data.slice(1,txt_e);lr=md.refs[id.s];if(!lr)return cleanup();link=lr.link;title=lr.title;i=txt_e+1}if(txt_e>1){content=new Buffer;md.spanStack.push(content);if(is_img)content.s+=data.slice(1,
+txt_e);else{md.inLinkBody=1;parse_inline(content,md,data.slice(1,txt_e));md.inLinkBody=0}}if(link){u_link=new Buffer;md.spanStack.push(u_link);unscape_text(u_link,link)}else return cleanup();if(is_img){if(out.s.length&&out.s[out.s.length-1]=="!")out.s=out.s.slice(0,-1);ret=md.callbacks.image(out,u_link,title,content,md.context)}else ret=md.callbacks.link(out,u_link,title,content,md.context);return cleanup()}function char_langle_tag(out,md,data_,offset){var data=data_.slice(offset);var altype={p:MKDA_NOT_AUTOLINK};
+var end=tag_length(data,altype);var work=new Buffer(data.slice(0,end));var ret=0;if(end>2)if(md.callbacks.autolink&&altype.p!=MKDA_NOT_AUTOLINK){var u_link=new Buffer;md.spanStack.push(u_link);work.s=data.slice(1,end-2);unscape_text(u_link,work);ret=md.callbacks.autolink(out,u_link,altype.p,md.context);md.spanStack.pop()}else if(md.callbacks.raw_html_tag)ret=md.callbacks.raw_html_tag(out,work,md.context);if(!ret)return 0;else return end}function char_escape(out,md,data_,offset){var data=data_.slice(offset);
+var escape_chars="\\`*_{}[]()#+-.!:|&<>/^~";var work=new Buffer;if(data.length>1){if(escape_chars.indexOf(data[1])==-1)return 0;if(md.callbacks.normal_text){work.s=data[1];md.callbacks.normal_text(out,work,md.context)}else out.s+=data[1]}else if(data.length==1)out.s+=data[0];return 2}function char_entity(out,md,data_,offset){var data=data_.slice(offset);var end=1;var work=new Buffer;if(end<data.length&&data[end]=="#")end++;while(end<data.length&&isalnum(data[end]))end++;if(end<data.length&&data[end]==
+";")end++;else return 0;if(md.callbacks.entity){work.s=data.slice(0,end);md.callbacks.entity(out,work,md.context)}else out.s+=data.slice(0,end);return end}function char_autolink_url(out,md,data_,offset){var data=data_.slice(offset);var link=null;var link_len,rewind={p:null};if(!md.callbacks.autolink||md.inLinkBody)return 0;link=new Buffer;md.spanStack.push(link);if((link_len=sd_autolink__url(rewind,link,data_,offset,data.length))>0){if(rewind.p>0)out.s=out.s.slice(0,-rewind.p);md.callbacks.autolink(out,
+link,MKDA_NORMAL,md.context)}md.spanStack.pop();return link_len}function char_autolink_email(out,md,data_,offset){var data=data_.slice(offset);var link=null;var link_len,rewind={p:null};if(!md.callbacks.autolink||md.inLinkBody)return 0;link=new Buffer;md.spanStack.push(link);if((link_len=sd_autolink__email(rewind,link,data_,offset,data.length))>0){if(rewind.p>0)out.s=out.s.slice(0,-rewind.p);md.callbacks.autolink(out,link,MKDA_EMAIL,md.context)}md.spanStack.pop();return link_len}function char_autolink_www(out,
+md,data_,offset){var data=data_.slice(offset);var link=null,link_url=null,link_text=null;var link_len,rewind={p:null};if(!md.callbacks.link||md.inLinkBody)return 0;link=new Buffer;md.spanStack.push(link);if((link_len=sd_autolink__www(rewind,link,data_,offset,data.length))>0){link_url=new Buffer;md.spanStack.push(link_url);link_url.s+="http://";link_url.s+=link.s;if(rewind.p>0)out.s=out.s.slice(0,out.s.length-rewind.p);if(md.callbacks.normal_text){link_text=new Buffer;md.spanStack.push(link_text);
+md.callbacks.normal_text(link_text,link,md.context);md.callbacks.link(out,link_url,null,link_text,md.context);md.spanStack.pop()}else md.callbacks.link(out,link_url,null,link,md.context);md.spanStack.pop()}md.spanStack.pop();return link_len}function char_autolink_subreddit_or_username(out,md,data_,offset){var data=data_.slice(offset);var link=null;var link_len,rewind={p:null};if(!md.callbacks.autolink||md.inLinkBody)return 0;link=new Buffer;md.spanStack.push(link);if((link_len=sd_autolink__subreddit(rewind,
+link,data_,offset,data.length))>0){if(rewind.p>0)out.s=out.s.slice(0,-rewind.p);md.callbacks.autolink(out,link,MKDA_NORMAL,md.context)}else if((link_len=sd_autolink__username(rewind,link,data_,offset,data.length))>0){if(rewind.p>0)out.s=out.s.slice(0,-rewind.p);md.callbacks.autolink(out,link,MKDA_NORMAL,md.context)}md.spanStack.pop();return link_len}function char_superscript(out,md,data_,offset){var data=data_.slice(offset);var size=data.length;var sup_start,sup_len;var sup=null;if(!md.callbacks.superscript)return 0;
+if(size<2)return 0;if(data[1]=="("){sup_start=sup_len=2;while(sup_len<size&&data[sup_len]!=")"&&data[sup_len-1]!="\\")sup_len++;if(sup_len==size)return 0}else{sup_start=sup_len=1;while(sup_len<size&&!_isspace(data[sup_len]))sup_len++}if(sup_len-sup_start==0)return sup_start==2?3:0;sup=new Buffer;md.spanStack.push(sup);parse_inline(sup,md,data.slice(sup_start,sup_len));md.callbacks.superscript(out,sup,md.context);md.spanStack.pop();return sup_start==2?sup_len+1:sup_len}var markdown_char_ptrs=[null,
+char_emphasis,char_codespan,char_linebreak,char_link,char_langle_tag,char_escape,char_entity,char_autolink_url,char_autolink_email,char_autolink_www,char_autolink_subreddit_or_username,char_superscript];var MKD_LIST_ORDERED=1;var MKD_LI_BLOCK=2;var MKD_LI_END=8;var enumCounter=0;var MD_CHAR_NONE=enumCounter++;var MD_CHAR_EMPHASIS=enumCounter++;var MD_CHAR_CODESPAN=enumCounter++;var MD_CHAR_LINEBREAK=enumCounter++;var MD_CHAR_LINK=enumCounter++;var MD_CHAR_LANGLE=enumCounter++;var MD_CHAR_ESCAPE=enumCounter++;
+var MD_CHAR_ENTITITY=enumCounter++;var MD_CHAR_AUTOLINK_URL=enumCounter++;var MD_CHAR_AUTOLINK_EMAIL=enumCounter++;var MD_CHAR_AUTOLINK_WWW=enumCounter++;var MD_CHAR_AUTOLINK_SUBREDDIT_OR_USERNAME=enumCounter++;var MD_CHAR_SUPERSCRIPT=enumCounter++;enumCounter=0;var MKDA_NOT_AUTOLINK=enumCounter++;var MKDA_NORMAL=enumCounter++;var MKDA_EMAIL=enumCounter++;var MKDEXT_NO_INTRA_EMPHASIS=1<<0;var MKDEXT_TABLES=1<<1;var MKDEXT_FENCED_CODE=1<<2;var MKDEXT_AUTOLINK=1<<3;var MKDEXT_STRIKETHROUGH=1<<4;var MKDEXT_LAX_HTML_BLOCKS=
+1<<5;var MKDEXT_SPACE_HEADERS=1<<6;var MKDEXT_SUPERSCRIPT=1<<7;var HTML_SKIP_HTML=1<<0;var HTML_SKIP_STYLE=1<<1;var HTML_SKIP_IMAGES=1<<2;var HTML_SKIP_LINKS=1<<3;var HTML_EXPAND_TABS=1<<4;var HTML_SAFELINK=1<<5;var HTML_TOC=1<<6;var HTML_HARD_WRAP=1<<7;var HTML_USE_XHTML=1<<8;var HTML_ESCAPE=1<<9;var MKD_TABLE_ALIGN_L=1;var MKD_TABLE_ALIGN_R=2;var MKD_TABLE_ALIGN_CENTER=3;var MKD_TABLE_ALIGNMASK=3;var MKD_TABLE_HEADER=4;function Buffer(str){this.s=str||""}function Markdown(){this.spanStack=[];this.blockStack=
+[];this.extensions=MKDEXT_NO_INTRA_EMPHASIS|MKDEXT_SUPERSCRIPT|MKDEXT_AUTOLINK|MKDEXT_STRIKETHROUGH|MKDEXT_TABLES;this.context=getDefaultRenderOptions();this.inLinkBody=0;this.activeChars={};this.refs={}}Markdown.prototype.callbacks=defaultCallbacks;Markdown.prototype.nestingLimit=16;function is_empty(data){var i;for(i=0;i<data.length&&data[i]!="\n";i++)if(data[i]!=" ")return 0;return i+1}function is_hrule(data){var i=0,n=0;var c;if(data.length<3)return 0;if(data[0]==" "){i++;if(data[1]==" "){i++;
+if(data[2]==" ")i++}}if(i+2>=data.length||data[i]!="*"&&data[i]!="-"&&data[i]!="_")return 0;c=data[i];while(i<data.length&&data[i]!="\n"){if(data[i]==c)n++;else if(data[i]!=" ")return 0;i++}return n>=3}function is_codefence(data,syntax){var i=0,n=0;var c;if(data.length<3)return 0;if(data[0]==" "){i++;if(data[1]==" "){i++;if(data[2]==" ")i++}}if(i+2>=data.length||!(data[i]=="~"||data[i]=="`"))return 0;c=data[i];while(i<data.length&&data[i]==c){n++;i++}if(n<3)return 0;if(syntax){var syn_cursor;var syn=
+0;while(i<data.length&&data[i]==" ")i++;syn_cursor=i;if(i<size&&data[i]=="{"){i++;syn_cursor++;while(i<data.length&&data[i]!="}"&&data[i]!="\n"){syn++;i++}if(i==size||data[i]!="}")return 0;while(syn>0&&_isspace(data[syn_cursor+0])){syn_cursor++;syn--}while(syn>0&&_isspace(data[syn_cursor+syn-1]))syn--;i++}else while(i<data.length&&!_isspace(data[i])){syn++;i++}syntax.s=data.substr(syn_cursor,syn)}while(i<data.length&&data[i]!="\n"){if(!_isspace(data[i]))return 0;i++}return i+1}function find_emph_char(data,
+c){var i=1;while(i<data.length){while(i<data.length&&data[i]!=c&&data[i]!="`"&&data[i]!="[")i++;if(i==data.length)return 0;if(data[i]==c)return i;if(i&&data[i-1]=="\\"){i++;continue}if(data[i]=="`"){var span_nb=0,bt;var tmp_i=0;while(i<data.length&&data[i]=="`"){i++;span_nb++}if(i>=data.length)return 0;bt=0;while(i<data.length&&bt<span_nb){if(!tmp_i&&data[i]==c)tmp_i=i;if(data[i]=="`")bt++;else bt=0;i++}if(i>=data.length)return tmp_i}else if(data[i]=="["){var tmp_i=0;var cc;i++;while(i<data.length&&
+data[i]!="]"){if(!tmp_i&&data[i]==c)tmp_i=i;i++}i++;while(i<data.length&&(data[i]==" "||data[i]=="\n"))i++;if(i>=data.length)return tmp_i;switch(data[i]){case "[":cc="]";break;case "(":cc=")";break;default:if(tmp_i)return tmp_i;else continue}i++;while(i<data.length&&data[i]!=cc){if(!tmp_i&&data[i]==c)tmp_i=i;i++}if(i>=data.length)return tmp_i;i++}}return 0}function parse_emph1(out,md,data_,c){var data=data_.slice(1);var i=0,len;var r;if(!md.callbacks.emphasis)return 0;if(data.length>1&&data[0]==c&&
+data[1]==c)i=1;while(i<data.length){len=find_emph_char(data.slice(i),c);if(!len)return 0;i+=len;if(i>=data.length)return 0;if(data[i]==c&&!_isspace(data[i-1])){if(md.extensions&MKDEXT_NO_INTRA_EMPHASIS&&c=="_")if(!(i+1==data.length||_isspace(data[i+1])||ispunct(data[i+1])))continue;var work=new Buffer;md.spanStack.push(work);parse_inline(work,md,data.slice(0,i));r=md.callbacks.emphasis(out,work,md.context);md.spanStack.pop();return r?i+1:0}}return 0}function parse_emph2(out,md,data_,c){var data=data_.slice(2);
+var i=0,len;var r;var render_method=c=="~"?md.callbacks.strikethrough:md.callbacks.double_emphasis;if(!render_method)return 0;while(i<data.length){len=find_emph_char(data.slice(i),c);if(!len)return 0;i+=len;if(i+1<data.length&&data[i]==c&&data[i+1]==c&&i&&!_isspace(data[i-1])){var work=new Buffer;md.spanStack.push(work);parse_inline(work,md,data.slice(0,i));r=render_method(out,work,md.context);md.spanStack.pop();return r?i+2:0}i++}return 0}function parse_emph3(out,md,data_,c){var data=data_.slice(3);
+var i=0,len;var r;while(i<data.length){len=find_emph_char(data.slice(i),c);if(!len)return 0;i+=len;if(data[i]!=c||_isspace(data[i-1]))continue;if(i+2<data.length&&data[i+1]==c&&data[i+2]==c&&md.callbacks.triple_emphasis){var work=new Buffer;md.spanStack.push(work);parse_inline(work,md,data.slice(0,i));r=md.callbacks.triple_emphasis(out,work,md.context);md.spanStack.pop();return r?i+3:0}else if(i+1<data.length&&data[i+1]==c){len=parse_emph1(out,md,data_.slice(1),c);if(!len)return 0;else return len-
+2}else{len=parse_emph2(out,md,data.slice(2),c);if(!len)return 0;else return len-1}}return 0}function is_atxheader(md,data){if(data[0]!="#")return false;if(md.extensions&MKDEXT_SPACE_HEADERS){var level=0;while(level<data.length&&level<6&&data[level]=="#")level++;if(level<data.length&&data[level]!=" ")return false}return true}function is_headerline(data){var i=0;var size=data.length;if(data[i]=="="){for(i=1;i<size&&data[i]=="=";i++);while(i<size&&data[i]==" ")i++;return i>=size||data[i]=="\n"?1:0}if(data[i]==
+"-"){for(i=1;i<size&&data[i]=="-";i++);while(i<size&&data[i]==" ")i++;return i>=size||data[i]=="\n"?2:0}return 0}function is_next_headerline(data){var size=data.length;var i=0;while(i<size&&data[i]!="\n")i++;if(++i>=size)return 0;return is_headerline(data.slice(i))}function prefix_quote(data){var i=0;var size=data.length;if(i<size&&data[i]==" ")i++;if(i<size&&data[i]==" ")i++;if(i<size&&data[i]==" ")i++;if(i<size&&data[i]==">"){if(i+1<size&&data[i+1]==" ")return i+2;return i+1}return 0}function prefix_code(data){if(data.length>
+3&&data[0]==" "&&data[1]==" "&&data[2]==" "&&data[3]==" ")return 4;return 0}function prefix_oli(data){var size=data.length;var i=0;if(i<size&&data[i]==" ")i++;if(i<size&&data[i]==" ")i++;if(i<size&&data[i]==" ")i++;if(i>=size||data[i]<"0"||data[i]>"9")return 0;while(i<size&&data[i]>="0"&&data[i]<="9")i++;if(i+1>=size||data[i]!="."||data[i+1]!=" ")return 0;if(is_next_headerline(data.slice(i)))return 0;return i+2}function prefix_uli(data){var size=data.length;var i=0;if(i<size&&data[i]==" ")i++;if(i<
+size&&data[i]==" ")i++;if(i<size&&data[i]==" ")i++;if(i+1>=size||data[i]!="*"&&data[i]!="+"&&data[i]!="-"||data[i+1]!=" ")return 0;if(is_next_headerline(data.slice(i)))return 0;return i+2}function is_mail_autolink(data){var i=0,nb=0;for(i=0;i<data.length;++i){if(isalnum(data[i]))continue;switch(data[i]){case "@":nb++;case "-":case ".":case "_":break;case ">":return nb==1?i+1:0;default:return 0}}return 0}function tag_length(data,autolink){var i,j;if(data.length<3)return 0;if(data[0]!="<")return 0;
+i=data[1]=="/"?2:1;if(!isalnum(data[i]))return 0;autolink.p=MKDA_NOT_AUTOLINK;while(i<data.length&&(isalnum(data[i])||data[i]=="."||data[i]=="+"||data[i]=="-"))i++;if(i>1&&data[i]=="@")if((j=is_mail_autolink(data.slice(i)))!=0){autolink.p=MKDA_EMAIL;return i+j}if(i>2&&data[i]==":"){autolink.p=MKDA_NORMAL;i++}if(i>=data.length)autolink.p=MKDA_NOT_AUTOLINK;else if(autolink.p){j=i;while(i<data.length)if(data[i]=="\\")i+=2;else if(data[i]==">"||data[i]=="'"||data[i]=='"'||data[i]==" "||data[i]=="\n")break;
+else i++;if(i>=data.length)return 0;if(i>j&&data[i]==">")return i+1;autolink.p=MKDA_NOT_AUTOLINK}while(i<data.length&&data[i]!=">")i++;if(i>=data.length)return 0;return i+1}function parse_inline(out,md,data){var i=0,end=0;var action=0;var work=new Buffer;if(md.spanStack.length+md.blockStack.length>md.nestingLimit)return;while(i<data.length){while(end<data.length&&!(action=md.activeChars[data[end]]))end++;if(md.callbacks.normal_text){work.s=data.slice(i,end);md.callbacks.normal_text(out,work,md.context)}else out.s+=
+data.slice(i,end);if(end>=data.length)break;i=end;end=markdown_char_ptrs[action](out,md,data,i);if(!end)end=i+1;else{i+=end;end=i}}}function parse_atxheader(out,md,data){var level=0;var i,end,skip;while(level<data.length&&level<6&&data[level]=="#")level++;for(i=level;i<data.length&&data[i]==" ";i++);for(end=i;end<data.length&&data[end]!="\n";end++);skip=end;while(end&&data[end-1]=="#")end--;while(end&&data[end-1]==" ")end--;if(end>i){var work=new Buffer;md.spanStack.push(work);parse_inline(work,md,
+data.slice(i,end));if(md.callbacks.header)md.callbacks.header(out,work,level,md.context);md.spanStack.pop()}return skip}function htmlblock_end(tag,md,data){var i,w;if(tag.length+3>=data.length||data.slice(2).toLowerCase()!=tag||data[tag.length+2]!=">")return 0;i=tag.length+3;w=0;if(i<data.length&&(w=is_empty(data.slice(i)))==0)return 0;i+=w;w=0;if(md.extensions&MKDEXT_LAX_HTML_BLOCKS){if(i<data.length)w=is_empty(data.slice(i))}else if(i<data.length&&(w=is_empty(data.slice(i)))==0)return 0;return i+
+w}function parse_htmlblock(out,md,data,do_render){var i,j=0;var curtag=null;var found;var work=new Buffer(data);if(data.length<2||data[0]!="<")return 0;i=1;while(i<data.length&&data[i]!=">"&&data[i]!=" ")i++;if(i<data.length)curtag=find_block_tag(data.slice(1));if(!curtag){if(data.length>5&&data[1]=="!"&&data[2]=="-"&&data[3]=="-"){i=5;while(i<data.length&&!(data[i-2]=="-"&&data[i-1]=="-"&&data[i]==">"))i++;i++;if(i<size)j=is_empty(data.slice(i));if(j){work.s=data.slice(0,i+j);if(do_render&&md.callbacks.blockhtml)md.callbacks.blockhtml(out,
+work,md.context);return work.s.length}}if(data.length>4&&(data[1]=="h"||data[1]=="H")&&(data[2]=="r"||data[2]=="R")){i=3;while(i<data.length&&data[i]!=">")i++;if(i+1<data.length){i++;j=is_empty(data.slice(i));if(j){work.s=data.slice(0,i+j);if(do_render&&md.callbacks.blockhtml)md.callbacks.blockhtml(out,work,md.context);return work.s.length}}}return 0}i=1;found=0;if(curtag!="ins"&&curtag!="del"){var tag_size=curtag.length;i=1;while(i<data.length){i++;while(i<data.length&&!(data[i-1]=="<"&&data[i]==
+"/"))i++;if(i+2+tag_size>=data.length)break;j=htmlblock_end(tag,md,data.slice(i-1));if(j){i+=j-1;found=1;break}}}if(!found)return 0;work.s=work.s.slice(0,i);if(do_render&&md.callbacks.blockhtml)md.callbacks.blockhtml(out,work,md.context);return i}function parse_blockquote(out,md,data){var size=data.length;var beg,end=0,pre,work_size=0;var work_data="";var work_data_cursor=0;var out_=new Buffer;md.blockStack.push(out_);beg=0;while(beg<size){for(end=beg+1;end<size&&data[end-1]!="\n";end++);pre=prefix_quote(data.slice(beg,
+end));if(pre)beg+=pre;else if(is_empty(data.slice(beg,end))&&(end>=size||prefix_quote(data.slice(end))==0&&!is_empty(data.slice(end))))break;if(beg<end){work_data+=data.slice(beg,end);work_size+=end-beg}beg=end}parse_block(out_,md,work_data);if(md.callbacks.blockquote)md.callbacks.blockquote(out,out_,md.context);md.blockStack.pop();return end}function parse_paragraph(out,md,data){var i=0,end=0;var level=0;var size=data.length;var work=new Buffer(data);while(i<size){for(end=i+1;end<size&&data[end-
+1]!="\n";end++);if(prefix_quote(data.slice(i,end))!=0){end=i;break}var tempdata=data.slice(i);if(is_empty(tempdata)||(level=is_headerline(tempdata))!=0)break;if(md.extensions&MKDEXT_LAX_HTML_BLOCKS)if(data[i]=="<"&&md.callbacks.blockhtml&&parse_htmlblock(out,md,tempdata,null)){end=i;break}if(is_atxheader(md,tempdata)||is_hrule(tempdata)){end=i;break}i=end}var work_size=i;while(work_size&&data[work_size-1]=="\n")work_size--;work.s=work.s.slice(0,work_size);if(!level){var tmp=new Buffer;md.blockStack.push(tmp);
+parse_inline(tmp,md,work.s);if(md.callbacks.paragraph)md.callbacks.paragraph(out,tmp,md.context);md.blockStack.pop()}else{var header_work=null;if(work.size){var beg;i=work.s.length;while(work_size&&data[work_size]!="\n")work_size-=1;beg=work_size+1;while(work_size&&data[work_size-1]=="\n")work_size-=1;work.s=work.s.slice(0,work_size);if(work_size>0){var tmp=new Buffer;md.blockStack.push(tmp);parse_inline(tmp,md,work.s);if(md.callbacks.paragraph)md.callbacks.paragraph(out,tmp,md.context);md.blockStack.pop();
+work.s=work.s.slice(beg,i)}else work.s=work.s.slice(0,i)}header_work=new Buffer;md.spanStack.push(header_work);parse_inline(header_work,md,work.s);if(md.callbacks.header)md.callbacks.header(out,header_work,level,md.context);md.spanStack.pop()}return end}function parse_fencedcode(out,md,data){var beg,end;var work=null;var lang=new Buffer;beg=is_codefence(data,lang);if(beg==0)return 0;work=new Buffer;md.blockStack.push(work);while(beg<data.length){var fence_end;fence_end=is_codefence(data.slice(beg),
+null);if(fence_end!=0){beg+=fence_end;break}for(end=beg+1;end<data.length&&data[end-1]!="\n";end++);if(beg<end){var tempData=data.slice(beg,end);if(is_empty(tempData))work.s+="\n";else work.s+=tempData}beg=end}if(work.s.length&&work.s[work.s.length-1]!="\n")work.s+="\n";if(md.callbacks.blockcode)md.callbacks.blockcode(out,work,lang.s.length?lang:null,md.context);md.blockStack.pop();return beg}function parse_blockcode(out,md,data){var size=data.length;var beg,end,pre;var work=null;md.blockStack.push(work=
+new Buffer);beg=0;while(beg<size){for(end=beg+1;end<size&&data[end-1]!="\n";end++);pre=prefix_code(data.slice(beg,end));if(pre)beg+=pre;else if(!is_empty(data.slice(beg,end)))break;if(beg<end)if(is_empty(data.slice(beg,end)))work.s+="\n";else work.s+=data.slice(beg,end);beg=end}var work_size=work.s.length;while(work_size&&work.s[work_size-1]=="\n")work_size-=1;work.s=work.s.slice(0,work_size);work.s+="\n";if(md.callbacks.blockcode)md.callbacks.blockcode(out,work,null,md.context);md.blockStack.pop();
+return beg}function parse_listitem(out,md,data,flags){var size=data.length;var work=null,inter=null;var beg=0,end,pre,sublist=0,orgpre=0,i;var in_empty=0,has_inside_empty=0;var has_next_uli,has_next_oli;while(orgpre<3&&orgpre<size&&data[orgpre]==" ")orgpre++;beg=prefix_uli(data);if(!beg)beg=prefix_oli(data);if(!beg)return 0;end=beg;while(end<size&&data[end-1]!="\n")end++;md.spanStack.push(work=new Buffer);md.spanStack.push(inter=new Buffer);work.s+=data.slice(beg,end);beg=end;while(beg<size){end++;
+while(end<size&&data[end-1]!="\n")end++;if(is_empty(data.slice(beg,end))){in_empty=1;beg=end;continue}i=0;while(i<4&&beg+i<end&&data[beg+i]==" ")i++;pre=i;has_next_uli=prefix_uli(data.slice(beg+i,end));has_next_oli=prefix_oli(data.slice(beg+i,end));if(in_empty&&(flags.p&MKD_LIST_ORDERED&&has_next_uli||!(flags.p&MKD_LIST_ORDERED)&&has_next_oli)){flags.p|=MKD_LI_END;break}if(has_next_uli&&!is_hrule(data.slice(beg+i,end))||has_next_oli){if(in_empty)has_inside_empty=1;if(pre==orgpre)break;if(!sublist)sublist=
+work.s.length}else if(in_empty&&i<4){flags.p|=MKD_LI_END;break}else if(in_empty){work.s+="\n";has_inside_empty=1}in_empty=0;work.s+=data.slice(beg+i,end);beg=end}if(has_inside_empty)flags.p|=MKD_LI_BLOCK;if(flags.p&MKD_LI_BLOCK)if(sublist&&sublist<work.s.length){parse_block(inter,md,work.s.slice(0,sublist));parse_block(inter,md,work.s.slice(sublist))}else parse_block(inter,md,work.s);else if(sublist&&sublist<work.s.length){parse_inline(inter,md,work.s.slice(0,sublist));parse_block(inter,md,work.s.slice(sublist))}else parse_inline(inter,
+md,work.s);if(md.callbacks.listitem)md.callbacks.listitem(out,inter,flags.p,md.context);md.spanStack.pop();md.spanStack.pop();return beg}function parse_list(out,md,data,flags){var size=data.length;var i=0,j;var work=null;md.blockStack.push(work=new Buffer);while(i<size){var flag_p={p:flags};j=parse_listitem(work,md,data.slice(i),flag_p);flags=flag_p.p;i+=j;if(!j||flags&MKD_LI_END)break}if(md.callbacks.list)md.callbacks.list(out,work,flags,md.context);md.blockStack.pop();return i}function parse_table_row(out,
+md,data,columns,header_flag){var i=0,col;var row_work=null;if(!md.callbacks.table_cell||!md.callbacks.table_row)return;md.spanStack.push(row_work=new Buffer);if(i<data.length&&data[i]=="|")i++;for(col=0;col<columns.length&&i<data.length;++col){var cell_start,cell_end;var cell_work;md.spanStack.push(cell_work=new Buffer);while(i<data.length&&_isspace(data[i]))i++;cell_start=i;while(i<data.length&&data[i]!="|")i++;cell_end=i-1;while(cell_end>cell_start&&_isspace(data[cell_end]))cell_end--;parse_inline(cell_work,
+md,data.slice(cell_start,1+cell_end));md.callbacks.table_cell(row_work,cell_work,columns[col]|header_flag,md.context);md.spanStack.pop();i++}for(;col<columns.length;++col){var empty_cell=null;md.callbacks.table_cell(row_work,empty_cell,columns[col]|header_flag,md.context)}md.callbacks.table_row(out,row_work,md.context);md.spanStack.pop()}function parse_table_header(out,md,data,columns){var i=0,col,header_end,under_end;var pipes=0;while(i<data.length&&data[i]!="\n")if(data[i++]=="|")pipes++;if(i==
+data.length||pipes==0)return 0;header_end=i;while(header_end>0&&_isspace(data[header_end-1]))header_end--;if(data[0]=="|")pipes--;if(header_end&&data[header_end-1]=="|")pipes--;columns.p=new Array(pipes+1);for(var k=0;k<columns.p.length;k++)columns.p[k]=0;i++;if(i<data.length&&data[i]=="|")i++;under_end=i;while(under_end<data.length&&data[under_end]!="\n")under_end++;for(col=0;col<columns.p.length&&i<under_end;++col){var dashes=0;while(i<under_end&&data[i]==" ")i++;if(data[i]==":"){i++;columns.p[col]|=
+MKD_TABLE_ALIGN_L;dashes++}while(i<under_end&&data[i]=="-"){i++;dashes++}if(i<under_end&&data[i]==":"){i++;columns.p[col]|=MKD_TABLE_ALIGN_R;dashes++}while(i<under_end&&data[i]==" ")i++;if(i<under_end&&data[i]!="|")break;if(dashes<1)break;i++}if(col<columns.p.length)return 0;parse_table_row(out,md,data,columns.p,MKD_TABLE_HEADER);return under_end+1}function parse_table(out,md,data){var i;var header_work,body_work;var columns={p:null};md.spanStack.push(header_work=new Buffer);md.blockStack.push(body_work=
+new Buffer);i=parse_table_header(header_work,md,data,columns);if(i>0){while(i<data.length){var row_start;var pipes=0;row_start=i;while(i<data.length&&data[i]!="\n")if(data[i++]=="|")pipes++;if(pipes==0||i==data.length){i=row_start;break}parse_table_row(body_work,md,data.slice(row_start,i),columns.p,0);i++}if(md.callbacks.table)md.callbacks.table(out,header_work,body_work,md.context)}md.spanStack.pop();md.blockStack.pop();return i}function parse_block(out,md,data){var beg=0,end,i;var textData;if(md.spanStack.length+
+md.blockStack.length>md.nestingLimit)return;while(beg<data.length){textData=data.slice(beg);end=data.length-beg;if(is_atxheader(md,textData))beg+=parse_atxheader(out,md,textData);else if(data[beg]=="<"&&md.callbacks.blockhtml&&(i=parse_htmlblock(out,md,textData,1))!=0)beg+=i;else if((i=is_empty(textData))!=0)beg+=i;else if(is_hrule(textData)){if(md.callbacks.hrule)md.callbacks.hrule(out,md.context);while(beg<data.length&&data[beg]!="\n")beg++;beg++}else if((md.extensions&MKDEXT_FENCED_CODE)!=0&&(i=
+parse_fencedcode(out,md,textData))!=0)beg+=i;else if((md.extensions&MKDEXT_TABLES)!=0&&(i=parse_table(out,md,textData))!=0)beg+=i;else if(prefix_quote(textData))beg+=parse_blockquote(out,md,textData);else if(prefix_code(textData))beg+=parse_blockcode(out,md,textData);else if(prefix_uli(textData))beg+=parse_list(out,md,textData,0);else if(prefix_oli(textData))beg+=parse_list(out,md,textData,MKD_LIST_ORDERED);else beg+=parse_paragraph(out,md,textData)}}function is_ref(data,beg,end,md){var i=0;var idOffset,
+idEnd;var linkOffset,linkEnd;var titleOffset,titleEnd;var lineEnd;if(beg+3>=end)return 0;if(data[beg]==" "){i=1;if(data[beg+1]==" "){i=2;if(data[beg+2]==" "){i=3;if(data[beg+3]==" ")return 0}}}i+=beg;if(data[i]!="[")return 0;i++;idOffset=i;while(i<end&&data[i]!="\n"&&data[i]!="\r"&&data[i]!="]")i++;if(i>=end||data[i]!="]")return 0;idEnd=i;i++;if(i>=end||data[i]!=":")return 0;i++;while(i<end&&data[i]==" ")i++;if(i<end&&(data[i]=="\n"||data[i]=="\r")){i++;if(i<end&&data[i]=="\r"&&data[i-1]=="\n")i++}while(i<
+end&&data[i]==" ")i++;if(i>=end)return 0;if(data[i]=="<")i++;linkOffset=i;while(i<end&&data[i]!=" "&&data[i]!="\n"&&data[i]!="\r")i++;if(data[i-1]==">")linkEnd=i-1;else linkEnd=i;while(i<end&&data[i]==" ")i++;if(i<end&&data[i]!="\n"&&data[i]!="\r"&&data[i]!="'"&&data[i]!='"'&&data[i]!="(")return 0;lineEnd=0;if(i>=end||data[i]=="\r"||data[i]=="\n")lineEnd=i;if(i+1<end&&data[i]=="\n"&&data[i+1]=="\r")lineEnd=i+1;if(lineEnd){i=lineEnd+1;while(i<end&&data[i]==" ")i++}titleOffset=titleEnd=0;if(i+1<end&&
+(data[i]=="'"||data[i]=='"'||data[i]=="(")){i++;titleOffset=i;while(i<end&&data[i]!="\n"&&data[i]!="\r")i++;if(i+1<end&&data[i]=="\n"&&data[i+1]=="\r")titleEnd=i+1;else titleEnd=i;i-=1;while(i>titleOffset&&data[i]==" ")i-=1;if(i>titleOffset&&(data[i]=="'"||data[i]=='"'||data[i]==")")){lineEnd=titleEnd;titleEnd=i}}if(!lineEnd||linkEnd==linkOffset)return 0;var id=data.slice(idOffset,idEnd);var link=data.slice(linkOffset,linkEnd);var title=null;if(titleEnd>titleOffset)title=data.slice(titleOffset,titleEnd);
+md.refs[id]={id:id,link:new Buffer(link),title:new Buffer(title)};return lineEnd}function expand_tabs(out,line){var i=0,tab=0;while(i<line.length){var org=i;while(i<line.length&&line[i]!="\t"){i++;tab++}if(i>org)out.s+=line.slice(org,i);if(i>=line.length)break;do{out.s+=" ";tab++}while(tab%4);i++}}function render(source){var text=new Buffer;var beg=0,end;this.refs={};while(beg<source.length)if(end=is_ref(source,beg,source.length,this))beg=end;else{end=beg;while(end<source.length&&source[end]!="\n"&&
+source[end]!="\r")end++;if(end>beg)expand_tabs(text,source.slice(beg,end));while(end<source.length&&(source[end]=="\n"||source[end]=="\r")){if(source[end]=="\n"||end+1<source.length&&source[end+1]!="\n")text.s+="\n";end++}beg=end}var out=new Buffer;if(this.callbacks.doc_header)this.callbacks.doc_header(out,this.context);if(text.s.length){if(text.s[text.s.length-1]!="\n"&&text.s[text.s.length-1]!="\r")text.s+="\n";parse_block(out,this,text.s)}if(this.callbacks.doc_footer)this.callbacks.doc_footer(out,
+this.context);return out.s}Markdown.prototype["render"]=render;function getParser(callbacks,extensions,nestingLimit,context){var md=new Markdown;if(callbacks)md.callbacks=callbacks;if(nestingLimit)md.nestingLimit=nestingLimit;if(context)md.context=context;if(extensions!=undefined&&extensions!=null)md.extensions=extensions;var cb=md.callbacks;if(cb.emphasis||cb.double_emphasis||cb.triple_emphasis){md.activeChars["*"]=MD_CHAR_EMPHASIS;md.activeChars["_"]=MD_CHAR_EMPHASIS;if(md.extensions&MKDEXT_STRIKETHROUGH)md.activeChars["~"]=
+MD_CHAR_EMPHASIS}if(cb.codespan)md.activeChars["`"]=MD_CHAR_CODESPAN;if(cb.linebreak)md.activeChars["\n"]=MD_CHAR_LINEBREAK;if(cb.image||cb.link)md.activeChars["["]=MD_CHAR_LINK;md.activeChars["<"]=MD_CHAR_LANGLE;md.activeChars["\\"]=MD_CHAR_ESCAPE;md.activeChars["&"]=MD_CHAR_ENTITITY;if(md.extensions&MKDEXT_AUTOLINK){md.activeChars[":"]=MD_CHAR_AUTOLINK_URL;md.activeChars["@"]=MD_CHAR_AUTOLINK_EMAIL;md.activeChars["w"]=MD_CHAR_AUTOLINK_WWW;md.activeChars["/"]=MD_CHAR_AUTOLINK_SUBREDDIT_OR_USERNAME}if(md.extensions&
+MKDEXT_SUPERSCRIPT)md.activeChars["^"]=MD_CHAR_SUPERSCRIPT;return md}SnuOwnd["defaultCallbacks"]=defaultCallbacks;SnuOwnd["getParser"]=getParser;SnuOwnd["HTML_SKIP_HTML"]=HTML_SKIP_HTML;SnuOwnd["HTML_SKIP_STYLE"]=HTML_SKIP_STYLE;SnuOwnd["HTML_SKIP_IMAGES"]=HTML_SKIP_IMAGES;SnuOwnd["HTML_SKIP_LINKS"]=HTML_SKIP_LINKS;SnuOwnd["HTML_EXPAND_TABS"]=HTML_EXPAND_TABS;SnuOwnd["HTML_SAFELINK"]=HTML_SAFELINK;SnuOwnd["HTML_TOC"]=HTML_TOC;SnuOwnd["HTML_HARD_WRAP"]=HTML_HARD_WRAP;SnuOwnd["HTML_USE_XHTML"]=HTML_USE_XHTML;
+SnuOwnd["HTML_ESCAPE"]=HTML_ESCAPE;SnuOwnd["MKDEXT_NO_INTRA_EMPHASIS"]=MKDEXT_NO_INTRA_EMPHASIS;SnuOwnd["MKDEXT_TABLES"]=MKDEXT_TABLES;SnuOwnd["MKDEXT_FENCED_CODE"]=MKDEXT_FENCED_CODE;SnuOwnd["MKDEXT_AUTOLINK"]=MKDEXT_AUTOLINK;SnuOwnd["MKDEXT_STRIKETHROUGH"]=MKDEXT_STRIKETHROUGH;SnuOwnd["MKDEXT_LAX_HTML_BLOCKS"]=MKDEXT_LAX_HTML_BLOCKS;SnuOwnd["MKDEXT_SPACE_HEADERS"]=MKDEXT_SPACE_HEADERS;SnuOwnd["MKDEXT_SUPERSCRIPT"]=MKDEXT_SUPERSCRIPT})();
// ###########################################################################
// Start user script

0 comments on commit dfde146

Please sign in to comment.