[build] 4.7.0
This commit is contained in:
parent
490242fb73
commit
3c94178805
8 changed files with 59 additions and 35 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue