Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed https://markdown-it.github.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 lines
81 KiB

/*! remarkable 1.2.1 https://github.com//jonschlinkert/remarkable @license MIT */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.Remarkable=e()}}(function(){var e;return function r(e,t,n){function s(o,l){if(!t[o]){if(!e[o]){var a="function"==typeof require&&require;if(!l&&a)return a(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[o]={exports:{}};e[o][0].call(u.exports,function(r){var t=e[o][1][r];return s(t?t:r)},u,u.exports,r,e,t,n)}return t[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}({"./":[function(e,r){"use strict";r.exports=e("./lib/")},{"./lib/":9}],1:[function(e,r){"use strict";r.exports={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot
for(t=this.block.parse(e,this.options,r),s=0,i=t.length;i>s;s++)n=t[s],"inline"===n.type&&(n.children=this.inline.parse(n.content,this.options,r));return t},t.prototype.render=function(e){var r={references:{}};return this.renderer.render(this.parse(e,r),this.options,r)},r.exports=t},{"./common/utils":5,"./configs/commonmark":6,"./configs/default":7,"./configs/full":8,"./linkifier":10,"./parser_block":12,"./parser_inline":13,"./renderer":15,"./typographer":44}],10:[function(e,r){"use strict";function t(){this._rules=[],this.options={},this.ruler=new s(this.rulesUpdate.bind(this));for(var e=0;e<i.length;e++)this.ruler.after(i[e])}var n=e("./common/utils").assign,s=e("./ruler"),i=[e("./rules_text/linkify")];t.prototype.rulesUpdate=function(){this._rules=this.ruler.getRules()},t.prototype.set=function(e){n(this.options,e)},t.prototype.process=function(e){var r,t,n;for(n=this._rules,r=0,t=n.length;t>r;r++)n[r](this,e)},r.exports=t},{"./common/utils":5,"./ruler":16,"./rules_text/linkify":41}],11:[function(e,r){"use strict";function t(e,r){var t,n,s,i=-1,o=e.posMax,l=e.pos,a=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=r+1,e.isInLabel=!0,t=1;e.pos<o;){if(s=e.src.charCodeAt(e.pos),91===s)t++;else if(93===s&&(t--,0===t)){n=!0;break}e.parser.skipToken(e)}return n?(i=e.pos,e.labelUnmatchedScopes=0):e.labelUnmatchedScopes=t-1,e.pos=l,e.isInLabel=a,i}function n(e,r){var t,n,s=e.posMax,i="";if(60===e.src.charCodeAt(r)){for(r++;s>r;){if(t=e.src.charCodeAt(r),10===t)return!1;if(62===t)return e.pos=r+1,e.linkContent=i,!0;92===t&&s>r+1?(r++,i+=e.src[r++]):i+=e.src[r++]}return!1}for(n=0;s>r&&(t=e.src.charCodeAt(r),32!==t)&&!(32>t||127===t);)if(92===t&&s>r+1)r++,i+=e.src[r++];else{if(40===t&&(n++,n>1))break;if(41===t&&(n--,0>n))break;i+=e.src[r++]}return i.length&&e.parser.validateLink(i)?(e.pos=r,e.linkContent=i,!0):!1}function s(e,r){var t,n,s=e.posMax,i=e.src.charCodeAt(r);if(34!==i&&39!==i&&40!==i)return!1;for(r++,t="",40===i&&(i=41);s>r;){if(n=e.src.charCodeAt(r),n===i)return e.pos=r+1,e.linkContent=t,!0;92===n&&s>r+1?(r++,t+=e.src[r++]):t+=e.src[r++]}return!1}function i(e){return e.trim().replace(/\s+/g," ").toLowerCase()}r.exports.parseLinkLabel=t,r.exports.parseLinkDestination=n,r.exports.parseLinkTitle=s,r.exports.normalizeReference=i},{}],12:[function(e,r){"use strict";function t(){this._rules=[],this._rulesParagraphTerm=[],this._rulesBlockquoteTerm=[],this._rulesListTerm=[],this.ruler=new n(this.rulesUpdate.bind(this));for(var e=0;e<i.length;e++)this.ruler.after(i[e][0],i[e].slice(1))}var n=e("./ruler"),s=e("./rules_block/state_block"),i=[];i.push([e("./rules_block/code")]),i.push([e("./rules_block/fences"),"paragraph","blockquote","list"]),i.push([e("./rules_block/blockquote"),"paragraph","blockquote","list"]),i.push([e("./rules_block/hr"),"paragraph","blockquote","list"]),i.push([e("./rules_block/list"),"paragraph","blockquote"]),i.push([e("./rules_block/heading"),"paragraph","blockquote"]),i.push([e("./rules_block/lheading")]),i.push([e("./rules_block/htmlblock"),"paragraph","blockquote"]),i.push([e("./rules_block/table"),"paragraph"]),i.push([e("./rules_block/paragraph")]),t.prototype.rulesUpdate=function(){this._rules=this.ruler.getRules(),this._rulesParagraphTerm=this.ruler.getRules("paragraph"),this._rulesBlockquoteTerm=this.ruler.getRules("blockquote"),this._rulesListTerm=this.ruler.getRules("list")},t.prototype.tokenize=function(e,r,t){for(var n,s,i=this._rules,o=this._rules.length,l=r,a=!1;t>l&&(e.line=l=e.skipEmptyLines(l),!(l>=t))&&!(e.tShift[l]<e.blkIndent);){for(s=0;o>s&&!(n=i[s](e,l,t,!1));s++);if(!n)throw new Error("No matching rules found");if(l===e.line)throw new Error("None of rules updated state.line");if(e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),l=e.line,t>l&&e.isEmpty(l)){if(a=!0,l++,t>l&&"list"===e.parentType&&e.isEmpty(l))break;e.line=l}}};var o=/[\n\t]/g,l=/\r[\n\u0085]|[\u2424\u2028\u0085]/g,a=/\u00a0/g;t.prototype.parse=function(e,r,t){var n,i=0,c=0;return e?(e=e.replace(a," "),e=e.replace(l,"\n"),e.indexOf(" ")>=0&&(e=e.replace(o,function(r,t)
return e.pos=s,!0}},{}],39:[function(e,r){"use strict";function t(e,r,t,n){this.src=e,this.env=n,this.options=t,this.parser=r,this.tokens=[],this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}t.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""},t.prototype.push=function(e){this.pending&&this.pushPending(),this.tokens.push(e),this.pendingLevel=this.level},t.prototype.cacheSet=function(e,r){for(var t=this.cache.length;e>=t;t++)this.cache.push(0);this.cache[e]=r},t.prototype.cacheGet=function(e){return e<this.cache.length?this.cache[e]:0},r.exports=t},{}],40:[function(e,r){"use strict";r.exports=function(e,r){var t=e.src.slice(e.pos),n=t.search(e.parser.textMatch);return 0===n?!1:(0>n&&(n=t.length),r||(e.pending+=t.slice(0,n)),e.pos+=n,!0)}},{}],41:[function(e,r){"use strict";function t(e){return/^<a[>\s]/i.test(e)}function n(e){return/^<\/a\s*>/i.test(e)}var s=e("autolinker"),i=/www|\:\/\//,o=[],l=new s({stripPrefix:!1,replaceFn:function(e,r){return"url"===r.getType()&&o.push({text:r.matchedText,url:r.getUrl()}),!1}});r.exports=function(e,r){var s,a,c,u,p,h,f,g=0,d=r.tokens;for(s=d.length-1;s>=0;s--)if(a=d[s],"link_close"!==a.type){if("htmltag"===a.type&&(t(a.content)&&g>0&&g--,n(a.content)&&g++),!(g>0)&&"text"===a.type&&i.test(a.content)){if(c=a.content,o.length=0,l.link(c),!o.length)continue;for(u=[],f=a.level,p=0;p<o.length;p++)r.parser.validateLink(o[p].url)&&(h=c.indexOf(o[p].text),-1!==h&&(h&&(f=f,u.push({type:"text",content:c.slice(0,h),level:f})),u.push({type:"link_open",href:o[p].url,title:"",level:f++}),u.push({type:"text",content:o[p].text,level:f}),u.push({type:"link_close",level:--f}),c=c.slice(h+o[p].text.length)));c.length&&u.push({type:"text",content:c,level:f}),r.tokens=d=[].concat(d.slice(0,s),u,d.slice(s+1))}}else for(s--;d[s].level!==a.level&&"link_open"!==d[s].type;)s--}},{autolinker:45}],42:[function(e,r){"use strict";var t=/\((c|tm|r|p)\)/i,n=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/;r.exports=function(e,r){var s,i,o,l=r.tokens,a=e.options;for(s=l.length-1;s>=0;s--)i=l[s],"text"===i.type&&(o=i.content,t.test(o)&&(a.copyright&&(o=o.replace(/\(c\)/gi,"©")),a.trademark&&(o=o.replace(/\(tm\)/gi,"™")),a.registered&&(o=o.replace(/\(r\)/gi,"®")),a.paragraph&&(o=o.replace(/\(p\)/gi,"§"))),n.test(o)&&(a.plusminus&&(o=o.replace(/\+-/g,"±")),a.ellipsis&&(o=o.replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..")),a.dupes&&(o=o.replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",")),a.dashes&&(o=o.replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2"))),i.content=o)}},{}],43:[function(e,r){"use strict";function t(e,r){return 0>r||r>=e.length?!1:!o.test(e[r])}function n(e,r,t){return e.substr(0,r)+t+e.substr(r+1)}var s=/['"]/,i=/['"]/g,o=/[-\s()\[\]]/,l="’",a=[];r.exports=function(e,r){var o,c,u,p,h,f,g,d,m,b,v,k,y,x,w,q=e.options,A=r.tokens;for(a.length=0,o=0;o<A.length;o++)if(c=A[o],"text"===c.type&&!s.test(c.text)){for(g=A[o].level,y=a.length-1;y>=0&&!(a[y].level<=g);y--);a.length=y+1,u=c.content,h=0,f=u.length;e:for(;f>h&&(i.lastIndex=h,p=i.exec(u));)if(d=!t(u,p.index-1),h=p.index+1,x="'"===p[0],m=!t(u,h),m||d){if(v=!m,k=!d)for(y=a.length-1;y>=0&&(b=a[y],!(a[y].level<g));y--)if(b.single===x&&a[y].level===g){b=a[y],w=x?q.singleQuotes:q.doubleQuotes,w&&(A[b.token].content=n(A[b.token].content,b.pos,w[0]),c.content=n(c.content,p.index,w[1])),a.length=y;continue e}v?a.push({token:o,pos:p.index,single:x,level:g}):k&&x&&(c.content=n(c.content,p.index,l))}else x&&(c.content=n(c.content,p.index,l))}}},{}],44:[function(e,r){"use strict";function t(){this._rules=[],this.options={},this.ruler=new s(this.rulesUpdate.bind(this));for(var e=0;e<i.length;e++)this.ruler.after(i[e])}var n=e("./common/utils").assign,s=e("./ruler"),i=[e("./rules_text/replace"),e("./rules_text/smartquotes")];t.prototype.rulesUpdate=function(){this._rules=this.ruler.getRules