diff --git a/docs/_coverpage.md b/docs/_coverpage.md index f8295695..d87ad690 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@  -# docsify 4.6.0 +# docsify 4.6.1 > A magical documentation site generator. diff --git a/lib/docsify.js b/lib/docsify.js index 7b434f7c..3e797af9 100644 --- a/lib/docsify.js +++ b/lib/docsify.js @@ -5,8 +5,9 @@ function cached (fn) { var cache = Object.create(null); return function cachedFn (str) { - var hit = cache[str]; - return hit || (cache[str] = fn(str)) + var key = isPrimitive(str) ? str : JSON.stringify(str); + var hit = cache[key]; + return hit || (cache[key] = fn(str)) } } @@ -2876,7 +2877,6 @@ var replaceSlug = cached(function (path) { }); var cachedLinks = {}; -var uid = 0; function getAndRemoveConfig (str) { if ( str === void 0 ) str = ''; @@ -2894,46 +2894,37 @@ function getAndRemoveConfig (str) { return { str: str, config: config } } + var compileMedia = { markdown: function markdown (url) { - var this$1 = this; - - var id = "docsify-get-" + (uid++); - - { - get(url, false).then(function (text) { - document.getElementById(id).innerHTML = this$1.compile(text); - }); - - return ("
") + return { + url: url } }, iframe: function iframe (url, title) { - return ("") + return { + code: ("") + } }, video: function video (url, title) { - return ("") + return { + code: ("") + } }, audio: function audio (url, title) { - return ("") + return { + code: ("") + } }, code: function code (url, title) { - var this$1 = this; + var lang = url.match(/\.(\w+)$/); - var id = "docsify-get-" + (uid++); - var ext = url.match(/\.(\w+)$/); + lang = title || (lang && lang[1]); + if (lang === 'md') { lang = 'markdown'; } - ext = title || (ext && ext[1]); - if (ext === 'md') { ext = 'markdown'; } - - { - get(url, false).then(function (text) { - document.getElementById(id).innerHTML = this$1.compile( - '```' + ext + '\n' + text.replace(/`/g, '@qm@') + '\n```\n' - ).replace(/@qm@/g, '`'); - }); - - return ("") + return { + url: url, + lang: lang } } }; @@ -2961,12 +2952,18 @@ var Compiler = function Compiler (config, router) { compile = marked; } + this._marked = compile; this.compile = cached(function (text) { var html = ''; if (!text) { return text } - html = compile(text); + if (isPrimitive(text)) { + html = compile(text); + } else { + html = compile.parser(text); + } + html = config.noEmoji ? html : emojify(html); slugify.clear(); @@ -2974,7 +2971,42 @@ var Compiler = function Compiler (config, router) { }); }; -Compiler.prototype.matchNotCompileLink = function matchNotCompileLink (link) { +Compiler.prototype.compileEmbed = function compileEmbed (href, title) { + var ref = getAndRemoveConfig(title); + var str = ref.str; + var config = ref.config; + var embed; + title = str; + + if (config.include) { + if (!isAbsolutePath(href)) { + href = getPath(this.contentBase, href); + } + + var media; + if (config.type && (media = compileMedia[config.type])) { + embed = media.call(this, href, title); + embed.type = config.type; + } else { + var type = 'code'; + if (/\.(md|markdown)/.test(href)) { + type = 'markdown'; + } else if (/\.html?/.test(href)) { + type = 'iframe'; + } else if (/\.(mp4|ogg)/.test(href)) { + type = 'video'; + } else if (/\.mp3/.test(href)) { + type = 'audio'; + } + embed = compileMedia[type].call(this, href, title); + embed.type = type; + } + + return embed + } +}; + +Compiler.prototype._matchNotCompileLink = function _matchNotCompileLink (link) { var links = this.config.noCompileLinks || []; for (var i = 0; i < links.length; i++) { @@ -3026,6 +3058,7 @@ Compiler.prototype._initRenderer = function _initRenderer () { origin.code = renderer.code = function (code, lang) { if ( lang === void 0 ) lang = ''; + code = code.replace(/@DOCSIFY_QM@/g, '`'); var hl = prism.highlight( code, prism.languages[lang] || prism.languages.markup @@ -3043,33 +3076,9 @@ Compiler.prototype._initRenderer = function _initRenderer () { var config = ref.config; title = str; - if (config.include) { - if (!isAbsolutePath(href)) { - href = getPath(contentBase, href); - } - - var media; - if (config.type && (media = compileMedia[config.type])) { - return media.call(_self, href, title) - } - - var type = 'code'; - if (/\.(md|markdown)/.test(href)) { - type = 'markdown'; - } else if (/\.html?/.test(href)) { - type = 'iframe'; - } else if (/\.(mp4|ogg)/.test(href)) { - type = 'video'; - } else if (/\.mp3/.test(href)) { - type = 'audio'; - } - - return compileMedia[type].call(_self, href, title) - } - if ( !/:|(\/{2})/.test(href) && - !_self.matchNotCompileLink(href) && + !_self._matchNotCompileLink(href) && !config.ignore ) { if (href === _self.config.homepage) { href = 'README'; } @@ -3508,6 +3517,105 @@ function scroll2Top (offset) { scrollEl.scrollTop = offset === true ? 0 : Number(offset); } +var cached$1 = {}; + +function walkFetchEmbed (ref, cb) { + var step = ref.step; if ( step === void 0 ) step = 0; + var embedTokens = ref.embedTokens; + var compile = ref.compile; + var fetch = ref.fetch; + + var token = embedTokens[step]; + + if (!token) { + return cb({}) + } + + var next = function (text) { + var embedToken; + if (text) { + if (token.embed.type === 'markdown') { + embedToken = compile.lexer(text); + } else if (token.embed.type === 'code') { + embedToken = compile.lexer( + '```' + + token.embed.lang + + '\n' + + text.replace(/`/g, '@DOCSIFY_QM@') + + '\n```\n' + ); + } + } + cb({ token: token, embedToken: embedToken }); + walkFetchEmbed({ step: ++step, compile: compile, embedTokens: embedTokens, fetch: fetch }, cb); + }; + + { + get(token.embed.url).then(next); + } +} + +function prerenderEmbed (ref, done) { + var compiler = ref.compiler; + var raw = ref.raw; + var fetch = ref.fetch; + + var hit; + if ((hit = cached$1[raw])) { + return done(hit) + } + + var compile = compiler._marked; + var tokens = compile.lexer(raw); + var embedTokens = []; + var linkRE = compile.InlineLexer.rules.link; + var links = tokens.links; + + tokens.forEach(function (token, index) { + if (token.type === 'paragraph') { + token.text = token.text.replace( + new RegExp(linkRE, 'g'), + function (src, filename, href, title) { + var embed = compiler.compileEmbed(href, title); + + if (embed) { + if (embed.type === 'markdown' || embed.type === 'code') { + embedTokens.push({ + index: index, + embed: embed + }); + } + return embed.code + } + + return src + } + ); + } + }); + + var moveIndex = 0; + walkFetchEmbed({ compile: compile, embedTokens: embedTokens, fetch: fetch }, function (ref) { + var embedToken = ref.embedToken; + var token = ref.token; + + if (token) { + var index = token.index + moveIndex; + + merge(links, embedToken.links); + + tokens = tokens + .slice(0, index) + .concat(embedToken, tokens.slice(index + 1)); + moveIndex += embedToken.length - 1; + } else { + cached$1[raw] = tokens.concat(); + tokens.links = cached$1[raw].links = links; + done(tokens); + } + }); +} + function executeScript () { var script = findAll('.markdown-section>script') .filter(function (s) { return !/template/.test(s.type); })[0]; @@ -3621,7 +3729,7 @@ function renderMixin (proto) { getAndActive(this.router, 'nav'); }; - proto._renderMain = function (text, opt) { + proto._renderMain = function (text, opt, next) { var this$1 = this; if ( opt === void 0 ) opt = {}; @@ -3630,12 +3738,31 @@ function renderMixin (proto) { } callHook(this, 'beforeEach', text, function (result) { - var html = this$1.isHTML ? result : this$1.compiler.compile(result); - if (opt.updatedAt) { - html = formatUpdated(html, opt.updatedAt, this$1.config.formatUpdated); - } + var html; + var callback = function () { + if (opt.updatedAt) { + html = formatUpdated(html, opt.updatedAt, this$1.config.formatUpdated); + } - callHook(this$1, 'afterEach', html, function (text) { return renderMain.call(this$1, text); }); + callHook(this$1, 'afterEach', html, function (text) { return renderMain.call(this$1, text); }); + }; + if (this$1.isHTML) { + html = this$1.result; + callback(); + next(); + } else { + prerenderEmbed( + { + compiler: this$1.compiler, + raw: text + }, + function (tokens) { + html = this$1.compiler.compile(tokens); + callback(); + next(); + } + ); + } }); }; @@ -3736,16 +3863,16 @@ function initRender (vm) { toggleClass(body, 'ready'); } -var cached$1 = {}; +var cached$2 = {}; function getAlias (path, alias, last) { var match = Object.keys(alias).filter(function (key) { - var re = cached$1[key] || (cached$1[key] = new RegExp(("^" + key + "$"))); + var re = cached$2[key] || (cached$2[key] = new RegExp(("^" + key + "$"))); return re.test(path) && path !== last })[0]; return match - ? getAlias(path.replace(cached$1[match], alias[match]), alias, path) + ? getAlias(path.replace(cached$2[match], alias[match]), alias, path) : path } @@ -4074,12 +4201,10 @@ function fetchMixin (proto) { // Load main content last.then( function (text, opt) { - this$1._renderMain(text, opt); - loadSideAndNav(); + this$1._renderMain(text, opt, loadSideAndNav); }, function (_) { - this$1._renderMain(null); - loadSideAndNav(); + this$1._renderMain(null, {}, loadSideAndNav); } ); @@ -4254,7 +4379,7 @@ initGlobalAPI(); /** * Version */ -Docsify.version = '4.6.0'; +Docsify.version = '4.6.1'; /** * Run Docsify diff --git a/lib/docsify.min.js b/lib/docsify.min.js index df9ebedd..c49d6358 100644 --- a/lib/docsify.min.js +++ b/lib/docsify.min.js @@ -1 +1 @@ -!function(){function e(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var t=e(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),n=Object.assign||function(e){for(var t=arguments,n=Object.prototype.hasOwnProperty,r=1;r'+t.slice(5).trim()+"
"}var T,P;function O(e){var t,n=e.loaded,r=e.total,i=e.step;!T&&function(){var e=w("div");e.classList.add("progress"),x(v,e),T=e}(),t=i?(t=parseInt(T.style.width||0,10)+i)>80?80:t:Math.floor(n/r*100),T.style.opacity=1,T.style.width=t>=95?"100%":t+"%",t>=95&&(clearTimeout(P),P=setTimeout(function(e){T.style.opacity=0,T.style.width="0%"},200))}var F={};function M(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});var r=new XMLHttpRequest,a=function(){r.addEventListener.apply(r,arguments)},o=F[e];if(o)return{then:function(e){return e(o.content,o.opt)},abort:i};r.open("GET",e);for(var s in n)r.setRequestHeader(s,n[s]);return r.send(),{then:function(n,o){if(void 0===o&&(o=i),t){var s=setInterval(function(e){return O({step:Math.floor(5*Math.random()+1)})},500);a("progress",O),a("loadend",function(e){O(e),clearInterval(s)})}a("error",o),a("load",function(t){var i=t.target;if(i.status>=400)o(i);else{var a=F[e]={content:i.response,opt:{updatedAt:r.getResponseHeader("last-modified")}};n(a.content,a.opt)}})},abort:function(e){return 4!==r.readyState&&r.abort()}}}function j(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}var q=/([^{]*?)\w(?=\})/g,N={YYYY:"getFullYear",YY:"getYear",MM:function(e){return e.getMonth()+1},DD:"getDate",HH:"getHours",mm:"getMinutes",ss:"getSeconds"};var R="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function H(e,t){return e(t={exports:{}},t.exports),t.exports}var z=H(function(e,t){(function(){var t={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:p,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:p,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:p,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=l(t.item,"gm")(/bull/g,t.bullet)(),t.list=l(t.list)(/bull/g,t.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+t.def.source+")")(),t.blockquote=l(t.blockquote)("def",t.def)(),t._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+(?!:/|[^\\w\\s@]*@)\\b",t.html=l(t.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/1&&l.length>1||(e=o.slice(h+1).join("\n")+e,h=p-1)),a=i||/\n\n(?!\s*$)/.test(c),h!==p-1&&(i="\n"===c.charAt(c.length-1),a||(a=i)),this.tokens.push({type:a?"loose_item_start":"list_item_start"}),this.token(c,!1,r),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!r&&n&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(n&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),c={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},h=0;h "+e+"
\n":"'+(n?e:s(e,!0))+"\n
"},a.prototype.blockquote=function(e){return""+(n?e:s(e,!0))+"\n\n"+e+"
\n"},a.prototype.html=function(e){return e},a.prototype.heading=function(e,t,n){return"
\n":"
\n"},a.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+""+n+">\n"},a.prototype.listitem=function(e){return"\n\n"+e+"\n\n"+t+"\n
\n"},a.prototype.tablerow=function(e){return"\n"+e+" \n"},a.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+""+n+">\n"},a.prototype.strong=function(e){return""+e+""},a.prototype.em=function(e){return""+e+""},a.prototype.codespan=function(e){return""+e+""},a.prototype.br=function(){return this.options.xhtml?"
":"
"},a.prototype.del=function(e){return""+e+""},a.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent((i=e,i.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}var i;this.options.baseUrl&&!h.test(e)&&(e=c(this.options.baseUrl,e));var a='"+n+""},a.prototype.image=function(e,t,n){this.options.baseUrl&&!h.test(e)&&(e=c(this.options.baseUrl,e));var r='":">"},a.prototype.text=function(e){return e};function o(e){this.tokens=[],this.token=null,this.options=e||g.defaults,this.options.renderer=this.options.renderer||new a,this.renderer=this.options.renderer,this.renderer.options=this.options}o.parse=function(e,t,n){return new o(t,n).parse(e)},o.prototype.parse=function(e){this.inline=new i(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i="",a="";for(n="",e=0;e
"+s(e.message+"",!0)+"";throw e}}g.options=g.setOptions=function(e){return d(g.defaults,e),g},g.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new a,xhtml:!1,baseUrl:null},g.Parser=o,g.parser=o.parse,g.Renderer=a,g.Lexer=n,g.lexer=n.lex,g.InlineLexer=i,g.inlineLexer=i.output,g.parse=g,e.exports=g}).call(function(){return this||("undefined"!=typeof window?window:R)}())}),B=H(function(e){var t="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},n=function(){var e=/\blang(?:uage)?-(\w+)\b/i,n=0,r=t.Prism={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof i?new i(e.type,r.util.encode(e.content),e.alias):"Array"===r.util.type(e)?e.map(r.util.encode):e.replace(/&/g,"&").replace(/e.length)return;if(!(w instanceof l)){p.lastIndex=0;var x=1;if(!($=p.exec(w))&&f&&y!=t.length-1){if(p.lastIndex=k,!($=p.exec(e)))break;for(var _=$.index+(g?$[1].length:0),S=$.index+$[0].length,L=y,C=k,E=t.length;L
'+t.slice(5).trim()+"
"}var T,P;function O(e){var t,n=e.loaded,r=e.total,i=e.step;!T&&function(){var e=w("div");e.classList.add("progress"),x(v,e),T=e}(),t=i?(t=parseInt(T.style.width||0,10)+i)>80?80:t:Math.floor(n/r*100),T.style.opacity=1,T.style.width=t>=95?"100%":t+"%",t>=95&&(clearTimeout(P),P=setTimeout(function(e){T.style.opacity=0,T.style.width="0%"},200))}var F={};function M(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});var r=new XMLHttpRequest,a=function(){r.addEventListener.apply(r,arguments)},o=F[e];if(o)return{then:function(e){return e(o.content,o.opt)},abort:i};r.open("GET",e);for(var s in n)r.setRequestHeader(s,n[s]);return r.send(),{then:function(n,o){if(void 0===o&&(o=i),t){var s=setInterval(function(e){return O({step:Math.floor(5*Math.random()+1)})},500);a("progress",O),a("loadend",function(e){O(e),clearInterval(s)})}a("error",o),a("load",function(t){var i=t.target;if(i.status>=400)o(i);else{var a=F[e]={content:i.response,opt:{updatedAt:r.getResponseHeader("last-modified")}};n(a.content,a.opt)}})},abort:function(e){return 4!==r.readyState&&r.abort()}}}function j(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}var N=/([^{]*?)\w(?=\})/g,q={YYYY:"getFullYear",YY:"getYear",MM:function(e){return e.getMonth()+1},DD:"getDate",HH:"getHours",mm:"getMinutes",ss:"getSeconds"};var R="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function H(e,t){return e(t={exports:{}},t.exports),t.exports}var z=H(function(e,t){(function(){var t={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:p,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:p,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:p,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=l(t.item,"gm")(/bull/g,t.bullet)(),t.list=l(t.list)(/bull/g,t.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+t.def.source+")")(),t.blockquote=l(t.blockquote)("def",t.def)(),t._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+(?!:/|[^\\w\\s@]*@)\\b",t.html=l(t.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/1&&l.length>1||(e=o.slice(h+1).join("\n")+e,h=p-1)),a=i||/\n\n(?!\s*$)/.test(c),h!==p-1&&(i="\n"===c.charAt(c.length-1),a||(a=i)),this.tokens.push({type:a?"loose_item_start":"list_item_start"}),this.token(c,!1,r),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!r&&n&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(n&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),c={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},h=0;h "+e+"
\n":"'+(n?e:s(e,!0))+"\n
"},a.prototype.blockquote=function(e){return""+(n?e:s(e,!0))+"\n\n"+e+"
\n"},a.prototype.html=function(e){return e},a.prototype.heading=function(e,t,n){return"
\n":"
\n"},a.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+""+n+">\n"},a.prototype.listitem=function(e){return"\n\n"+e+"\n\n"+t+"\n
\n"},a.prototype.tablerow=function(e){return"\n"+e+" \n"},a.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+""+n+">\n"},a.prototype.strong=function(e){return""+e+""},a.prototype.em=function(e){return""+e+""},a.prototype.codespan=function(e){return""+e+""},a.prototype.br=function(){return this.options.xhtml?"
":"
"},a.prototype.del=function(e){return""+e+""},a.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent((i=e,i.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}var i;this.options.baseUrl&&!h.test(e)&&(e=c(this.options.baseUrl,e));var a='"+n+""},a.prototype.image=function(e,t,n){this.options.baseUrl&&!h.test(e)&&(e=c(this.options.baseUrl,e));var r='":">"},a.prototype.text=function(e){return e};function o(e){this.tokens=[],this.token=null,this.options=e||g.defaults,this.options.renderer=this.options.renderer||new a,this.renderer=this.options.renderer,this.renderer.options=this.options}o.parse=function(e,t,n){return new o(t,n).parse(e)},o.prototype.parse=function(e){this.inline=new i(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i="",a="";for(n="",e=0;e
"+s(e.message+"",!0)+"";throw e}}g.options=g.setOptions=function(e){return d(g.defaults,e),g},g.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new a,xhtml:!1,baseUrl:null},g.Parser=o,g.parser=o.parse,g.Renderer=a,g.Lexer=n,g.lexer=n.lex,g.InlineLexer=i,g.inlineLexer=i.output,g.parse=g,e.exports=g}).call(function(){return this||("undefined"!=typeof window?window:R)}())}),I=H(function(e){var t="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},n=function(){var e=/\blang(?:uage)?-(\w+)\b/i,n=0,r=t.Prism={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof i?new i(e.type,r.util.encode(e.content),e.alias):"Array"===r.util.type(e)?e.map(r.util.encode):e.replace(/&/g,"&").replace(/e.length)return;if(!(w instanceof l)){p.lastIndex=0;var x=1;if(!($=p.exec(w))&&f&&y!=t.length-1){if(p.lastIndex=k,!($=p.exec(e)))break;for(var _=$.index+(g?$[1].length:0),S=$.index+$[0].length,C=y,L=k,E=t.length;C