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 @@ ![logo](_media/icon.svg) -# 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=a.length)r(n);else if("function"==typeof t)if(2===t.length)t(n,function(t){n=t,o(e+1)});else{var i=t(n);n=void 0!==i?i:n,o(e+1)}else o(e+1)};o(0)}var h=!0,p=h&&document.body.clientWidth<=600,d=h&&window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/),g={};function f(e,t){if(void 0===t&&(t=!1),"string"==typeof e){if(void 0!==window.Vue)return y(e);e=t?y(e):g[e]||(g[e]=y(e))}return e}var m=h&&document,v=h&&m.body,b=h&&m.head;function y(e,t){return t?e.querySelector(t):m.querySelector(e)}function k(e,t){return[].slice.call(t?e.querySelectorAll(t):m.querySelectorAll(e))}function w(e,t){return e=m.createElement(e),t&&(e.innerHTML=t),e}function x(e,t){return e.appendChild(t)}function _(e,t){return e.insertBefore(t,e.children[0])}function S(e,t,n){a(t)?window.addEventListener(e,t):e.addEventListener(t,n)}function L(e,t,n){a(t)?window.removeEventListener(e,t):e.removeEventListener(t,n)}function C(e,t,n){e&&e.classList[n?t:"toggle"](n||t)}var E=Object.freeze({getNode:f,$:m,body:v,head:b,find:y,findAll:k,create:w,appendTo:x,before:_,on:S,off:L,toggleClass:C,style:function(e){x(b,w("style",e))}});function $(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='
  • '+e.title+"
  • ",e.children&&(t+='
  • ")}),t):""}function A(e,t){return'

    '+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:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\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",/])*?>/)(/tag/g,t._tag)(),t.paragraph=l(t.paragraph)("hr",t.hr)("heading",t.heading)("lheading",t.lheading)("blockquote",t.blockquote)("tag","<"+t._tag)("def",t.def)(),t.normal=d({},t),t.gfm=d({},t.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),t.gfm.paragraph=l(t.paragraph)("(?!","(?!"+t.gfm.fences.source.replace("\\1","\\2")+"|"+t.list.source.replace("\\1","\\3")+"|")(),t.tables=d({},t.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function n(e){this.tokens=[],this.tokens.links={},this.options=e||g.defaults,this.rules=t.normal,this.options.gfm&&(this.options.tables?this.rules=t.tables:this.rules=t.gfm)}n.rules=t,n.lex=function(e,t){return new n(t).lex(e)},n.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},n.prototype.token=function(e,n,r){var i,a,o,s,l,c,u,h,p;for(e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(n&&(o=this.rules.nptable.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 ?/gm,""),this.token(o,n,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),s=o[2],this.tokens.push({type:"list_start",ordered:s.length>1}),i=!1,p=(o=o[0].match(this.rules.item)).length,h=0;h1&&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])/,autolink:/^<([^ <>]+(@|:\/)[^ <>]+)>/,url:p,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)([\s\S]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:p,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,r.link=l(r.link)("inside",r._inside)("href",r._href)(),r.reflink=l(r.reflink)("inside",r._inside)(),r.normal=d({},r),r.pedantic=d({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),r.gfm=d({},r.normal,{escape:l(r.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:l(r.text)("]|","~]|")("|","|https?://|")()}),r.breaks=d({},r.gfm,{br:l(r.br)("{2,}","*")(),text:l(r.gfm.text)("{2,}","*")()});function i(e,t){if(this.options=t||g.defaults,this.links=e,this.rules=r.normal,this.renderer=this.options.renderer||new a,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=r.breaks:this.rules=r.gfm:this.options.pedantic&&(this.rules=r.pedantic)}i.rules=r,i.output=function(e,t,n){return new i(t,n).output(e)},i.prototype.output=function(e){for(var t,n,r,i,a="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),a+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=s(":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1])),r=this.mangle("mailto:")+n):r=n=s(i[1]),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):s(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,a+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){a+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),a+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),a+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),a+=this.renderer.codespan(s(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),a+=this.renderer.text(s(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),r=n=s(i[1]),a+=this.renderer.link(r,null,n);return a},i.prototype.outputLink=function(e,t){var n=s(t.href),r=t.title?s(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,s(e[1]))},i.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},i.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n};function a(e){this.options=e||{}}a.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
    '+(n?e:s(e,!0))+"\n
    \n":"
    "+(n?e:s(e,!0))+"\n
    "},a.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},a.prototype.html=function(e){return e},a.prototype.heading=function(e,t,n){return"'+e+"\n"},a.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},a.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"\n"},a.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},a.prototype.paragraph=function(e){return"

    "+e+"

    \n"},a.prototype.table=function(e,t){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"},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='
    "},a.prototype.image=function(e,t,n){this.options.baseUrl&&!h.test(e)&&(e=c(this.options.baseUrl,e));var r=''+n+'":">"},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/g,">").replace(/"/g,""").replace(/'/g,"'")}function l(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=(i=i.source||i).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function c(e,t){return u[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?u[" "+e]=e+"/":u[" "+e]=e.replace(/[^/]*$/,"")),e=u[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}var u={},h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(){}p.exec=p;function d(e){for(var t,n,r=arguments,i=1;iAn error occurred:

    "+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=(C+=t[L].length)&&(++y,k=C);if(t[y]instanceof l||t[L-1].greedy)continue;x=L-y,w=e.slice(k,C),$.index-=k}if($){g&&(m=$[1].length);S=(_=$.index+m)+($=$[0].slice(m)).length;var $,A=w.slice(0,_),T=w.slice(S),P=[y,x];A&&(++y,k+=A.length,P.push(A));var O=new l(c,d?r.tokenize($,d):$,v,$,f);if(P.push(O),T&&P.push(T),Array.prototype.splice.apply(t,P),1!=x&&r.matchGrammar(e,t,n,y,k,!0,c),o)break}else if(o)break}}}}},tokenize:function(e,t,n){var i=[e],a=t.rest;if(a){for(var o in a)t[o]=a[o];delete t.rest}return r.matchGrammar(e,i,t,0,0,!1),i},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,a=0;i=n[a++];)i(t)}}},i=r.Token=function(e,t,n,r,i){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!i};if(i.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return i.stringify(n,t,e)}).join("");var a={type:e.type,content:i.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if(e.alias){var o="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(a.classes,o)}r.hooks.run("wrap",a);var s=Object.keys(a.attributes).map(function(e){return e+'="'+(a.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+(s?" "+s:"")+">"+a.content+""},!t.document)return t.addEventListener?(r.disableWorkerMessageHandler||t.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,a=n.code,o=n.immediateClose;t.postMessage(r.highlight(a,r.languages[i],i)),o&&t.close()},!1),t.Prism):t.Prism;var a=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return a&&(r.filename=a.src,r.manual||a.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(r.highlightAll):window.setTimeout(r.highlightAll,16):document.addEventListener("DOMContentLoaded",r.highlightAll))),t.Prism}();e.exports&&(e.exports=n),void 0!==R&&(R.Prism=n),n.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),n.languages.xml=n.languages.markup,n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},n.languages.css.atrule.inside.rest=n.util.clone(n.languages.css),n.languages.markup&&(n.languages.insertBefore("markup","tag",{style:{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:n.languages.css,alias:"language-css",greedy:!0}}),n.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:n.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:n.languages.css}},alias:"language-css"}},n.languages.markup.tag)),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+(?:[Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),n.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"}}),n.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}}}),n.languages.markup&&n.languages.insertBefore("markup","tag",{script:{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:n.languages.javascript,alias:"language-javascript",greedy:!0}}),n.languages.js=n.languages.javascript,"undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector&&(self.Prism.fileHighlight=function(){var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(t){for(var r,i=t.getAttribute("data-src"),a=t,o=/\blang(?:uage)?-(?!\*)(\w+)\b/i;a&&!o.test(a.className);)a=a.parentNode;if(a&&(r=(t.className.match(o)||[,""])[1]),!r){var s=(i.match(/\.(\w+)$/)||[,""])[1];r=e[s]||s}var l=document.createElement("code");l.className="language-"+r,t.textContent="",l.textContent="Loading…",t.appendChild(l);var c=new XMLHttpRequest;c.open("GET",i,!0),c.onreadystatechange=function(){4==c.readyState&&(c.status<400&&c.responseText?(l.textContent=c.responseText,n.highlightElement(l)):c.status>=400?l.textContent="✖ Error "+c.status+" while fetching file: "+c.statusText:l.textContent="✖ Error: File does not exist or is empty")},c.send(null)})},document.addEventListener("DOMContentLoaded",self.Prism.fileHighlight))});function I(e,t){var n=[],r={};return e.forEach(function(e){var i=e.level||1,a=i-1;i>t||(r[a]?r[a].children=(r[a].children||[]).concat(e):n.push(e),r[i]=e)}),n}var U={},D=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g;function Y(e){return e.toLowerCase()}function W(e){if("string"!=typeof e)return"";var t=e.trim().replace(/[A-Z]+/g,Y).replace(/<[^>\d]+>/g,"").replace(D,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),n=U[t];return n=U.hasOwnProperty(t)?n+1:0,U[t]=n,n&&(t=t+"-"+n),t}W.clear=function(){U={}};function G(e,t){return''+t+''}var X=decodeURIComponent,V=encodeURIComponent;function Z(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("=");t[n[0]]=n[1]&&X(n[1])}),t):t}function J(e,t){void 0===t&&(t=[]);var n=[];for(var r in e)t.indexOf(r)>-1||n.push(e[r]?(V(r)+"="+V(e[r])).toLowerCase():V(r));return n.length?"?"+n.join("&"):""}function Q(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return te(e.join("/"))}var K=e(function(e){return/(:|(\/{2}))/g.test(e)}),ee=e(function(e){return/\/$/g.test(e)?e:(e=e.match(/(\S*\/)[^\/]+$/))?e[1]:""}),te=e(function(e){return e.replace(/^\/+/,"/").replace(/([^:])\/{2,}/g,"$1/")}),ne=e(function(e){return e.replace("#","?id=")}),re={},ie=0;function ae(e){void 0===e&&(e="");var t={};return e&&(e=e.replace(/:([\w-]+)=?([\w-]+)?/g,function(e,n,r){return t[n]=r&&r.replace(/"/g,"")||!0,""}).trim()),{str:e,config:t}}var oe={markdown:function(e){var t=this,n="docsify-get-"+ie++;return M(e,!1).then(function(e){document.getElementById(n).innerHTML=t.compile(e)}),'
    "},video:function(e,t){return'"},audio:function(e,t){return'"},code:function(e,t){var n=this,r="docsify-get-"+ie++,i=e.match(/\.(\w+)$/);return"md"===(i=t||i&&i[1])&&(i="markdown"),M(e,!1).then(function(e){document.getElementById(r).innerHTML=n.compile("```"+i+"\n"+e.replace(/`/g,"@qm@")+"\n```\n").replace(/@qm@/g,"`")}),'
    '+e+""},a.code=e.code=function(e,t){void 0===t&&(t="");return'
    '+B.highlight(e,B.languages[t]||B.languages.markup)+"
    "},a.link=e.link=function(e,a,o){void 0===a&&(a="");var s="",l=ae(a),c=l.str,u=l.config;if(a=c,u.include){K(e)||(e=Q(r,e));var h;if(u.type&&(h=oe[u.type]))return h.call(i,e,a);var p="code";return/\.(md|markdown)/.test(e)?p="markdown":/\.html?/.test(e)?p="iframe":/\.(mp4|ogg)/.test(e)?p="video":/\.mp3/.test(e)&&(p="audio"),oe[p].call(i,e,a)}return/:|(\/{2})/.test(e)||i.matchNotCompileLink(e)||u.ignore?s+=' target="'+t+'"':(e===i.config.homepage&&(e="README"),e=n.toURL(e,null,n.getCurrentPath())),u.target&&(s+=" target="+u.target),u.disabled&&(s+=" disabled",e="javascript:void(0)"),a&&(s+=' title="'+a+'"'),'"+o+""},a.paragraph=e.paragraph=function(e){return/^!>/.test(e)?A("tip",e):/^\?>/.test(e)?A("warn",e):"

    "+e+"

    "},a.image=e.image=function(e,t,n){var i=e,a="",o=ae(t);return t=o.str,o.config["no-zoom"]&&(a+=" data-no-zoom"),t&&(a+=' title="'+t+'"'),K(e)||(i=Q(r,e)),''+n+'"};var o=/^\[([ x])\] +/;return a.listitem=e.listitem=function(e){var t=o.exec(e);return t&&(e=e.replace(o,'")),""+e+"\n"},e.origin=a,e},se.prototype.sidebar=function(e,t){var n=this.router.getCurrentPath(),r="";if(e)r=(r=this.compile(e))&&r.match(/]*>([\s\S]+)<\/ul>/g)[0];else{var i=this.cacheTree[n]||I(this.toc,t);r=$(i,"