Skip to content

Commit 3c94178

Browse files
committed
[build] 4.7.0
1 parent 490242f commit 3c94178

File tree

8 files changed

+59
-35
lines changed

8 files changed

+59
-35
lines changed

docs/_coverpage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![logo](_media/icon.svg)
22

3-
# docsify <small>4.6.10</small>
3+
# docsify <small>4.7.0</small>
44

55
> A magical documentation site generator.
66

lib/docsify.js

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ function main(config) {
343343
'</button>' +
344344
'<aside class="sidebar">' +
345345
(config.name ?
346-
("<h1><a class=\"app-name-link\" data-nosearch>" + (config.name) + "</a></h1>") :
346+
("<h1><a class=\"app-name-link\" data-nosearch>" + (config.logo ?
347+
("<img alt=" + (config.name) + " src=" + (config.logo) + ">") :
348+
config.name) + "</a></h1>") :
347349
'') +
348350
'<div class="sidebar-nav"><!--sidebar--></div>' +
349351
'</aside>';
@@ -3120,7 +3122,7 @@ Compiler.prototype._initRenderer = function _initRenderer () {
31203122
title = str;
31213123

31223124
if (
3123-
!/:|(\/{2})/.test(href) &&
3125+
!isAbsolutePath(href) &&
31243126
!_self._matchNotCompileLink(href) &&
31253127
!config.ignore
31263128
) {
@@ -3175,6 +3177,16 @@ Compiler.prototype._initRenderer = function _initRenderer () {
31753177
attrs += " title=\"" + title + "\"";
31763178
}
31773179

3180+
var size = config.size;
3181+
if (size) {
3182+
var sizes = size.split('x');
3183+
if (sizes[1]) {
3184+
attrs += 'width=' + sizes[0] + ' height=' + sizes[1];
3185+
} else {
3186+
attrs += 'width=' + sizes[0];
3187+
}
3188+
}
3189+
31783190
if (!isAbsolutePath(href)) {
31793191
url = getPath(contentBase, getParentPath(router.getCurrentPath()), href);
31803192
}
@@ -3208,7 +3220,6 @@ Compiler.prototype.sidebar = function sidebar (text, level) {
32083220

32093221
if (text) {
32103222
html = this.compile(text);
3211-
html = html && html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0];
32123223
} else {
32133224
var tree$$1 = this.cacheTree[currentPath] || genTree(this.toc, level);
32143225
html = tree(tree$$1, '<ul>');
@@ -3492,7 +3503,7 @@ function highlight(path) {
34923503
if (!last) {
34933504
return
34943505
}
3495-
var li = nav[getNavKey(path, last.getAttribute('data-id'))];
3506+
var li = nav[getNavKey(decodeURIComponent(path), last.getAttribute('data-id'))];
34963507

34973508
if (!li || li === active) {
34983509
return
@@ -3590,38 +3601,45 @@ function scroll2Top(offset) {
35903601
var cached$1 = {};
35913602

35923603
function walkFetchEmbed(ref, cb) {
3593-
var step = ref.step; if ( step === void 0 ) step = 0;
35943604
var embedTokens = ref.embedTokens;
35953605
var compile = ref.compile;
35963606
var fetch = ref.fetch;
35973607

3598-
var token = embedTokens[step];
3608+
var token;
3609+
var step = 0;
3610+
var count = 1;
35993611

3600-
if (!token) {
3612+
if (!embedTokens.length) {
36013613
return cb({})
36023614
}
36033615

3604-
var next = function (text) {
3605-
var embedToken;
3606-
if (text) {
3607-
if (token.embed.type === 'markdown') {
3608-
embedToken = compile.lexer(text);
3609-
} else if (token.embed.type === 'code') {
3610-
embedToken = compile.lexer(
3611-
'```' +
3612-
token.embed.lang +
3613-
'\n' +
3614-
text.replace(/`/g, '@DOCSIFY_QM@') +
3615-
'\n```\n'
3616-
);
3616+
while ((token = embedTokens[step++])) {
3617+
var next = (function (token) {
3618+
return function (text) {
3619+
var embedToken;
3620+
if (text) {
3621+
if (token.embed.type === 'markdown') {
3622+
embedToken = compile.lexer(text);
3623+
} else if (token.embed.type === 'code') {
3624+
embedToken = compile.lexer(
3625+
'```' +
3626+
token.embed.lang +
3627+
'\n' +
3628+
text.replace(/`/g, '@DOCSIFY_QM@') +
3629+
'\n```\n'
3630+
);
3631+
}
3632+
}
3633+
cb({token: token, embedToken: embedToken});
3634+
if (++count >= step) {
3635+
cb({});
3636+
}
36173637
}
3618-
}
3619-
cb({token: token, embedToken: embedToken});
3620-
walkFetchEmbed({step: ++step, compile: compile, embedTokens: embedTokens, fetch: fetch}, cb);
3621-
};
3638+
})(token);
36223639

3623-
{
3624-
get(token.embed.url).then(next);
3640+
{
3641+
get(token.embed.url).then(next);
3642+
}
36253643
}
36263644
}
36273645

@@ -3706,7 +3724,9 @@ function formatUpdated(html, updated, fn) {
37063724
updated =
37073725
typeof fn === 'function' ?
37083726
fn(updated) :
3709-
typeof fn === 'string' ? tinydate(fn)(new Date(updated)) : updated;
3727+
typeof fn === 'string' ?
3728+
tinydate(fn)(new Date(updated)) :
3729+
updated;
37103730

37113731
return html.replace(/{docsify-updated}/g, updated)
37123732
}
@@ -3911,6 +3931,10 @@ function initRender(vm) {
39113931
html += cover();
39123932
}
39133933

3934+
if (config.logo) {
3935+
config.logo = getPath(vm.router.getBasePath(), config.logo);
3936+
}
3937+
39143938
html += main(config);
39153939
// Render main app
39163940
vm._renderTo(el, html, true);
@@ -4577,7 +4601,7 @@ initGlobalAPI();
45774601
/**
45784602
* Version
45794603
*/
4580-
Docsify.version = '4.6.10';
4604+
Docsify.version = '4.7.0';
45814605

45824606
/**
45834607
* Run Docsify

lib/docsify.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/plugins/front-matter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ var install = function (hook, vm) {
485485
var attributes = ref.attributes;
486486
var body = ref.body;
487487

488-
Docsify.util.merge(vm.config, attributes.config);
488+
vm.frontmatter = attributes;
489489

490490
return body
491491
});

lib/plugins/front-matter.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)