/**
* marked - a markdown parser * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed) * https://github.com/chjj/marked */
(function()var block={newline:/^n+/,code:/^( {4+n*)+/,fences:noop,hr:/^( [-_]){3,} *(?:n+|$)/,heading:/^ *(#{1,6}) *([^n]+?) *#* *(?:n+|$)/,nptable:noop,lheading:/^(+)n *(=|-){3,} n/,blockquote:/^( *>[^n]+(n+)n)+/,list:/^( *)(bull) [sS]+?(?:hr|n{2,}(?! )(?!1bull )n*|s*$)/,html:/^ *(?:comment|closed|closing) *(?:n{2,}|s*$)/,def:/^ *[([^]]+)]: *<?([^s>]+)>?(?: +[“(]([^n]+))? *(?:n+|$)/,table:noop,paragraph:/^((?:+n?(?!hr|heading|lheading|blockquote|tag|def))+)n*/, text:/^+/};block.bullet=/(?:|d+.)/;block.item=/^( *)(bull) [^n]*(?:n(?!1bull )[^n]*)*/;block.item=replace(block.item,“gm”)(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)(“hr”,/n+(?=(?: [-_]){3,} *(?:n+|$))/)();block._tag=“(?!(?:”+“a|em|strong|small|s|cite|q|dfn|abbr|data|time|code”+“|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo”+“|span|br|wbr|ins|del|img)\b)\w+(?!:/|@)\b”;block.html=replace(block.html)(“comment”,/x3c!–*?–x3e/)(“closed”, /<(tag)+?</1>/)(”closing“,/space
”}“,”gm“),”“):item.replace(/^ {1,4}/gm,”“)}if(this.options.smartLists&&i!==l-1){b=block.bullet.exec(cap)[0];if(bull!==b&&!(bull.length>1&&b.length>1)){src=cap.slice(i+ 1).join(”n“)+src;i=l-1}}loose=next||/nn(?!s*$)/.test(item);if(i!==l-1){next=item===”n“;if(!loose)loose=next}this.tokens.push({type:loose?”loose_item_start“:”list_item_start“});this.token(item,false);this.tokens.push({type:”list_item_end“})}this.tokens.push({type:”list_end“});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap.length);this.tokens.push({type:this.options.sanitize?”paragraph“:”html“,pre:cap===”pre“||cap===”script“,text:cap});continue}if(top&& (cap=this.rules.def.exec(src))){src=src.substring(cap.length);this.tokens.links[cap.toLowerCase()]={href:cap,title:cap};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap.length);item={type:”table“,header:cap.replace(/^ *| *| *$/g,”“).split(/ *| */),align:cap.replace(/^ *|| *$/g,”“).split(/ *| */),cells:cap.replace(/(?: *| *)?n$/,”“).split(”n“)};for(i=0;i<item.align.length;i++)if(/^ *-+: *$/.test(item.align))item.align=”right“;else if(/^ *:-+: *$/.test(item.align))item.align= ”center“;else if(/^ *:-+ *$/.test(item.align))item.align=”left“;else item.align=null;for(i=0;ihref
'“>'text
”</a>“;continue}if(cap=this.rules.url.exec(src)){src=src.substring(cap.length);text=escape(cap);href=text;out+='<a href=”'href
'“>'text
”</a>“;continue}if(cap=this.rules.tag.exec(src)){src=src.substring(cap.length); out+=this.options.sanitize?escape(cap):cap;continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap.length);out+=this.outputLink(cap,{href:cap,title:cap});continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap.length);link=(cap||cap).replace(/s+/g,” “);link=this.links;if(!link||!link.href){out+=cap[0];src=cap.substring(1)+src;continue}out+=this.outputLink(cap,link);continue}if(cap=this.rules.strong.exec(src)){src= src.substring(cap.length);out+=”“+this.output(cap||cap)+”</strong>“;continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap.length);out+=”“+this.output(cap[2]||cap[1])+”“;continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap.length);out+=”"+escape(cap[2],true)+"
“;continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap.length);out+=”
“;continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap.length);out+=”<del>“+ this.output(cap)+”</del>“;continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap.length);out+=escape(cap);continue}if(src)throw new Error(”Infinite loop on byte: “+src.charCodeAt(0));}return out};InlineLexer.prototype.outputLink=function(cap,link){if(cap[0]!==”!“)return'<a href=”'+escape(link.href)+'“'+(link.title?' title=”’+escape(link.title)+‘“’:”“)+”>“+this.output(cap)+”</a>“;else return'<img src=”'+escape(link.href)+'“ alt=”‘+escape(cap)+'“'+(link.title?' title=”'+ escape(link.title)+'“':”“)+”>“};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/–/g,”u2014“).replace(/’(*)'/g,”u2018$1u2019“).replace(/”(*)“/g,”u201c$1u201d“).replace(/.{3}/g,”u2026“)};InlineLexer.prototype.mangle=function(text){var out=”“,l=text.length,i=0,ch;for(;i<l;i++){ch=text.charCodeAt(i);if(Math.random()>0.5)ch=”x“+ch.toString(16);out+=”&#“ch
”;“}return out};function Parser(options){this.tokens=[];this.token=null; this.options=options||marked.defaults}Parser.parse=function(src,options){var parser=new Parser(options);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options);this.tokens=src.reverse();var out=”“;while(this.next())out+=this.tok();return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens||0};Parser.prototype.parseText=function(){var body=this.token.text; while(this.peek().type===”text“)body+=”n“+this.next().text;return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case ”space“:return”“;case ”hr“:return”<hr>n“;case ”heading“:return”<h“this.token.depth
”>“+this.inline.output(this.token.text)+”</h“this.token.depth
”>n“;case ”code“:if(this.options.highlight){var code=this.options.highlight(this.token.text,this.token.lang);if(code!=null&&code!==this.token.text){this.token.escaped=true;this.token.text=code}}if(!this.token.escaped)this.token.text= escape(this.token.text,true);return”<pre><code“+(this.token.lang?' class=”'+this.options.langPrefix+this.token.lang+'“':”“)+”>“this.token.text
”</code></pre>n“;case ”table“:var body=”“,heading,i,row,cell,j;body+=”<thead>n<tr>n“;for(i=0;i<this.token.header.length;i++){heading=this.inline.output(this.token.header);body+=this.token.align?'<th align=”‘this.token.align[i]
'“>'heading
”</th>n“:”<th>“heading
”</th>n“}body+=”</tr>n</thead>n“;body+=”<tbody>n“;for(i=0;i<this.token.cells.length;i++){row= this.token.cells;body+=”<tr>n“;for(j=0;j<row.length;j++){cell=this.inline.output(row);body+=this.token.align?'<td align=”’this.token.align[j]
'“>'cell
”</td>n“:”<td>“cell
”</td>n“}body+=”</tr>n“}body+=”</tbody>n“;return”<table>n“body
”</table>n“;case ”blockquote_start“:var body=”“;while(this.next().type!==”blockquote_end“)body+=this.tok();return”<blockquote>n“body
”</blockquote>n“;case ”list_start“:var type=this.token.ordered?”ol“:”ul“,body=”“;while(this.next().type!==”list_end“)body+= this.tok();return”<“type
”>n“body
”</“type
”>n“;case ”list_item_start“:var body=”“;while(this.next().type!==”list_item_end“)body+=this.token.type===”text“?this.parseText():this.tok();return”<li>“body
”</li>n“;case ”loose_item_start“:var body=”“;while(this.next().type!==”list_item_end“)body+=this.tok();return”<li>“body
”</li>n“;case ”html“:return!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case ”paragraph“:return”<p>“+this.inline.output(this.token.text)+ ”</p>n“;case ”text“:return”<p>“+this.parseText()+”</p>n“}};function escape(html,encode){return html.replace(!encode?/&(?!#?w+;)/g:/&/g,”&“).replace(/</g,”<“).replace(/>/g,”>“).replace(/”/g,“"”).replace(/'/g,“'”)}function replace(regex,opt){regex=regex.source;opt=opt||“”;return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^)^/g,“$1”);regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i= 1,target,key;for(;i<arguments.length;i++){target=arguments;for(key in target)if(Object.prototype.hasOwnProperty.call(target,key))obj=target}return obj}function marked(src,opt,callback){if(callback||typeof opt===“function”){if(!callback){callback=opt;opt=null}if(opt)opt=merge({},marked.defaults,opt);var tokens=Lexer.lex(tokens,opt),highlight=opt.highlight,pending=0,l=tokens.length,i=0;if(!highlight||highlight.length<3)return callback(null,Parser.parse(tokens,opt));var done=function(){delete opt.highlight; var out=Parser.parse(tokens,opt);opt.highlight=highlight;return callback(null,out)};for(;i<l;i++)(function(token){if(token.type!==“code”)return;pending++;return highlight(token.text,token.lang,function(err,code){if(code==null||code===token.text)return–pending||done();token.text=code;token.escaped=true;–pending||done()})})(tokens);return}try{if(opt)opt=merge({},marked.defaults,opt);return Parser.parse(Lexer.lex(src,opt),opt)}catch(e){e.message+=“nPlease report this to github.com/chjj/marked.”; if((opt||marked.defaults).silent)return“<p>An error occured:</p><pre>”+escape(e.message+“”,true)+“</pre>”;throw e;}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:“”};marked.Parser=Parser;marked.parser=Parser.parse;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output; marked.parse=marked;if(typeof exports===“object”)module.exports=marked;else if(typeof define===“function”&&define.amd)define(function(){return marked});else this.marked=marked}).call(function(){return this||(typeof window!==“undefined”?window:global)}());