mirror of
https://github.com/zhigang1992/docsify.git
synced 2026-04-27 00:15:17 +08:00
[build] 4.7.0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>4.6.10</small>
|
||||
# docsify <small>4.7.0</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
@@ -343,7 +343,9 @@ function main(config) {
|
||||
'</button>' +
|
||||
'<aside class="sidebar">' +
|
||||
(config.name ?
|
||||
("<h1><a class=\"app-name-link\" data-nosearch>" + (config.name) + "</a></h1>") :
|
||||
("<h1><a class=\"app-name-link\" data-nosearch>" + (config.logo ?
|
||||
("<img alt=" + (config.name) + " src=" + (config.logo) + ">") :
|
||||
config.name) + "</a></h1>") :
|
||||
'') +
|
||||
'<div class="sidebar-nav"><!--sidebar--></div>' +
|
||||
'</aside>';
|
||||
@@ -3120,7 +3122,7 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
title = str;
|
||||
|
||||
if (
|
||||
!/:|(\/{2})/.test(href) &&
|
||||
!isAbsolutePath(href) &&
|
||||
!_self._matchNotCompileLink(href) &&
|
||||
!config.ignore
|
||||
) {
|
||||
@@ -3175,6 +3177,16 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
attrs += " title=\"" + title + "\"";
|
||||
}
|
||||
|
||||
var size = config.size;
|
||||
if (size) {
|
||||
var sizes = size.split('x');
|
||||
if (sizes[1]) {
|
||||
attrs += 'width=' + sizes[0] + ' height=' + sizes[1];
|
||||
} else {
|
||||
attrs += 'width=' + sizes[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAbsolutePath(href)) {
|
||||
url = getPath(contentBase, getParentPath(router.getCurrentPath()), href);
|
||||
}
|
||||
@@ -3208,7 +3220,6 @@ Compiler.prototype.sidebar = function sidebar (text, level) {
|
||||
|
||||
if (text) {
|
||||
html = this.compile(text);
|
||||
html = html && html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0];
|
||||
} else {
|
||||
var tree$$1 = this.cacheTree[currentPath] || genTree(this.toc, level);
|
||||
html = tree(tree$$1, '<ul>');
|
||||
@@ -3492,7 +3503,7 @@ function highlight(path) {
|
||||
if (!last) {
|
||||
return
|
||||
}
|
||||
var li = nav[getNavKey(path, last.getAttribute('data-id'))];
|
||||
var li = nav[getNavKey(decodeURIComponent(path), last.getAttribute('data-id'))];
|
||||
|
||||
if (!li || li === active) {
|
||||
return
|
||||
@@ -3590,38 +3601,45 @@ function scroll2Top(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];
|
||||
var token;
|
||||
var step = 0;
|
||||
var count = 1;
|
||||
|
||||
if (!token) {
|
||||
if (!embedTokens.length) {
|
||||
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'
|
||||
);
|
||||
while ((token = embedTokens[step++])) {
|
||||
var next = (function (token) {
|
||||
return 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});
|
||||
if (++count >= step) {
|
||||
cb({});
|
||||
}
|
||||
}
|
||||
}
|
||||
cb({token: token, embedToken: embedToken});
|
||||
walkFetchEmbed({step: ++step, compile: compile, embedTokens: embedTokens, fetch: fetch}, cb);
|
||||
};
|
||||
})(token);
|
||||
|
||||
{
|
||||
get(token.embed.url).then(next);
|
||||
{
|
||||
get(token.embed.url).then(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3706,7 +3724,9 @@ function formatUpdated(html, updated, fn) {
|
||||
updated =
|
||||
typeof fn === 'function' ?
|
||||
fn(updated) :
|
||||
typeof fn === 'string' ? tinydate(fn)(new Date(updated)) : updated;
|
||||
typeof fn === 'string' ?
|
||||
tinydate(fn)(new Date(updated)) :
|
||||
updated;
|
||||
|
||||
return html.replace(/{docsify-updated}/g, updated)
|
||||
}
|
||||
@@ -3911,6 +3931,10 @@ function initRender(vm) {
|
||||
html += cover();
|
||||
}
|
||||
|
||||
if (config.logo) {
|
||||
config.logo = getPath(vm.router.getBasePath(), config.logo);
|
||||
}
|
||||
|
||||
html += main(config);
|
||||
// Render main app
|
||||
vm._renderTo(el, html, true);
|
||||
@@ -4577,7 +4601,7 @@ initGlobalAPI();
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.6.10';
|
||||
Docsify.version = '4.7.0';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
||||
2
lib/docsify.min.js
vendored
2
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -485,7 +485,7 @@ var install = function (hook, vm) {
|
||||
var attributes = ref.attributes;
|
||||
var body = ref.body;
|
||||
|
||||
Docsify.util.merge(vm.config, attributes.config);
|
||||
vm.frontmatter = attributes;
|
||||
|
||||
return body
|
||||
});
|
||||
|
||||
2
lib/plugins/front-matter.min.js
vendored
2
lib/plugins/front-matter.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){var e=[],n=[],t=0,r={regLevel:new RegExp("^([\\s\\-]+)"),invalidLine:new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),dashesString:new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),quotesString:new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),float:new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),integer:new RegExp("^[+-]?[0-9]+$"),array:new RegExp("\\[\\s*(.*)\\s*\\]"),map:new RegExp("\\{\\s*(.*)\\s*\\}"),key_value:new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)","i"),single_key_value:new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$","i"),key:new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?","i"),item:new RegExp("^-\\s+"),trim:new RegExp("^\\s+|\\s+$"),comment:new RegExp("([^\\'\\\"#]+([\\'\\\"][^\\'\\\"]*[\\'\\\"])*)*(#.*)?")};function i(e){return{parent:null,length:0,level:e,lines:[],children:[],addChild:function(e){this.children.push(e),e.parent=this,++this.length}}}function l(e){var n=null;if("true"==(e=e.replace(r.trim,"")))return!0;if("false"==e)return!1;if(".NaN"==e)return Number.NaN;if("null"==e)return null;if(".inf"==e)return Number.POSITIVE_INFINITY;if("-.inf"==e)return Number.NEGATIVE_INFINITY;if(n=e.match(r.dashesString))return n[1];if(n=e.match(r.quotesString))return n[1];if(n=e.match(r.float))return parseFloat(n[0]);if(n=e.match(r.integer))return parseInt(n[0]);if(isNaN(n=Date.parse(e))){if(n=e.match(r.single_key_value)){return(u={})[n[1]]=l(n[2]),u}if(n=e.match(r.array)){for(var t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(l(a)),a="";continue}}else--t;else++t;a+=i}return a.length>0&&u.push(l(a)),u}if(n=e.match(r.map)){for(t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(a),a="";continue}}else--t;else++t;a+=i}a.length>0&&u.push(a);var o={};for(f=0,h=u.length;f<h;++f)(n=u[f].match(r.key_value))&&(o[n[1]]=l(n[2]));return o}return e}return new Date(n)}function u(e){for(var n=e.lines,t=e.children,r=[n.join(" ")],i=0,l=t.length;i<l;++i)r.push(u(t[i]));return r.join("\n")}function a(e){for(var n=e.lines,t=e.children,r=n.join("\n"),i=0,l=t.length;i<l;++i)r+=a(t[i]);return r}function s(t){return function t(i){for(var s=null,f={},h=null,o=null,c=null,p=-1,g=[],v=!0,d=0,m=i.length;d<m;++d)if(-1==p||p==i[d].level){g.push(d),p=i[d].level,h=i[d].lines,o=i[d].children,c=null;for(var w=0,E=h.length;w<E;++w){var x=h[w];if(s=x.match(r.key)){var y=s[1];if("-"==y[0]&&(y=y.replace(r.item,""),v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0),void 0!==s[2]){var b=s[2].replace(r.trim,"");if("&"==b[0]){var R=t(o);null!=c?c[y]=R:f[y]=R,n[b.substr(1)]=R}else if("|"==b[0])null!=c?c[y]=a(o.shift()):f[y]=a(o.shift());else if("*"==b[0]){var N=b.substr(1),_={};if(void 0===n[N])e.push("Reference '"+N+"' not found!");else{for(var $ in n[N])_[$]=n[N][$];null!=c?c[y]=_:f[y]=_}}else">"==b[0]?null!=c?c[y]=u(o.shift()):f[y]=u(o.shift()):null!=c?c[y]=l(b):f[y]=l(b)}else null!=c?c[y]=t(o):f[y]=t(o)}else{if(x.match(/^-\s*$/)){v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0;continue}if(s=x.match(/^-\s*(.*)/)){null!=c?c.push(l(s[1])):(v&&(v=!1,void 0===f.length&&(f=[])),f.push(l(s[1])));continue}}}null!=c&&(v&&(v=!1,void 0===f.length&&(f=[])),f.push(c))}for(d=g.length-1;d>=0;--d)i.splice.call(i,g[d],1);return f}(t.children)}function f(l){e=[],n=[],t=(new Date).getTime();var u=s(function(n){var t,l=r.regLevel,u=r.invalidLine,a=n.split("\n"),s=0,f=0,h=[],o=new i(-1),c=new i(0);o.addChild(c);var p=[],g="";h.push(c),p.push(s);for(var v=0,d=a.length;v<d;++v)if(!(g=a[v]).match(u)){if((s=(t=l.exec(g))?t[1].length:0)>f){var m=c;c=new i(s),m.addChild(c),h.push(c),p.push(s)}else if(s<f){for(var w=!1,E=p.length-1;E>=0;--E)if(p[E]==s){c=new i(s),h.push(c),p.push(s),null!=h[E].parent&&h[E].parent.addChild(c),w=!0;break}if(!w)return void e.push("Error: Invalid indentation at line "+v+": "+g)}c.lines.push(g.replace(r.trim,"")),f=s}return o}(function(e){var n,t=e.split("\n"),i=r.comment;for(var l in t)(n=t[l].match(i))&&void 0!==n[3]&&(t[l]=n[0].substr(0,n[0].length-n[3].length));return t.join("\n")}(l)));return t=(new Date).getTime()-t,u}var h=new RegExp("^(\\ufeff?(= yaml =|---)$([\\s\\S]*?)(?:\\2|\\.\\.\\.)$(?:\\n)?)","m");function o(e){var n=(e=e||"").split(/(\r?\n)/);return n[0]&&/= yaml =|---/.test(n[0])?function(e){var n=h.exec(e);if(!n)return{attributes:{},body:e};var t=n[n.length-1].replace(/^\s+|\s+$/g,""),r=f(t)||{},i=e.replace(n[0],"");return{attributes:r,body:i,frontmatter:t}}(e):{attributes:{},body:e}}$docsify.plugins=[].concat(function(e,n){e.beforeEach(function(e){var t=o(e),r=t.attributes,i=t.body;return Docsify.util.merge(n.config,r.config),i})},$docsify.plugins)}();
|
||||
!function(){var e=[],n=[],t=0,r={regLevel:new RegExp("^([\\s\\-]+)"),invalidLine:new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),dashesString:new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),quotesString:new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),float:new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),integer:new RegExp("^[+-]?[0-9]+$"),array:new RegExp("\\[\\s*(.*)\\s*\\]"),map:new RegExp("\\{\\s*(.*)\\s*\\}"),key_value:new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)","i"),single_key_value:new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$","i"),key:new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?","i"),item:new RegExp("^-\\s+"),trim:new RegExp("^\\s+|\\s+$"),comment:new RegExp("([^\\'\\\"#]+([\\'\\\"][^\\'\\\"]*[\\'\\\"])*)*(#.*)?")};function i(e){return{parent:null,length:0,level:e,lines:[],children:[],addChild:function(e){this.children.push(e),e.parent=this,++this.length}}}function l(e){var n=null;if("true"==(e=e.replace(r.trim,"")))return!0;if("false"==e)return!1;if(".NaN"==e)return Number.NaN;if("null"==e)return null;if(".inf"==e)return Number.POSITIVE_INFINITY;if("-.inf"==e)return Number.NEGATIVE_INFINITY;if(n=e.match(r.dashesString))return n[1];if(n=e.match(r.quotesString))return n[1];if(n=e.match(r.float))return parseFloat(n[0]);if(n=e.match(r.integer))return parseInt(n[0]);if(isNaN(n=Date.parse(e))){if(n=e.match(r.single_key_value)){return(u={})[n[1]]=l(n[2]),u}if(n=e.match(r.array)){for(var t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(l(a)),a="";continue}}else--t;else++t;a+=i}return a.length>0&&u.push(l(a)),u}if(n=e.match(r.map)){for(t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(a),a="";continue}}else--t;else++t;a+=i}a.length>0&&u.push(a);var o={};for(f=0,h=u.length;f<h;++f)(n=u[f].match(r.key_value))&&(o[n[1]]=l(n[2]));return o}return e}return new Date(n)}function u(e){for(var n=e.lines,t=e.children,r=[n.join(" ")],i=0,l=t.length;i<l;++i)r.push(u(t[i]));return r.join("\n")}function a(e){for(var n=e.lines,t=e.children,r=n.join("\n"),i=0,l=t.length;i<l;++i)r+=a(t[i]);return r}function s(t){return function t(i){for(var s=null,f={},h=null,o=null,c=null,p=-1,g=[],v=!0,d=0,m=i.length;d<m;++d)if(-1==p||p==i[d].level){g.push(d),p=i[d].level,h=i[d].lines,o=i[d].children,c=null;for(var w=0,E=h.length;w<E;++w){var x=h[w];if(s=x.match(r.key)){var b=s[1];if("-"==b[0]&&(b=b.replace(r.item,""),v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0),void 0!==s[2]){var y=s[2].replace(r.trim,"");if("&"==y[0]){var R=t(o);null!=c?c[b]=R:f[b]=R,n[y.substr(1)]=R}else if("|"==y[0])null!=c?c[b]=a(o.shift()):f[b]=a(o.shift());else if("*"==y[0]){var N=y.substr(1),_={};if(void 0===n[N])e.push("Reference '"+N+"' not found!");else{for(var $ in n[N])_[$]=n[N][$];null!=c?c[b]=_:f[b]=_}}else">"==y[0]?null!=c?c[b]=u(o.shift()):f[b]=u(o.shift()):null!=c?c[b]=l(y):f[b]=l(y)}else null!=c?c[b]=t(o):f[b]=t(o)}else{if(x.match(/^-\s*$/)){v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0;continue}if(s=x.match(/^-\s*(.*)/)){null!=c?c.push(l(s[1])):(v&&(v=!1,void 0===f.length&&(f=[])),f.push(l(s[1])));continue}}}null!=c&&(v&&(v=!1,void 0===f.length&&(f=[])),f.push(c))}for(d=g.length-1;d>=0;--d)i.splice.call(i,g[d],1);return f}(t.children)}function f(l){e=[],n=[],t=(new Date).getTime();var u=s(function(n){var t,l=r.regLevel,u=r.invalidLine,a=n.split("\n"),s=0,f=0,h=[],o=new i(-1),c=new i(0);o.addChild(c);var p=[],g="";h.push(c),p.push(s);for(var v=0,d=a.length;v<d;++v)if(!(g=a[v]).match(u)){if((s=(t=l.exec(g))?t[1].length:0)>f){var m=c;c=new i(s),m.addChild(c),h.push(c),p.push(s)}else if(s<f){for(var w=!1,E=p.length-1;E>=0;--E)if(p[E]==s){c=new i(s),h.push(c),p.push(s),null!=h[E].parent&&h[E].parent.addChild(c),w=!0;break}if(!w)return void e.push("Error: Invalid indentation at line "+v+": "+g)}c.lines.push(g.replace(r.trim,"")),f=s}return o}(function(e){var n,t=e.split("\n"),i=r.comment;for(var l in t)(n=t[l].match(i))&&void 0!==n[3]&&(t[l]=n[0].substr(0,n[0].length-n[3].length));return t.join("\n")}(l)));return t=(new Date).getTime()-t,u}var h=new RegExp("^(\\ufeff?(= yaml =|---)$([\\s\\S]*?)(?:\\2|\\.\\.\\.)$(?:\\n)?)","m");function o(e){var n=(e=e||"").split(/(\r?\n)/);return n[0]&&/= yaml =|---/.test(n[0])?function(e){var n=h.exec(e);if(!n)return{attributes:{},body:e};var t=n[n.length-1].replace(/^\s+|\s+$/g,""),r=f(t)||{},i=e.replace(n[0],"");return{attributes:r,body:i,frontmatter:t}}(e):{attributes:{},body:e}}$docsify.plugins=[].concat(function(e,n){e.beforeEach(function(e){var t=o(e),r=t.attributes,i=t.body;return n.frontmatter=r,i})},$docsify.plugins)}();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.6.10"
|
||||
"version": "4.7.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.6.10",
|
||||
"version": "4.7.0",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
Reference in New Issue
Block a user