2020-03-31 20:40:00 +08:00
|
|
|
|
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((r=r||self).prettierPlugins=r.prettierPlugins||{},r.prettierPlugins.markdown={}))}(this,(function(r){"use strict";var e=function(){for(var r={},e=0;e<arguments.length;e++){var u=arguments[e];for(var n in u)t.call(u,n)&&(r[n]=u[n])}return r},t=Object.prototype.hasOwnProperty;function u(r,e){return r(e={exports:{}},e.exports),e.exports}function n(r){return r&&r.default||r}var o=Object.freeze({__proto__:null,default:{}}),a=u((function(r){"function"==typeof Object.create?r.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(r,e){if(e){r.super_=e;var t=function(){};t.prototype=e.prototype,r.prototype=new t,r.prototype.constructor=r}}})),i=n(o),c=u((function(r){try{var e=i;if("function"!=typeof e.inherits)throw"";r.exports=e.inherits}catch(e){r.exports=a}})),s=function(r){var t,u,n;for(u in c(a,r),c(o,a),t=a.prototype)(n=t[u])&&"object"==typeof n&&(t[u]="concat"in n?n.concat():e(n));return a;function o(e){return r.apply(this,e)}function a(){return this instanceof a?r.apply(this,arguments):new o(arguments)}};var l=function(r,e,t){return function(){var u=t||this,n=u[r];return u[r]=!e,function(){u[r]=n}}};var D=function(r){var e=function(r){var e=[],t=r.indexOf("\n");for(;-1!==t;)e.push(t+1),t=r.indexOf("\n",t+1);return e.push(r.length+1),e}(String(r));return{toPosition:f(e),toOffset:p(e)}};function f(r){return function(e){var t=-1,u=r.length;if(e<0)return{};for(;++t<u;)if(r[t]>e)return{line:t+1,column:e-(r[t-1]||0)+1,offset:e};return{}}}function p(r){return function(e){var t=e&&e.line,u=e&&e.column;if(!isNaN(t)&&!isNaN(u)&&t-1 in r)return(r[t-2]||0)+u-1||0;return-1}}var d=function(r,e){return function(t){var u,n=0,o=t.indexOf("\\"),a=r[e],i=[];for(;-1!==o;)i.push(t.slice(n,o)),n=o+1,(u=t.charAt(n))&&-1!==a.indexOf(u)||i.push("\\"),o=t.indexOf("\\",n);return i.push(t.slice(n)),i.join("")}};var h={AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"},g=Object.freeze({__proto__:null,AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograv
|
2020-01-28 13:07:56 +08:00
|
|
|
|
/*!
|
2020-03-31 20:40:00 +08:00
|
|
|
|
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
2020-01-28 13:07:56 +08:00
|
|
|
|
*
|
2020-03-31 20:40:00 +08:00
|
|
|
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
|
|
|
* Licensed under the MIT License.
|
|
|
|
|
*/;var br,Er="",vr=function(r,e){if("string"!=typeof r)throw new TypeError("expected a string");if(1===e)return r;if(2===e)return r+r;var t=r.length*e;if(br!==r||void 0===br)br=r,Er="";else if(Er.length>=t)return Er.substr(0,t);for(;t>Er.length&&e>1;)1&e&&(Er+=r),e>>=1,r+=r;return Er=(Er+=r).substr(0,t)};var Cr=function(r){var e=String(r),t=e.length;for(;"\n"===e.charAt(--t););return e.slice(0,t+1)};var Fr=function(r,e,t){var u,n,o,a=-1,i=e.length,c="",s="",l="",D="";for(;++a<i;)if(u=e.charAt(a),o)if(o=!1,c+=l,s+=D,l="",D="","\n"===u)l=u,D=u;else for(c+=u,s+=u;++a<i;){if(!(u=e.charAt(a))||"\n"===u){D=u,l=u;break}c+=u,s+=u}else if(" "===u&&e.charAt(a+1)===u&&e.charAt(a+2)===u&&e.charAt(a+3)===u)l+=wr,a+=3,o=!0;else if("\t"===u)l+=u,o=!0;else{for(n="";"\t"===u||" "===u;)n+=u,u=e.charAt(++a);if("\n"!==u)break;l+=n+u,D+=u}if(s)return!!t||r(c)({type:"code",lang:null,value:Cr(s)})},wr=vr(" ",4);var Ar=function(r,e,t){var u,n,o,a,i,c,s,l,D,f,p,d=this.options,h=e.length+1,g=0,m="";if(!d.gfm)return;for(;g<h&&(" "===(o=e.charAt(g))||"\t"===o);)m+=o,g++;if(f=g,"~"!==(o=e.charAt(g))&&"`"!==o)return;g++,n=o,u=1,m+=o;for(;g<h&&(o=e.charAt(g))===n;)m+=o,u++,g++;if(u<3)return;for(;g<h&&(" "===(o=e.charAt(g))||"\t"===o);)m+=o,g++;a="",i="";for(;g<h&&"\n"!==(o=e.charAt(g))&&"~"!==o&&"`"!==o;)" "===o||"\t"===o?i+=o:(a+=i+o,i=""),g++;if((o=e.charAt(g))&&"\n"!==o)return;if(t)return!0;(p=r.now()).column+=m.length,p.offset+=m.length,m+=a,a=this.decode.raw(this.unescape(a),p),i&&(m+=i);i="",l="",D="",c="",s="";for(;g<h;)if(o=e.charAt(g),c+=l,s+=D,l="",D="","\n"===o){for(c?(l+=o,D+=o):m+=o,i="",g++;g<h&&" "===(o=e.charAt(g));)i+=o,g++;if(l+=i,D+=i.slice(f),!(i.length>=4)){for(i="";g<h&&(o=e.charAt(g))===n;)i+=o,g++;if(l+=i,D+=i,!(i.length<u)){for(i="";g<h&&(" "===(o=e.charAt(g))||"\t"===o);)l+=o,D+=o,g++;if(!o||"\n"===o)break}}}else c+=o,D+=o,g++;return r(m+=c+l)({type:"code",lang:a||null,value:Cr(s)})};var yr=u((function(r,e){(e=r.exports=function(r){return r.replace(/^\s*|\s*$/g,"")}).left=function(r){return r.replace(/^\s*/,"")},e.right=function(r){return r.replace(/\s*$/,"")}})),qr=(yr.left,yr.right,function(r,e,t,u){var n,o,a,i,c,s,l=["pedantic","commonmark"],D=l.length,f=r.length,p=-1;for(;++p<f;){for(n=r[p],o=n[1]||{},a=n[0],i=-1,s=!1;++i<D;)if(void 0!==o[c=l[i]]&&o[c]!==t.options[c]){s=!0;break}if(!s&&e[a].apply(t,u))return!0}return!1});var kr=function(r,e,t){var u,n,o,a,i,c,s,l,D,f=this.offset,p=this.blockTokenizers,d=this.interruptBlockquote,h=r.now(),g=h.line,m=e.length,b=[],E=[],v=[],C=0;for(;C<m&&(" "===(n=e.charAt(C))||"\t"===n);)C++;if(">"!==e.charAt(C))return;if(t)return!0;C=0;for(;C<m;){for(a=e.indexOf("\n",C),s=C,l=!1,-1===a&&(a=m);C<m&&(" "===(n=e.charAt(C))||"\t"===n);)C++;if(">"===e.charAt(C)?(C++,l=!0," "===e.charAt(C)&&C++):C=s,i=e.slice(C,a),!l&&!yr(i)){C=s;break}if(!l&&(o=e.slice(C),qr(d,p,this,[r,o,!0])))break;c=s===C?i:e.slice(s,a),v.push(C-s),b.push(c),E.push(i),C=a+1}C=-1,m=v.length,u=r(b.join("\n"));for(;++C<m;)f[g]=(f[g]||0)+v[C],g++;return D=this.enterBlock(),E=this.tokenizeBlock(E.join("\n"),h),D(),u({type:"blockquote",children:E})};var xr=function(r,e,t){var u,n,o,a=this.options,i=e.length+1,c=-1,s=r.now(),l="",D="";for(;++c<i;){if(" "!==(u=e.charAt(c))&&"\t"!==u){c--;break}l+=u}o=0;for(;++c<=i;){if("#"!==(u=e.charAt(c))){c--;break}l+=u,o++}if(o>6)return;if(!o||!a.pedantic&&"#"===e.charAt(c+1))return;i=e.length+1,n="";for(;++c<i;){if(" "!==(u=e.charAt(c))&&"\t"!==u){c--;break}n+=u}if(!a.pedantic&&0===n.length&&u&&"\n"!==u)return;if(t)return!0;l+=n,n="",D="";for(;++c<i&&(u=e.charAt(c))&&"\n"!==u;)if(" "===u||"\t"===u||"#"===u){for(;" "===u||"\t"===u;)n+=u,u=e.charAt(++c);for(;"#"===u;)n+=u,u=e.charAt(++c);for(;" "===u||"\t"===u;)n+=u,u=e.charAt(++c);c--}else D+=n+u,n="";return s.column+=l.length,s.offset+=l.length,r(l+=D+n)({type:"heading",depth:o,children:this.tokenizeInline(D,s)})};var Br=function(r,e,t){var u,n,o,a,i=-1,c=e.length+1,s="";for(;++i<c&&("\t"===(u=e.charAt(i))||" "===u);)s+=u;if("*"!==u&&"-"!==u&&"_"!==u)return;n=u,s+=u,o=1,a="";for(;++i<c;)if((u=e.charAt(i))===n)o++,s+=a+n,a="";else{if(" "!
|
|
|
|
|
/*!
|
|
|
|
|
* Determine if an object is a Buffer
|
2020-01-28 13:07:56 +08:00
|
|
|
|
*
|
2020-03-31 20:40:00 +08:00
|
|
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
|
|
|
* @license MIT
|
|
|
|
|
*/function ou(r){var e,t,u;if(r){if("string"==typeof r||ru(r))r={contents:r};else if("message"in r&&"messages"in r)return r}else r={};if(!(this instanceof ou))return new ou(r);for(this.data={},this.messages=[],this.history=[],this.cwd=Jt.cwd(),t=-1,u=nu.length;++t<u;)e=nu[t],tu.call(r,e)&&(this[e]=r[e]);for(e in r)-1===nu.indexOf(e)&&(this[e]=r[e])}function au(r,e){if(-1!==r.indexOf(Kt.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Kt.sep+"`")}function iu(r,e){if(!r)throw new Error("`"+e+"` cannot be empty")}function cu(r,e){if(!r)throw new Error("Setting `"+e+"` requires `path` to be set too")}uu.toString=function(r){var e=this.contents||"";return ru(e)?e.toString(r):String(e)},Object.defineProperty(uu,"path",{get:function(){return this.history[this.history.length-1]},set:function(r){iu(r,"path"),r!==this.path&&this.history.push(r)}}),Object.defineProperty(uu,"dirname",{get:function(){return"string"==typeof this.path?Kt.dirname(this.path):void 0},set:function(r){cu(this.path,"dirname"),this.path=Kt.join(r||"",this.basename)}}),Object.defineProperty(uu,"basename",{get:function(){return"string"==typeof this.path?Kt.basename(this.path):void 0},set:function(r){iu(r,"basename"),au(r,"basename"),this.path=Kt.join(this.dirname||"",r)}}),Object.defineProperty(uu,"extname",{get:function(){return"string"==typeof this.path?Kt.extname(this.path):void 0},set:function(r){var e=r||"";if(au(e,"extname"),cu(this.path,"extname"),e){if("."!==e.charAt(0))throw new Error("`extname` must start with `.`");if(-1!==e.indexOf(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xt(this.path,e)}}),Object.defineProperty(uu,"stem",{get:function(){return"string"==typeof this.path?Kt.basename(this.path,this.extname):void 0},set:function(r){iu(r,"stem"),au(r,"stem"),this.path=Kt.join(this.dirname||"",r+(this.extname||""))}});var su=eu,lu=eu.prototype;lu.message=function(r,e,t){var u=this.path,n=new Ct(r,e,t);u&&(n.name=u+":"+n.name,n.file=u);return n.fatal=!1,this.messages.push(n),n},lu.info=function(){var r=this.message.apply(this,arguments);return r.fatal=null,r},lu.fail=function(){var r=this.message.apply(this,arguments);throw r.fatal=!0,r};var Du=[].slice,fu=function(r,e){var t;return function(){var e,o=Du.call(arguments,0),a=r.length>o.length;a&&o.push(u);try{e=r.apply(null,o)}catch(r){if(a&&t)throw r;return u(r)}a||(e&&"function"==typeof e.then?e.then(n,u):e instanceof Error?u(e):n(e))};function u(){t||(t=!0,e.apply(null,arguments))}function n(r){u(null,r)}};var pu=hu;hu.wrap=fu;var du=[].slice;function hu(){var r=[],e={run:function(){var e=-1,t=du.call(arguments,0,-1),u=arguments[arguments.length-1];if("function"!=typeof u)throw new Error("Expected function as last argument, not "+u);function n(o){var a=r[++e],i=du.call(arguments,0),c=i.slice(1),s=t.length,l=-1;if(o)u(o);else{for(;++l<s;)null!==c[l]&&void 0!==c[l]||(c[l]=t[l]);t=c,a?fu(a,n).apply(null,t):u.apply(null,[null].concat(t))}}n.apply(null,[null].concat(t))},use:function(t){if("function"!=typeof t)throw new Error("Expected `fn` to be a function, not "+t);return r.push(t),e}};return e}var gu=r=>{if("[object Object]"!==Object.prototype.toString.call(r))return!1;const e=Object.getPrototypeOf(r);return null===e||e===Object.prototype},mu=function r(){var e=[],t=pu(),u={},n=!1,o=-1;return a.data=function(r,e){if("string"==typeof r)return 2===arguments.length?(Au("data",n),u[r]=e,a):Eu.call(u,r)&&u[r]||null;if(r)return Au("data",n),u=r,a;return u},a.freeze=i,a.attachers=e,a.use=function(r){var t;if(Au("use",n),null==r);else if("function"==typeof r)l.apply(null,arguments);else{if("object"!=typeof r)throw new Error("Expected usable value, not `"+r+"`");"length"in r?s(r):o(r)}t&&(u.settings=dt(u.settings||{},t));return a;function o(r){s(r.plugins),r.settings&&(t=dt(t||{},r.settings))}function i(r){if("function"==typeof r)l(r);else{if("object"!=typeof r)throw new Error("Expected usable value, not `"+r+"`");"length"in r?l.apply(null,r):o(r)}}function s(r){var e,t;if(null==r);else{if(!("object"==typeof r&&"length"in r))throw new Error("Expected a list
|