]*)\\/?>":"<"+q.tag+"\\b([^>]*)>([\\s\\S]*?)<\\/"+q.tag+">",p=new RegExp(r,"gi"),i="";if(typeof q.replacement==="string"){i=j.replace(p,q.replacement)}else{i=j.replace(p,function(v,u,t,s){return q.replacement.call(this,v,u,t,s)})}return i}function n(i){return new RegExp(i+"\\s*=\\s*[\"']?([^\"']*)[\"']?","i")}l=l.replace(/]*>`([\s\S]*)`<\/pre>/gi,function(i,j){j=j.replace(/^\t+/g," ");j=j.replace(/\n/g,"\n ");return"\n\n "+j+"\n"});l=l.replace(/^(\s{0,3}\d+)\. /g,"$1\\. ");var o=/<(ul|ol)\b[^>]*>(?:(?!
/gi;while(l.match(o)){l=l.replace(o,function(i){return c(i)})}function c(i){i=i.replace(/<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi,function(r,p,s){var j=s.split("");j.splice(j.length-1,1);for(k=0,m=j.length;k]*>([\s\S]*)/i,function(t,u){u=u.replace(/^\s+/,"");u=u.replace(/\n\n/g,"\n\n ");u=u.replace(/\n([ ]*)+(\*|\d+\.) /g,"\n$1 $2 ");return q+u})}}return j.join("\n")});return"\n\n"+i.replace(/[ \t]+\n|\s+$/g,"")}var b=/]*>((?:(?!/gi;while(l.match(b)){l=l.replace(b,function(i){return a(i)})}function a(i){i=i.replace(/]*>([\s\S]*?)<\/blockquote>/gi,function(p,j){j=j.replace(/^\s+|\s+$/g,"");j=d(j);j=j.replace(/^/gm,"> ");j=j.replace(/^(>([ \t]{2,}>)+)/gm,"> >");return j});return i}function d(i){i=i.replace(/^[\t\r\n]+|[\t\r\n]+$/g,"");i=i.replace(/\n\s+\n/g,"\n\n");i=i.replace(/\n{3,}/g,"\n\n");return i}return d(l)};if(typeof exports==="object"){exports.toMarkdown=toMarkdown};