(function(){function e(e){return e.replace(/\s+/g," ").replace(/[\\*_#<>]/g,"\\$&").replace(/(\d+)\. /g,"$1\\. ")}function n(e,n){return new Array(n+1).join(e)}function t(e){return e.replace(/^\s+|\s+$/g,"")}function r(e){return e.replace(/^[\t\r\n]+|[\t\r\n]+$/g,"").replace(/\n\s+\n/g,"\n\n").replace(/\n{3,}/g,"\n\n")}function o(e){for(var n,t,r=1;r<arguments.length;r++){n=arguments[r];for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}var i={};function a(i,u){if("string"==typeof i){var l=document.createElement("div");l.innerHTML=i,i=l}var c=r(function t(r,o,i){{if(3===r.nodeType)return/ul|ol/i.test(r.parentNode.tagName)&&/[\t\r\n\s]+/.test(r.nodeValue)?"":/code|pre/i.test(r.parentNode.tagName)?r.nodeValue:e(r.nodeValue);if(1===r.nodeType){for(var u="",l=function(e,t,r){e.parentNode&&(/li/i.test(e.parentNode.tagName)||/ul|ol/i.test(e.tagName)&&/ul|ol/i.test(e.parentNode.tagName))&&(r+=n(" ",t.tabSize));return r}(r,o,i),c=0,d=r.childNodes.length;c<d;c++)u+=t(r.childNodes[c],o,l);return s=o,g=u,p=l,(m=(f=r).tagName.toLowerCase())in a.converters?a.converters[m](f,s,g,p):-1!==s.ignored.indexOf(m)?"":g}}var f,s,g,p,m;return""}(i,u=o({},a.defaults,u||{}),""));return u.trim&&(c=t(c)),c}i.div=i.article=i.section=i.address=i.center=i.p=function(e,n,t,r){return"\n\n"+r+t+"\n\n"},i.br=function(e,n){return n.gfm?"\n":"  \n"},i.hr=function(e,n){return"\n\n"+n.hrStyle+"\n\n"},i.h1=i.title=function(e,t,r){return"setext"!==t.headerStyle||/blockquote/i.test(e.parentNode.tagName)?"\n\n# "+r+"\n\n":"\n\n"+r+"\n"+n("=",r.length)+"\n\n"},i.h2=function(e,t,r){return"setext"!==t.headerStyle||/blockquote/i.test(e.parentNode.tagName)?"\n\n## "+r+"\n\n":"\n\n"+r+"\n"+n("-",r.length)+"\n\n"},i.h3=function(e,n,t){return"\n\n### "+t+"\n\n"},i.h4=function(e,n,t){return"\n\n#### "+t+"\n\n"},i.h5=function(e,n,t){return"\n\n##### "+t+"\n\n"},i.h6=function(e,n,t){return"\n\n###### "+t+"\n\n"},i.blockquote=function(e,n,o,i){return"\n\n"+i+t(r(o)).replace(/^/gm,"> ")+"\n\n"},i.strong=i.b=function(e,n,t){return n.boldStyle+t+n.boldStyle},i.em=i.i=function(e,n,t){return n.italicStyle+t+n.italicStyle},i.del=function(e,n,t){return n.gfm?"~~"+t+"~~":t},i.ul=i.ol=function(e,n,t){return/ul|ol/i.test(e.parentNode.tagName)?t:/li/i.test(e.parentNode.tagName)?"\n"+t+"\n":"\n\n"+t+"\n\n"},i.li=function(e,n,o,i){for(var a=e.parentNode,u=0,l=0,c=a.childNodes.length;l<c;l++){var d=a.childNodes[l];if(/li/i.test(d.tagName)&&(u+=1),d===e)break}return i+(/ol/i.test(a.tagName)?u+". ":n.ulStyle+" ")+t(r(o))+"\n"},i.a=function(e,n,t){var r=e.getAttribute("href")||"";r=encodeURI(decodeURI(r));var o=e.getAttribute("title");return o||r||t?o?"["+t+"]("+r+' "'+o+'")':r===t||r==="mailto:"+t?"<"+t+">":"["+t+"]("+r+")":""},i.img=function(n,t){var r=n.getAttribute("src")||"";r=encodeURI(decodeURI(r));var o=e(n.getAttribute("alt")||""),i=n.getAttribute("title");return i?"!["+o+"]("+r+' "'+i+'")':"!["+o+"]("+r+")"},i.code=function(e,n,t){return/pre/i.test(e.parentNode.tagName)?t:/\n/.test(t)?n.gfm?"\n\n```\n"+t.replace(/^\n|\n$/g,"")+"\n```\n\n":"\n\n"+t.replace(/^/gm,"    ")+"\n\n":t.length>0?"`"+t+"`":""},i.pre=function(e,n,t,r){return 0===e.childNodes.length?"":/code/i.test(e.childNodes[0].tagName)&&n.gfm?"\n\n```\n"+t+"\n```\n\n":"\n\n"+r+t.replace(/^/gm,"    ")+"\n\n"},a.options=a.setOptions=function(e){return o(a.defaults,e),a},a.defaults={gfm:!1,trim:!0,tabSize:2,headerStyle:"setext",hrStyle:"---",italicStyle:"*",boldStyle:"**",ulStyle:"*",ignored:["head","script","style","meta"]},a.converters=i,a.addConverter=function(e){if(e.tag){var n=e.tag;a.converters[n]=e.convert}if(e.tags)for(var t=0,r=e.tags.length;t<r;t++){n=e.tags[t];a.converters[n]=e.convert}},"object"==typeof exports?module.exports=a:"function"==typeof define&&define.amd?define(function(){return a}):this.unmarked=a}).call(function(){return this||("undefined"!=typeof window?window:global)}());
