function getDefaultOpts(simple){var defaultOptions={omitExtraWLInCodeBlocks:{defaultValue:false,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:false,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:false,describe:"Specify a prefix to generated header ids",type:"string"},headerLevelStart:{defaultValue:false,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:false,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:false,describe:"Turn on/off GFM autolink style",type:"boolean"},literalMidWordUnderscores:{defaultValue:false,describe:"Parse midword underscores as literal underscores",type:"boolean"},strikethrough:{defaultValue:false,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:false,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:false,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:true,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:false,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:false,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:false,description:"Tries to smartly fix identation in es6 strings",type:"boolean"}};if(simple===false){return JSON.parse(JSON.stringify(defaultOptions))}var ret={};for(var opt in defaultOptions){if(defaultOptions.hasOwnProperty(opt)){ret[opt]=defaultOptions[opt].defaultValue}}return ret}var showdown={},parsers={},extensions={},globalOptions=getDefaultOpts(true),flavor={github:{omitExtraWLInCodeBlocks:true,prefixHeaderId:"user-content-",simplifiedAutoLink:true,literalMidWordUnderscores:true,strikethrough:true,tables:true,tablesHeaderId:true,ghCodeBlocks:true,tasklists:true},vanilla:getDefaultOpts(true)};showdown.helper={};showdown.extensions={};showdown.setOption=function(key,value){globalOptions[key]=value;return this};showdown.getOption=function(key){return globalOptions[key]};showdown.getOptions=function(){return globalOptions};showdown.resetOptions=function(){globalOptions=getDefaultOpts(true)};showdown.setFlavor=function(name){if(flavor.hasOwnProperty(name)){var preset=flavor[name];for(var option in preset){if(preset.hasOwnProperty(option)){globalOptions[option]=preset[option]}}}};showdown.getDefaultOptions=function(simple){return getDefaultOpts(simple)};showdown.subParser=function(name,func){if(showdown.helper.isString(name)){if(typeof func!=="undefined"){parsers[name]=func}else{if(parsers.hasOwnProperty(name)){return parsers[name]}else{throw Error("SubParser named "+name+" not registered!")}}}};showdown.extension=function(name,ext){if(!showdown.helper.isString(name)){throw Error("Extension 'name' must be a string")}name=showdown.helper.stdExtName(name);if(showdown.helper.isUndefined(ext)){if(!extensions.hasOwnProperty(name)){throw Error("Extension named "+name+" is not registered!")}return extensions[name]}else{if(typeof ext==="function"){ext=ext()}if(!showdown.helper.isArray(ext)){ext=[ext]}var validExtension=validate(ext,name);if(validExtension.valid){extensions[name]=ext}else{throw Error(validExtension.error)}}};showdown.getAllExtensions=function(){return extensions};showdown.removeExtension=function(name){delete extensions[name]};showdown.resetExtensions=function(){extensions={}};function validate(extension,name){var errMsg=(name)?"Error in "+name+" extension->":"Error in unnamed extension",ret={valid:true,error:""};if(!showdown.helper.isArray(extension)){extension=[extension]}for(var i=0;i-1,x=new RegExp(left+"|"+right,"g"+f.replace(/g/g,"")),l=new RegExp(left,f.replace(/g/g,"")),pos=[],t,s,m,start,end;do{t=0;while((m=x.exec(str))){if(l.test(m[0])){if(!(t++)){s=x.lastIndex;start=s-m[0].length}}else{if(t){if(!--t){end=m.index+m[0].length;var obj={left:{start:start,end:s},match:{start:s,end:m.index},right:{start:m.index,end:end},wholeMatch:{start:start,end:end}};pos.push(obj);if(!g){return pos}}}}}}while(t&&(x.lastIndex=s));return pos};showdown.helper.matchRecursiveRegExp=function(str,left,right,flags){var matchPos=rgxFindMatchPos(str,left,right,flags),results=[];for(var i=0;i0){var bits=[];if(matchPos[0].wholeMatch.start!==0){bits.push(str.slice(0,matchPos[0].wholeMatch.start))}for(var i=0;i-1){url="" }else{return wholeMatch}}}url=showdown.helper.escapeCharacters(url,"*_",false);var result='";return result};text=text.replace(/(\[((?:\[[^\]]*]|[^\[\]])*)][ ]?(?:\n[ ]*)?\[(.*?)])()()()()/g,writeAnchorTag);text=text.replace(/(\[((?:\[[^\]]*]|[^\[\]])*)]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag);text=text.replace(/(\[([^\[\]]+)])()()()()()/g,writeAnchorTag);text=globals.converter._dispatch("anchors.after",text,options,globals);return text});showdown.subParser("autoLinks",function(text,options,globals){text=globals.converter._dispatch("autoLinks.before",text,options,globals);var simpleURLRegex=/\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)(?=\s|$)(?!["<>])/gi,delimUrlRegex=/<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)>/gi,simpleMailRegex=/(?:^|[ \n\t])([A-Za-z0-9!#$%&'*+-/=?^_`\{|}~\.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?:$|[ \n\t])/gi,delimMailRegex=/<(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi;text=text.replace(delimUrlRegex,replaceLink);text=text.replace(delimMailRegex,replaceMail);if(options.simplifiedAutoLink){text=text.replace(simpleURLRegex,replaceLink);text=text.replace(simpleMailRegex,replaceMail)}function replaceLink(wm,link){var lnkTxt=link;if(/^www\./i.test(link)){link=link.replace(/^www\./i,"http://www.")}return''+lnkTxt+""}function replaceMail(wholeMatch,m1){var unescapedStr=showdown.subParser("unescapeSpecialChars")(m1);return showdown.subParser("encodeEmailAddress")(unescapedStr)}text=globals.converter._dispatch("autoLinks.after",text,options,globals);return text});showdown.subParser("blockGamut",function(text,options,globals){text=globals.converter._dispatch("blockGamut.before",text,options,globals);text=showdown.subParser("blockQuotes")(text,options,globals);text=showdown.subParser("headers")(text,options,globals);var key=showdown.subParser("hashBlock")("
",options,globals);text=text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key);text=text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key);text=text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm,key);text=showdown.subParser("lists")(text,options,globals);text=showdown.subParser("codeBlocks")(text,options,globals);text=showdown.subParser("tables")(text,options,globals);text=showdown.subParser("hashHTMLBlocks")(text,options,globals);text=showdown.subParser("paragraphs")(text,options,globals);text=globals.converter._dispatch("blockGamut.after",text,options,globals);return text});showdown.subParser("blockQuotes",function(text,options,globals){text=globals.converter._dispatch("blockQuotes.before",text,options,globals);text=text.replace(/((^[ \t]{0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(wholeMatch,m1){var bq=m1;bq=bq.replace(/^[ \t]*>[ \t]?/gm,"~0");bq=bq.replace(/~0/g,"");bq=bq.replace(/^[ \t]+$/gm,"");bq=showdown.subParser("githubCodeBlocks")(bq,options,globals);bq=showdown.subParser("blockGamut")(bq,options,globals);bq=bq.replace(/(^|\n)/g,"$1 ");bq=bq.replace(/(\s*
[^\r]+?<\/pre>)/gm,function(wholeMatch,m1){var pre=m1;pre=pre.replace(/^  /mg,"~0");pre=pre.replace(/~0/g,"");return pre});return showdown.subParser("hashBlock")("
\n"+bq+"\n
",options,globals)});text=globals.converter._dispatch("blockQuotes.after",text,options,globals);return text});showdown.subParser("codeBlocks",function(text,options,globals){text=globals.converter._dispatch("codeBlocks.before",text,options,globals);text+="~0";var pattern=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g;text=text.replace(pattern,function(wholeMatch,m1,m2){var codeblock=m1,nextChar=m2,end="\n";codeblock=showdown.subParser("outdent")(codeblock);codeblock=showdown.subParser("encodeCode")(codeblock);codeblock=showdown.subParser("detab")(codeblock);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");if(options.omitExtraWLInCodeBlocks){end=""}codeblock="
"+codeblock+end+"
";return showdown.subParser("hashBlock")(codeblock,options,globals)+nextChar});text=text.replace(/~0/,"");text=globals.converter._dispatch("codeBlocks.after",text,options,globals);return text});showdown.subParser("codeSpans",function(text,options,globals){text=globals.converter._dispatch("codeSpans.before",text,options,globals);if(typeof(text)==="undefined"){text=""}text=text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(wholeMatch,m1,m2,m3){var c=m3;c=c.replace(/^([ \t]*)/g,"");c=c.replace(/[ \t]*$/g,"");c=showdown.subParser("encodeCode")(c);return m1+""+c+""});text=globals.converter._dispatch("codeSpans.after",text,options,globals);return text});showdown.subParser("detab",function(text){text=text.replace(/\t(?=\t)/g," ");text=text.replace(/\t/g,"~A~B");text=text.replace(/~B(.+?)~A/g,function(wholeMatch,m1){var leadingText=m1,numSpaces=4-leadingText.length%4; for(var i=0;i#+-.!])/g,showdown.helper.escapeCharactersCallback);return text});showdown.subParser("encodeCode",function(text){text=text.replace(/&/g,"&");text=text.replace(//g,">");text=showdown.helper.escapeCharacters(text,"*_{}[]\\",false);return text});showdown.subParser("encodeEmailAddress",function(addr){var encode=[function(ch){return"&#"+ch.charCodeAt(0)+";"},function(ch){return"&#x"+ch.charCodeAt(0).toString(16)+";"},function(ch){return ch}];addr="mailto:"+addr;addr=addr.replace(/./g,function(ch){if(ch==="@"){ch=encode[Math.floor(Math.random()*2)](ch)}else{if(ch!==":"){var r=Math.random();ch=(r>0.9?encode[2](ch):r>0.45?encode[1](ch):encode[0](ch))}}return ch});addr=''+addr+"";addr=addr.replace(/">.+:/g,'">');return addr});showdown.subParser("escapeSpecialCharsWithinTagAttributes",function(text){var regex=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;text=text.replace(regex,function(wholeMatch){var tag=wholeMatch.replace(/(.)<\/?code>(?=.)/g,"$1`");tag=showdown.helper.escapeCharacters(tag,"\\`*_",false);return tag});return text});showdown.subParser("githubCodeBlocks",function(text,options,globals){if(!options.ghCodeBlocks){return text}text=globals.converter._dispatch("githubCodeBlocks.before",text,options,globals);text+="~0";text=text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(wholeMatch,language,codeblock){var end=(options.omitExtraWLInCodeBlocks)?"":"\n";codeblock=showdown.subParser("encodeCode")(codeblock);codeblock=showdown.subParser("detab")(codeblock);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");codeblock="
"+codeblock+end+"
";codeblock=showdown.subParser("hashBlock")(codeblock,options,globals);return"\n\n~G"+(globals.ghCodeBlocks.push({text:wholeMatch,codeblock:codeblock})-1)+"G\n\n"});text=text.replace(/~0/,"");return globals.converter._dispatch("githubCodeBlocks.after",text,options,globals)});showdown.subParser("hashBlock",function(text,options,globals){text=text.replace(/(^\n+|\n+$)/g,"");return"\n\n~K"+(globals.gHtmlBlocks.push(text)-1)+"K\n\n"});showdown.subParser("hashElement",function(text,options,globals){return function(wholeMatch,m1){var blockText=m1;blockText=blockText.replace(/\n\n/g,"\n");blockText=blockText.replace(/^\n/,"");blockText=blockText.replace(/\n+$/g,"");blockText="\n\n~K"+(globals.gHtmlBlocks.push(blockText)-1)+"K\n\n";return blockText}});showdown.subParser("hashHTMLBlocks",function(text,options,globals){var blockTags=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],repFunc=function(wholeMatch,match,left,right){var txt=wholeMatch;if(left.search(/\bmarkdown\b/)!==-1){txt=left+globals.converter.makeHtml(match)+right}return"\n\n~K"+(globals.gHtmlBlocks.push(txt)-1)+"K\n\n"};for(var i=0;i]*>","","gim")}text=text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,showdown.subParser("hashElement")(text,options,globals));text=text.replace(/()/g,showdown.subParser("hashElement")(text,options,globals));text=text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,showdown.subParser("hashElement")(text,options,globals));return text});showdown.subParser("hashHTMLSpans",function(text,config,globals){var matches=showdown.helper.matchRecursiveRegExp(text,"]*>","","gi");for(var i=0;i]*>\\s*]*>","^(?: |\\t){0,3}\\s*
","gim");return text});showdown.subParser("headers",function(text,options,globals){text=globals.converter._dispatch("headers.before",text,options,globals); var prefixHeader=options.prefixHeaderId,headerLevelStart=(isNaN(parseInt(options.headerLevelStart)))?1:parseInt(options.headerLevelStart),setextRegexH1=(options.smoothLivePreview)?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,setextRegexH2=(options.smoothLivePreview)?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;text=text.replace(setextRegexH1,function(wholeMatch,m1){var spanGamut=showdown.subParser("spanGamut")(m1,options,globals),hID=(options.noHeaderId)?"":' id="'+headerId(m1)+'"',hLevel=headerLevelStart,hashBlock=""+spanGamut+"";return showdown.subParser("hashBlock")(hashBlock,options,globals)});text=text.replace(setextRegexH2,function(matchFound,m1){var spanGamut=showdown.subParser("spanGamut")(m1,options,globals),hID=(options.noHeaderId)?"":' id="'+headerId(m1)+'"',hLevel=headerLevelStart+1,hashBlock=""+spanGamut+"";return showdown.subParser("hashBlock")(hashBlock,options,globals)});text=text.replace(/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm,function(wholeMatch,m1,m2){var span=showdown.subParser("spanGamut")(m2,options,globals),hID=(options.noHeaderId)?"":' id="'+headerId(m2)+'"',hLevel=headerLevelStart-1+m1.length,header=""+span+"";return showdown.subParser("hashBlock")(header,options,globals)});function headerId(m){var title,escapedId=m.replace(/[^\w]/g,"").toLowerCase();if(globals.hashLinkCounts[escapedId]){title=escapedId+"-"+(globals.hashLinkCounts[escapedId]++)}else{title=escapedId;globals.hashLinkCounts[escapedId]=1}if(prefixHeader===true){prefixHeader="section"}if(showdown.helper.isString(prefixHeader)){return prefixHeader+title}return title}text=globals.converter._dispatch("headers.after",text,options,globals);return text});showdown.subParser("images",function(text,options,globals){text=globals.converter._dispatch("images.before",text,options,globals);var inlineRegExp=/!\[(.*?)]\s?\([ \t]*()?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(['"])(.*?)\6[ \t]*)?\)/g,referenceRegExp=/!\[([^\]]*?)] ?(?:\n *)?\[(.*?)]()()()()()/g;function writeImageTag(wholeMatch,altText,linkId,url,width,height,m5,title){var gUrls=globals.gUrls,gTitles=globals.gTitles,gDims=globals.gDimensions;linkId=linkId.toLowerCase();if(!title){title=""}if(url===""||url===null){if(linkId===""||linkId===null){linkId=altText.toLowerCase().replace(/ ?\n/g," ")}url="#"+linkId;if(!showdown.helper.isUndefined(gUrls[linkId])){url=gUrls[linkId];if(!showdown.helper.isUndefined(gTitles[linkId])){title=gTitles[linkId]}if(!showdown.helper.isUndefined(gDims[linkId])){width=gDims[linkId].width;height=gDims[linkId].height}}else{return wholeMatch}}altText=altText.replace(/"/g,""");altText=showdown.helper.escapeCharacters(altText,"*_",false);url=showdown.helper.escapeCharacters(url,"*_",false);var result=''+altText+'|\b)__(?=\S)([\s\S]+?)__(?=\b|<|\s|$)/gm,"$1$2");text=text.replace(/(^|\s|>|\b)_(?=\S)([\s\S]+?)_(?=\b|<|\s|$)/gm,"$1$2");text=text.replace(/(\*\*)(?=\S)([^\r]*?\S[*]*)\1/g,"$2");text=text.replace(/(\*)(?=\S)([^\r]*?\S)\1/g,"$2")}else{text=text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2");text=text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2")}text=globals.converter._dispatch("italicsAndBold.after",text,options,globals);return text});showdown.subParser("lists",function(text,options,globals){text=globals.converter._dispatch("lists.before",text,options,globals);function processListItems(listStr,trimTrailing){globals.gListLevel++;listStr=listStr.replace(/\n{2,}$/,"\n");listStr+="~0";var rgx=/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,isParagraphed=(/\n[ \t]*\n(?!~0)/.test(listStr));listStr=listStr.replace(rgx,function(wholeMatch,m1,m2,m3,m4,taskbtn,checked){checked=(checked&&checked.trim()!=="");var item=showdown.subParser("outdent")(m4,options,globals),bulletStyle="";if(taskbtn&&options.tasklists){bulletStyle=' class="task-list-item" style="list-style-type: none;"';item=item.replace(/^[ \t]*\[(x|X| )?]/m,function(){var otp='-1)){item=showdown.subParser("githubCodeBlocks")(item,options,globals);item=showdown.subParser("blockGamut")(item,options,globals)}else{item=showdown.subParser("lists")(item,options,globals);item=item.replace(/\n$/,"");if(isParagraphed){item=showdown.subParser("paragraphs")(item,options,globals)}else{item=showdown.subParser("spanGamut")(item,options,globals)}}item="\n"+item+"\n";return item});listStr=listStr.replace(/~0/g,"");globals.gListLevel--;if(trimTrailing){listStr=listStr.replace(/\s+$/,"")}return listStr}function parseConsecutiveLists(list,listType,trimTrailing){var counterRxg=(listType==="ul")?/^ {0,2}\d+\.[ \t]/gm:/^ {0,2}[*+-][ \t]/gm,subLists=[],result="";if(list.search(counterRxg)!==-1){(function parseCL(txt){var pos=txt.search(counterRxg);if(pos!==-1){result+="\n\n<"+listType+">"+processListItems(txt.slice(0,pos),!!trimTrailing)+"\n\n";listType=(listType==="ul")?"ol":"ul";counterRxg=(listType==="ul")?/^ {0,2}\d+\.[ \t]/gm:/^ {0,2}[*+-][ \t]/gm;parseCL(txt.slice(pos))}else{result+="\n\n<"+listType+">"+processListItems(txt,!!trimTrailing)+"\n\n"}})(list);for(var i=0;i"+processListItems(list,!!trimTrailing)+"\n\n"}return result}text+="~0";var wholeList=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;if(globals.gListLevel){text=text.replace(wholeList,function(wholeMatch,list,m2){var listType=(m2.search(/[*+-]/g)>-1)?"ul":"ol";return parseConsecutiveLists(list,listType,true)})}else{wholeList=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;text=text.replace(wholeList,function(wholeMatch,m1,list,m3){var listType=(m3.search(/[*+-]/g)>-1)?"ul":"ol";return parseConsecutiveLists(list,listType)})}text=text.replace(/~0/,"");text=globals.converter._dispatch("lists.after",text,options,globals);return text});showdown.subParser("outdent",function(text){text=text.replace(/^(\t|[ ]{1,4})/gm,"~0");text=text.replace(/~0/g,"");return text});showdown.subParser("paragraphs",function(text,options,globals){text=globals.converter._dispatch("paragraphs.before",text,options,globals);text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");var grafs=text.split(/\n{2,}/g),grafsOut=[],end=grafs.length;for(var i=0;i=0){grafsOut.push(str)}else{str=showdown.subParser("spanGamut")(str,options,globals);str=str.replace(/^([ \t]*)/g,"

");str+="

";grafsOut.push(str)}}end=grafsOut.length;for(i=0;i=0){var delim=RegExp.$1,num=RegExp.$2;if(delim==="K"){blockText=globals.gHtmlBlocks[num]}else{if(codeFlag){blockText=showdown.subParser("encodeCode")(globals.ghCodeBlocks[num].text)}else{blockText=globals.ghCodeBlocks[num].codeblock}}blockText=blockText.replace(/\$/g,"$$$$");grafsOutIt=grafsOutIt.replace(/(\n\n)?~(K|G)\d+\2(\n\n)?/,blockText);if(/^]*>\s*]*>/.test(grafsOutIt)){codeFlag=true}}grafsOut[i]=grafsOutIt}text=grafsOut.join("\n\n");text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");return globals.converter._dispatch("paragraphs.after",text,options,globals)});showdown.subParser("runExtension",function(ext,text,options,globals){if(ext.filter){text=ext.filter(text,globals.converter,options)}else{if(ext.regex){var re=ext.regex;if(!re instanceof RegExp){re=new RegExp(re,"g")}text=text.replace(re,ext.replace)}}return text});showdown.subParser("spanGamut",function(text,options,globals){text=globals.converter._dispatch("spanGamut.before",text,options,globals);text=showdown.subParser("codeSpans")(text,options,globals);text=showdown.subParser("escapeSpecialCharsWithinTagAttributes")(text,options,globals);text=showdown.subParser("encodeBackslashEscapes")(text,options,globals);text=showdown.subParser("images")(text,options,globals);text=showdown.subParser("anchors")(text,options,globals);text=showdown.subParser("autoLinks")(text,options,globals);text=showdown.subParser("encodeAmpsAndAngles")(text,options,globals);text=showdown.subParser("italicsAndBold")(text,options,globals);text=showdown.subParser("strikethrough")(text,options,globals);text=text.replace(/ +\n/g,"
\n");text=globals.converter._dispatch("spanGamut.after",text,options,globals);return text});showdown.subParser("strikethrough",function(text,options,globals){if(options.strikethrough){text=globals.converter._dispatch("strikethrough.before",text,options,globals);text=text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g,"$1");text=globals.converter._dispatch("strikethrough.after",text,options,globals)}return text});showdown.subParser("stripBlankLines",function(text){return text.replace(/^[ \t]+$/mg,"")});showdown.subParser("stripLinkDefinitions",function(text,options,globals){var regex=/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=~0))/gm; text+="~0";text=text.replace(regex,function(wholeMatch,linkId,url,width,height,blankLines,title){linkId=linkId.toLowerCase();globals.gUrls[linkId]=showdown.subParser("encodeAmpsAndAngles")(url);if(blankLines){return blankLines+title}else{if(title){globals.gTitles[linkId]=title.replace(/"|'/g,""")}if(options.parseImgDimensions&&width&&height){globals.gDimensions[linkId]={width:width,height:height}}}return""});text=text.replace(/~0/,"");return text});showdown.subParser("tables",function(text,options,globals){if(!options.tables){return text}var tableRgx=/^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|~0)/gm;function parseStyles(sLine){if(/^:[ \t]*--*$/.test(sLine)){return' style="text-align:left;"'}else{if(/^--*[ \t]*:[ \t]*$/.test(sLine)){return' style="text-align:right;"'}else{if(/^:[ \t]*--*[ \t]*:$/.test(sLine)){return' style="text-align:center;"'}else{return""}}}}function parseHeaders(header,style){var id="";header=header.trim();if(options.tableHeaderId){id=' id="'+header.replace(/ /g,"_").toLowerCase()+'"'}header=showdown.subParser("spanGamut")(header,options,globals);return""+header+"\n"}function parseCells(cell,style){var subText=showdown.subParser("spanGamut")(cell,options,globals);return""+subText+"\n"}function buildTable(headers,cells){var tb="\n\n\n",tblLgn=headers.length;for(var i=0;i\n\n\n";for(i=0;i\n";for(var ii=0;ii\n"}tb+="\n
\n";return tb}text=globals.converter._dispatch("tables.before",text,options,globals);text=text.replace(tableRgx,function(rawTable){var i,tableLines=rawTable.split("\n");for(i=0;i