From c1e7ce469287e0e96b37d653946f6aed9efe4165 Mon Sep 17 00:00:00 2001 From: Aria Buckles Date: Thu, 24 Oct 2019 16:16:44 -0700 Subject: [PATCH] v0.7.0: Typescript types --- package.json | 7 +++++-- simple-markdown.min.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d4abe6a..5476e0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-markdown", - "version": "0.6.1", + "version": "0.7.0", "description": "Javascript markdown parsing, made simple", "main": "simple-markdown.js", "types": "simple-markdown.d.ts", @@ -21,7 +21,10 @@ "html", "ast", "markup", - "text processing" + "text processing", + "extension", + "flow", + "typescript" ], "author": "Aria Buckles", "license": "MIT", diff --git a/simple-markdown.min.js b/simple-markdown.min.js index c82fc8d..1344fcc 100644 --- a/simple-markdown.min.js +++ b/simple-markdown.min.js @@ -1 +1 @@ -!function(){var s,o,t,n,r,d,h,e,a=/\r\n?/g,l=/\t/g,u=/\f/g,c=function(e){return e.replace(a,"\n").replace(u,"").replace(l," ")},i=function(e,t){var n=e||{};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},f=function(m,n){var y,g=Object.keys(m).filter(function(e){var t=m[e];if(null==t||null==t.match)return!1;var n=t.order;return"number"==typeof n&&isFinite(n)||"undefined"==typeof console||console.warn("simple-markdown: Invalid order for rule `"+e+"`: "+String(n)),!0});g.sort(function(e,t){var n=m[e],r=m[t],a=n.order,l=r.order;if(a!==l)return a-l;var u=n.quality?0:1,o=r.quality?0:1;return u!==o?u-o:e";return r?o+t+"":o},x={},w=function(e){if(null==e)return null;try{var t=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").toLowerCase();if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}catch(e){return null}return e},b=/[<>&"']/g,_={"<":"<",">":">","&":"&",'"':""","'":"'","/":"/","`":"`"},E=function(e){return String(e).replace(b,function(e){return _[e]})},S=/\\([^0-9A-Za-z\s])/g,R=function(e){return e.replace(S,"$1")},A=function(e,t,n){var r=n.inline||!1;n.inline=!0;var a=e(t,n);return n.inline=r,a},$=function(e,t,n){return{content:A(t,e[1],n)}},O=function(){return{}},T="(?:[*+-]|\\d+\\.)",C="( *)("+T+") +",P=new RegExp("^"+C),j=new RegExp(C+"[^\\n]*(?:\\n(?!\\1"+T+" )[^\\n]*)*(\n|$)","gm"),q=/\n{2,}$/,B=/^ (?= *`)|(` *) $/g,F=q,N=/ *\n+$/,I=new RegExp("^( *)("+T+") [\\s\\S]+?(?:\n{2,}(?! )(?!\\1"+T+" )\\n*|\\s*\n*$)"),L=/(?:^|\n)( *)$/,z=(s=/^ *\| *| *\| *$/g,o=/ *$/,t=/^ *-+: *$/,n=/^ *:-+: *$/,r=/^ *:-+ *$/,d=function(e){return t.test(e)?"right":n.test(e)?"center":r.test(e)?"left":null},h=function(e,t,n,r){var a=n.inTable;n.inTable=!0;var l=t(e.trim(),n);n.inTable=a;var u=[[]];return l.forEach(function(e,t){"tableSeparator"===e.type?(!r||0!==t&&t!==l.length-1)&&u.push([]):("text"!==e.type||null!=l[t+1]&&"tableSeparator"!==l[t+1].type||(e.content=e.content.replace(o,"")),u[u.length-1].push(e))}),u},{parseTable:(e=function(p){return function(e,t,n){n.inline=!0;var r,a,l,u,o,c=h(e[1],t,n,p),i=(r=e[2],p&&(r=r.replace(s,"")),r.trim().split("|").map(d)),f=(a=e[3],l=t,u=n,o=p,a.trim().split("\n").map(function(e){return h(e,l,u,o)}));return n.inline=!1,{type:"table",header:c,align:i,cells:f}}})(!0),parseNpTable:e(!1),TABLE_REGEX:/^ *(\|.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/,NPTABLE_REGEX:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/}),G="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",X="\\s*?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*",Z=/mailto:/i,M=function(e,t,n){var r=(e[2]||e[1]).replace(/\s+/g," ").toLowerCase();if(t._defs&&t._defs[r]){var a=t._defs[r];n.target=a.target,n.title=a.title}return t._refs=t._refs||{},t._refs[r]=t._refs[r]||[],t._refs[r].push(n),n},U=0,H={Array:{react:function(e,t,n){for(var r=n.key,a=[],l=0,u=0;l"}},codeBlock:{order:U++,match:m(/^(?: [^\n]+\n*)+(?:\n *)+\n/),parse:function(e,t,n){return{lang:void 0,content:e[0].replace(/^ /gm,"").replace(/\n+$/,"")}},react:function(e,t,n){var r=e.lang?"markdown-code-"+e.lang:void 0;return v("pre",n.key,{children:v("code",null,{className:r,children:e.content})})},html:function(e,t,n){var r=e.lang?"markdown-code-"+e.lang:void 0,a=k("code",E(e.content),{class:r});return k("pre",a)}},fence:{order:U++,match:m(/^ *(`{3,}|~{3,}) *(?:(\S+) *)?\n([\s\S]+?)\n?\1 *(?:\n *)+\n/),parse:function(e,t,n){return{type:"codeBlock",lang:e[2]||void 0,content:e[3]}},react:null,html:null},blockQuote:{order:U++,match:m(/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/),parse:function(e,t,n){return{content:t(e[0].replace(/^ *> ?/gm,""),n)}},react:function(e,t,n){return v("blockquote",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("blockquote",t(e.content,n))}},list:{order:U++,match:function(e,t){var n=null==t.prevCapture?"":t.prevCapture[0],r=L.exec(n),a=t._list||!t.inline;return r&&a?(e=r[1]+e,I.exec(e),I.exec(e)):null},parse:function(e,s,d){var t=e[2],n=1]*)>?(?: +["(]([^\n]+)[")])? *\n(?: *\n)*/),parse:function(e,t,n){var r=e[1].replace(/\s+/g," ").toLowerCase(),a=e[2],l=e[3];return n._refs&&n._refs[r]&&n._refs[r].forEach(function(e){e.target=a,e.title=l}),n._defs=n._defs||{},n._defs[r]={target:a,title:l},{def:r,target:a,title:l}},react:function(){return null},html:function(){return""}},table:{order:U++,match:m(z.TABLE_REGEX),parse:z.parseTable,react:function(t,n,r){var a=function(e){return null==t.align[e]?{}:{textAlign:t.align[e]}},e=t.header.map(function(e,t){return v("th",""+t,{style:a(t),scope:"col",children:n(e,r)})}),l=t.cells.map(function(e,t){return v("tr",""+t,{children:e.map(function(e,t){return v("td",""+t,{style:a(t),children:n(e,r)})})})});return v("table",r.key,{children:[v("thead","thead",{children:v("tr",null,{children:e})}),v("tbody","tbody",{children:l})]})},html:function(t,n,r){var a=function(e){return null==t.align[e]?"":"text-align:"+t.align[e]+";"},e=t.header.map(function(e,t){return k("th",n(e,r),{style:a(t),scope:"col"})}).join(""),l=t.cells.map(function(e){var t=e.map(function(e,t){return k("td",n(e,r),{style:a(t)})}).join("");return k("tr",t)}).join(""),u=k("thead",k("tr",e)),o=k("tbody",l);return k("table",u+o)}},newline:{order:U++,match:m(/^(?:\n *)*\n/),parse:O,react:function(e,t,n){return"\n"},html:function(e,t,n){return"\n"}},paragraph:{order:U++,match:m(/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/),parse:$,react:function(e,t,n){return v("div",n.key,{className:"paragraph",children:t(e.content,n)})},html:function(e,t,n){return k("div",t(e.content,n),{class:"paragraph"})}},escape:{order:U++,match:p(/^\\([^0-9A-Za-z\s])/),parse:function(e,t,n){return{type:"text",content:e[1]}},react:null,html:null},tableSeparator:{order:U++,match:function(e,t){return t.inTable?/^ *\| */.exec(e):null},parse:function(){return{type:"tableSeparator"}},react:function(){return" | "},html:function(){return" | "}},autolink:{order:U++,match:p(/^<([^: >]+:\/[^ >]+)>/),parse:function(e,t,n){return{type:"link",content:[{type:"text",content:e[1]}],target:e[1]}},react:null,html:null},mailto:{order:U++,match:p(/^<([^ >]+@[^ >]+)>/),parse:function(e,t,n){var r=e[1],a=e[1];return Z.test(a)||(a="mailto:"+a),{type:"link",content:[{type:"text",content:r}],target:a}},react:null,html:null},url:{order:U++,match:p(/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/),parse:function(e,t,n){return{type:"link",content:[{type:"text",content:e[1]}],target:e[1],title:void 0}},react:null,html:null},link:{order:U++,match:p(new RegExp("^\\[("+G+")\\]\\("+X+"\\)")),parse:function(e,t,n){return{content:t(e[1],n),target:R(e[2]),title:e[3]}},react:function(e,t,n){return v("a",n.key,{href:w(e.target),title:e.title,children:t(e.content,n)})},html:function(e,t,n){var r={href:w(e.target),title:e.title};return k("a",t(e.content,n),r)}},image:{order:U++,match:p(new RegExp("^!\\[("+G+")\\]\\("+X+"\\)")),parse:function(e,t,n){return{alt:e[1],target:R(e[2]),title:e[3]}},react:function(e,t,n){return v("img",n.key,{src:w(e.target),alt:e.alt,title:e.title})},html:function(e,t,n){var r={src:w(e.target),alt:e.alt,title:e.title};return k("img","",r,!1)}},reflink:{order:U++,match:p(new RegExp("^\\[("+G+")\\]\\s*\\[([^\\]]*)\\]")),parse:function(e,t,n){return M(e,n,{type:"link",content:t(e[1],n)})},react:null,html:null},refimage:{order:U++,match:p(new RegExp("^!\\[("+G+")\\]\\s*\\[([^\\]]*)\\]")),parse:function(e,t,n){return M(e,n,{type:"image",alt:e[1]})},react:null,html:null},em:{order:U,match:p(new RegExp("^\\b_((?:__|\\\\[\\s\\S]|[^\\\\_])+?)_\\b|^\\*(?=\\S)((?:\\*\\*|\\\\[\\s\\S]|\\s+(?:\\\\[\\s\\S]|[^\\s\\*\\\\]|\\*\\*)|[^\\s\\*\\\\])+?)\\*(?!\\*)")),quality:function(e){return e[0].length+.2},parse:function(e,t,n){return{content:t(e[2]||e[1],n)}},react:function(e,t,n){return v("em",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("em",t(e.content,n))}},strong:{order:U,match:p(/^\*\*((?:\\[\s\S]|[^\\])+?)\*\*(?!\*)/),quality:function(e){return e[0].length+.1},parse:$,react:function(e,t,n){return v("strong",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("strong",t(e.content,n))}},u:{order:U++,match:p(/^__((?:\\[\s\S]|[^\\])+?)__(?!_)/),quality:function(e){return e[0].length},parse:$,react:function(e,t,n){return v("u",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("u",t(e.content,n))}},del:{order:U++,match:p(/^~~(?=\S)((?:\\[\s\S]|~(?!~)|[^\s~]|\s(?!~~))+?)~~/),parse:$,react:function(e,t,n){return v("del",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("del",t(e.content,n))}},inlineCode:{order:U++,match:p(/^(`+)([\s\S]*?[^`])\1(?!`)/),parse:function(e,t,n){return{content:e[2].replace(B,"$1")}},react:function(e,t,n){return v("code",n.key,{children:e.content})},html:function(e,t,n){return k("code",E(e.content))}},br:{order:U++,match:y(/^ {2,}\n/),parse:O,react:function(e,t,n){return v("br",n.key,x)},html:function(e,t,n){return"
"}},text:{order:U++,match:y(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]|\n\n| {2,}\n|\w+:\S|$)/),parse:function(e,t,n){return{content:e[0]}},react:function(e,t,n){return e.content},html:function(e,t,n){return E(e.content)}}},D=function(n,r,a){if(!r)throw new Error("simple-markdown: outputFor: `property` must be defined. if you just upgraded, you probably need to replace `outputFor` with `reactFor`");var l,u=n.Array||H.Array,o=function(e,t){return l=t=t||l,Array.isArray(e)?u[r](e,o,t):n[e.type][r](e,o,t)};return function(e,t){return l=i(t,a),o(e,l)}},Q=f(H),J=function(e,t){return(t=t||{}).inline=!1,Q(e,t)},K=function(e,t){var n=q.test(e);return(t=t||{}).inline=!n,Q(e,t)},V=D(H,"react"),W=D(H,"html"),Y=function(e,t){return V(J(e,t),t)},ee={defaultRules:H,parserFor:f,outputFor:D,inlineRegex:p,blockRegex:m,anyScopeRegex:y,parseInline:A,parseBlock:function(e,t,n){var r=n.inline||!1;n.inline=!1;var a=e(t+"\n\n",n);return n.inline=r,a},markdownToReact:Y,markdownToHtml:function(e,t){return W(J(e,t),t)},ReactMarkdown:function(e){var t={};for(var n in e)"source"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.children=Y(e.source),v("div",null,t)},defaultBlockParse:J,defaultInlineParse:function(e,t){return(t=t||{}).inline=!0,Q(e,t)},defaultImplicitParse:K,defaultReactOutput:V,defaultHtmlOutput:W,preprocess:c,sanitizeText:E,sanitizeUrl:w,unescapeUrl:R,htmlTag:k,reactElement:v,defaultRawParse:Q,ruleOutput:function(r,a){return a||"undefined"==typeof console||console.warn("simple-markdown ruleOutput should take 'react' or 'html' as the second argument."),function(e,t,n){return r[e.type][a](e,t,n)}},reactFor:function(o){var c=function(e,t){if(t=t||{},Array.isArray(e)){for(var n=t.key,r=[],a=null,l=0;l";return r?u+t+"":u},w={},x=function(e){if(null==e)return null;try{var t=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").toLowerCase();if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}catch(e){return null}return e},b=/[<>&"']/g,_={"<":"<",">":">","&":"&",'"':""","'":"'","/":"/","`":"`"},E=function(e){return String(e).replace(b,function(e){return _[e]})},S=/\\([^0-9A-Za-z\s])/g,A=function(e){return e.replace(S,"$1")},R=function(e,t,n){var r=n.inline||!1;n.inline=!0;var a=e(t,n);return n.inline=r,a},$=function(e,t,n){return{content:R(t,e[1],n)}},O=function(){return{}},T="(?:[*+-]|\\d+\\.)",C="( *)("+T+") +",j=new RegExp("^"+C),P=new RegExp(C+"[^\\n]*(?:\\n(?!\\1"+T+" )[^\\n]*)*(\n|$)","gm"),q=/\n{2,}$/,F=/^ (?= *`)|(` *) $/g,B=q,N=/ *\n+$/,I=new RegExp("^( *)("+T+") [\\s\\S]+?(?:\n{2,}(?! )(?!\\1"+T+" )\\n*|\\s*\n*$)"),L=/(?:^|\n)( *)$/,z=(s=/^ *\| *| *\| *$/g,u=/ *$/,t=/^ *-+: *$/,n=/^ *:-+: *$/,r=/^ *:-+ *$/,d=function(e){return t.test(e)?"right":n.test(e)?"center":r.test(e)?"left":null},h=function(e,t,n,r){var a=n.inTable;n.inTable=!0;var l=t(e.trim(),n);n.inTable=a;var o=[[]];return l.forEach(function(e,t){"tableSeparator"===e.type?(!r||0!==t&&t!==l.length-1)&&o.push([]):("text"!==e.type||null!=l[t+1]&&"tableSeparator"!==l[t+1].type||(e.content=e.content.replace(u,"")),o[o.length-1].push(e))}),o},{parseTable:(e=function(p){return function(e,t,n){n.inline=!0;var r,a,l,o,u,c=h(e[1],t,n,p),i=(r=e[2],p&&(r=r.replace(s,"")),r.trim().split("|").map(d)),f=(a=e[3],l=t,o=n,u=p,a.trim().split("\n").map(function(e){return h(e,l,o,u)}));return n.inline=!1,{type:"table",header:c,align:i,cells:f}}})(!0),parseNpTable:e(!1),TABLE_REGEX:/^ *(\|.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/,NPTABLE_REGEX:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/}),G="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",X="\\s*?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*",Z=/mailto:/i,M=function(e,t,n){var r=(e[2]||e[1]).replace(/\s+/g," ").toLowerCase();if(t._defs&&t._defs[r]){var a=t._defs[r];n.target=a.target,n.title=a.title}return t._refs=t._refs||{},t._refs[r]=t._refs[r]||[],t._refs[r].push(n),n},U=0,H={Array:{react:function(e,t,n){for(var r=n.key,a=[],l=0,o=0;l"}},codeBlock:{order:U++,match:m(/^(?: [^\n]+\n*)+(?:\n *)+\n/),parse:function(e,t,n){return{lang:void 0,content:e[0].replace(/^ /gm,"").replace(/\n+$/,"")}},react:function(e,t,n){var r=e.lang?"markdown-code-"+e.lang:void 0;return v("pre",n.key,{children:v("code",null,{className:r,children:e.content})})},html:function(e,t,n){var r=e.lang?"markdown-code-"+e.lang:void 0,a=k("code",E(e.content),{class:r});return k("pre",a)}},fence:{order:U++,match:m(/^ *(`{3,}|~{3,}) *(?:(\S+) *)?\n([\s\S]+?)\n?\1 *(?:\n *)+\n/),parse:function(e,t,n){return{type:"codeBlock",lang:e[2]||void 0,content:e[3]}},react:null,html:null},blockQuote:{order:U++,match:m(/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/),parse:function(e,t,n){return{content:t(e[0].replace(/^ *> ?/gm,""),n)}},react:function(e,t,n){return v("blockquote",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("blockquote",t(e.content,n))}},list:{order:U++,match:function(e,t){var n=null==t.prevCapture?"":t.prevCapture[0],r=L.exec(n),a=t._list||!t.inline;return r&&a?(e=r[1]+e,I.exec(e),I.exec(e)):null},parse:function(e,s,d){var t=e[2],n=1]*)>?(?: +["(]([^\n]+)[")])? *\n(?: *\n)*/),parse:function(e,t,n){var r=e[1].replace(/\s+/g," ").toLowerCase(),a=e[2],l=e[3];return n._refs&&n._refs[r]&&n._refs[r].forEach(function(e){e.target=a,e.title=l}),n._defs=n._defs||{},n._defs[r]={target:a,title:l},{def:r,target:a,title:l}},react:function(){return null},html:function(){return""}},table:{order:U++,match:m(z.TABLE_REGEX),parse:z.parseTable,react:function(t,n,r){var a=function(e){return null==t.align[e]?{}:{textAlign:t.align[e]}},e=t.header.map(function(e,t){return v("th",""+t,{style:a(t),scope:"col",children:n(e,r)})}),l=t.cells.map(function(e,t){return v("tr",""+t,{children:e.map(function(e,t){return v("td",""+t,{style:a(t),children:n(e,r)})})})});return v("table",r.key,{children:[v("thead","thead",{children:v("tr",null,{children:e})}),v("tbody","tbody",{children:l})]})},html:function(t,n,r){var a=function(e){return null==t.align[e]?"":"text-align:"+t.align[e]+";"},e=t.header.map(function(e,t){return k("th",n(e,r),{style:a(t),scope:"col"})}).join(""),l=t.cells.map(function(e){var t=e.map(function(e,t){return k("td",n(e,r),{style:a(t)})}).join("");return k("tr",t)}).join(""),o=k("thead",k("tr",e)),u=k("tbody",l);return k("table",o+u)}},newline:{order:U++,match:m(/^(?:\n *)*\n/),parse:O,react:function(e,t,n){return"\n"},html:function(e,t,n){return"\n"}},paragraph:{order:U++,match:m(/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/),parse:$,react:function(e,t,n){return v("div",n.key,{className:"paragraph",children:t(e.content,n)})},html:function(e,t,n){return k("div",t(e.content,n),{class:"paragraph"})}},escape:{order:U++,match:p(/^\\([^0-9A-Za-z\s])/),parse:function(e,t,n){return{type:"text",content:e[1]}},react:null,html:null},tableSeparator:{order:U++,match:function(e,t){return t.inTable?/^ *\| */.exec(e):null},parse:function(){return{type:"tableSeparator"}},react:function(){return" | "},html:function(){return" | "}},autolink:{order:U++,match:p(/^<([^: >]+:\/[^ >]+)>/),parse:function(e,t,n){return{type:"link",content:[{type:"text",content:e[1]}],target:e[1]}},react:null,html:null},mailto:{order:U++,match:p(/^<([^ >]+@[^ >]+)>/),parse:function(e,t,n){var r=e[1],a=e[1];return Z.test(a)||(a="mailto:"+a),{type:"link",content:[{type:"text",content:r}],target:a}},react:null,html:null},url:{order:U++,match:p(/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/),parse:function(e,t,n){return{type:"link",content:[{type:"text",content:e[1]}],target:e[1],title:void 0}},react:null,html:null},link:{order:U++,match:p(new RegExp("^\\[("+G+")\\]\\("+X+"\\)")),parse:function(e,t,n){return{content:t(e[1],n),target:A(e[2]),title:e[3]}},react:function(e,t,n){return v("a",n.key,{href:x(e.target),title:e.title,children:t(e.content,n)})},html:function(e,t,n){var r={href:x(e.target),title:e.title};return k("a",t(e.content,n),r)}},image:{order:U++,match:p(new RegExp("^!\\[("+G+")\\]\\("+X+"\\)")),parse:function(e,t,n){return{alt:e[1],target:A(e[2]),title:e[3]}},react:function(e,t,n){return v("img",n.key,{src:x(e.target),alt:e.alt,title:e.title})},html:function(e,t,n){var r={src:x(e.target),alt:e.alt,title:e.title};return k("img","",r,!1)}},reflink:{order:U++,match:p(new RegExp("^\\[("+G+")\\]\\s*\\[([^\\]]*)\\]")),parse:function(e,t,n){return M(e,n,{type:"link",content:t(e[1],n)})},react:null,html:null},refimage:{order:U++,match:p(new RegExp("^!\\[("+G+")\\]\\s*\\[([^\\]]*)\\]")),parse:function(e,t,n){return M(e,n,{type:"image",alt:e[1]})},react:null,html:null},em:{order:U,match:p(new RegExp("^\\b_((?:__|\\\\[\\s\\S]|[^\\\\_])+?)_\\b|^\\*(?=\\S)((?:\\*\\*|\\\\[\\s\\S]|\\s+(?:\\\\[\\s\\S]|[^\\s\\*\\\\]|\\*\\*)|[^\\s\\*\\\\])+?)\\*(?!\\*)")),quality:function(e){return e[0].length+.2},parse:function(e,t,n){return{content:t(e[2]||e[1],n)}},react:function(e,t,n){return v("em",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("em",t(e.content,n))}},strong:{order:U,match:p(/^\*\*((?:\\[\s\S]|[^\\])+?)\*\*(?!\*)/),quality:function(e){return e[0].length+.1},parse:$,react:function(e,t,n){return v("strong",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("strong",t(e.content,n))}},u:{order:U++,match:p(/^__((?:\\[\s\S]|[^\\])+?)__(?!_)/),quality:function(e){return e[0].length},parse:$,react:function(e,t,n){return v("u",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("u",t(e.content,n))}},del:{order:U++,match:p(/^~~(?=\S)((?:\\[\s\S]|~(?!~)|[^\s~]|\s(?!~~))+?)~~/),parse:$,react:function(e,t,n){return v("del",n.key,{children:t(e.content,n)})},html:function(e,t,n){return k("del",t(e.content,n))}},inlineCode:{order:U++,match:p(/^(`+)([\s\S]*?[^`])\1(?!`)/),parse:function(e,t,n){return{content:e[2].replace(F,"$1")}},react:function(e,t,n){return v("code",n.key,{children:e.content})},html:function(e,t,n){return k("code",E(e.content))}},br:{order:U++,match:y(/^ {2,}\n/),parse:O,react:function(e,t,n){return v("br",n.key,w)},html:function(e,t,n){return"
"}},text:{order:U++,match:y(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]|\n\n| {2,}\n|\w+:\S|$)/),parse:function(e,t,n){return{content:e[0]}},react:function(e,t,n){return e.content},html:function(e,t,n){return E(e.content)}}},D=function(n,r,a){if(!r)throw new Error("simple-markdown: outputFor: `property` must be defined. if you just upgraded, you probably need to replace `outputFor` with `reactFor`");var l,e=(n.Array||H.Array)[r];if(!e)throw new Error("simple-markdown: outputFor: to join nodes of type `"+r+"` you must provide an `Array:` joiner rule with that type, Please see the docs for details on specifying an Array rule.");var o=e,u=function(e,t){return l=t=t||l,Array.isArray(e)?o(e,u,t):n[e.type][r](e,u,t)};return function(e,t){return l=i(t,a),u(e,l)}},Q=f(H),J=function(e,t){return(t=t||{}).inline=!1,Q(e,t)},K=function(e,t){var n=q.test(e);return(t=t||{}).inline=!n,Q(e,t)},V=D(H,"react"),W=D(H,"html"),Y=function(e,t){return V(J(e,t),t)},ee={defaultRules:H,parserFor:f,outputFor:D,inlineRegex:p,blockRegex:m,anyScopeRegex:y,parseInline:R,parseBlock:function(e,t,n){var r=n.inline||!1;n.inline=!1;var a=e(t+"\n\n",n);return n.inline=r,a},markdownToReact:Y,markdownToHtml:function(e,t){return W(J(e,t),t)},ReactMarkdown:function(e){var t={};for(var n in e)"source"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.children=Y(e.source),v("div",null,t)},defaultBlockParse:J,defaultInlineParse:function(e,t){return(t=t||{}).inline=!0,Q(e,t)},defaultImplicitParse:K,defaultReactOutput:V,defaultHtmlOutput:W,preprocess:c,sanitizeText:E,sanitizeUrl:x,unescapeUrl:A,htmlTag:k,reactElement:v,defaultRawParse:Q,ruleOutput:function(r,a){return a||"undefined"==typeof console||console.warn("simple-markdown ruleOutput should take 'react' or 'html' as the second argument."),function(e,t,n){return r[e.type][a](e,t,n)}},reactFor:function(u){var c=function(e,t){if(t=t||{},Array.isArray(e)){for(var n=t.key,r=[],a=null,l=0;l