[build] 4.9.0
This commit is contained in:
parent
8cd786c9d5
commit
d1c72686bb
12 changed files with 74 additions and 22 deletions
|
|
@ -1,6 +1,6 @@
|
||||||

|

|
||||||
|
|
||||||
# docsify <small>4.8.6</small>
|
# docsify <small>4.9.0</small>
|
||||||
|
|
||||||
> A magical documentation site generator.
|
> A magical documentation site generator.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3335,7 +3335,7 @@ function getAndRemoveConfig(str) {
|
||||||
str = str
|
str = str
|
||||||
.replace(/^'/, '')
|
.replace(/^'/, '')
|
||||||
.replace(/'$/, '')
|
.replace(/'$/, '')
|
||||||
.replace(/:([\w-]+)=?([\w-]+)?/g, function (m, key, value) {
|
.replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g, function (m, key, value) {
|
||||||
config[key] = (value && value.replace(/"/g, '')) || true;
|
config[key] = (value && value.replace(/"/g, '')) || true;
|
||||||
return ''
|
return ''
|
||||||
})
|
})
|
||||||
|
|
@ -3483,6 +3483,7 @@ Compiler.prototype.compileEmbed = function compileEmbed (href, title) {
|
||||||
embed = compileMedia[type].call(this, href, title);
|
embed = compileMedia[type].call(this, href, title);
|
||||||
embed.type = type;
|
embed.type = type;
|
||||||
}
|
}
|
||||||
|
embed.fragment = config.fragment;
|
||||||
|
|
||||||
return embed
|
return embed
|
||||||
}
|
}
|
||||||
|
|
@ -3633,6 +3634,23 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||||
|
|
||||||
return ("<img src=\"" + url + "\"data-origin=\"" + href + "\" alt=\"" + text + "\"" + attrs + ">")
|
return ("<img src=\"" + url + "\"data-origin=\"" + href + "\" alt=\"" + text + "\"" + attrs + ">")
|
||||||
};
|
};
|
||||||
|
origin.list = renderer.list = function (body, ordered, start) {
|
||||||
|
var isTaskList = /<li class="task-list-item">/.test(body.split('class="task-list"')[0]);
|
||||||
|
var isStartReq = start && start > 1;
|
||||||
|
var tag = ordered ? 'ol' : 'ul';
|
||||||
|
var tagAttrs = [
|
||||||
|
(isTaskList ? 'class="task-list"' : ''),
|
||||||
|
(isStartReq ? ("start=\"" + start + "\"") : '')
|
||||||
|
].join(' ').trim();
|
||||||
|
|
||||||
|
return ("<" + tag + " " + tagAttrs + ">" + body + "</" + tag + ">")
|
||||||
|
};
|
||||||
|
origin.listitem = renderer.listitem = function (text) {
|
||||||
|
var isTaskItem = /^(<input.*type="checkbox"[^>]*>)/.test(text);
|
||||||
|
var html = isTaskItem ? ("<li class=\"task-list-item\"><label>" + text + "</label></li>") : ("<li>" + text + "</li>");
|
||||||
|
|
||||||
|
return html
|
||||||
|
};
|
||||||
|
|
||||||
renderer.origin = origin;
|
renderer.origin = origin;
|
||||||
|
|
||||||
|
|
@ -3708,6 +3726,9 @@ function btn(el) {
|
||||||
var toggle = function (_) { return body.classList.toggle('close'); };
|
var toggle = function (_) { return body.classList.toggle('close'); };
|
||||||
|
|
||||||
el = getNode(el);
|
el = getNode(el);
|
||||||
|
if (el == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
on(el, 'click', function (e) {
|
on(el, 'click', function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
toggle();
|
toggle();
|
||||||
|
|
@ -3723,7 +3744,9 @@ function btn(el) {
|
||||||
|
|
||||||
function collapse(el) {
|
function collapse(el) {
|
||||||
el = getNode(el);
|
el = getNode(el);
|
||||||
|
if (el == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
on(el, 'click', function (ref) {
|
on(el, 'click', function (ref) {
|
||||||
var target = ref.target;
|
var target = ref.target;
|
||||||
|
|
||||||
|
|
@ -3761,8 +3784,10 @@ function sticky() {
|
||||||
*/
|
*/
|
||||||
function getAndActive(router, el, isParent, autoTitle) {
|
function getAndActive(router, el, isParent, autoTitle) {
|
||||||
el = getNode(el);
|
el = getNode(el);
|
||||||
|
var links = [];
|
||||||
var links = findAll(el, 'a');
|
if (el != null) {
|
||||||
|
links = findAll(el, 'a');
|
||||||
|
}
|
||||||
var hash = decodeURI(router.toURL(router.getCurrentPath()));
|
var hash = decodeURI(router.toURL(router.getCurrentPath()));
|
||||||
var target;
|
var target;
|
||||||
|
|
||||||
|
|
@ -3965,7 +3990,10 @@ function scrollActiveSidebar(router) {
|
||||||
coverHeight = cover ? cover.offsetHeight : 0;
|
coverHeight = cover ? cover.offsetHeight : 0;
|
||||||
|
|
||||||
var sidebar = getNode('.sidebar');
|
var sidebar = getNode('.sidebar');
|
||||||
var lis = findAll(sidebar, 'li');
|
var lis = [];
|
||||||
|
if (sidebar != null) {
|
||||||
|
lis = findAll(sidebar, 'li');
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0, len = lis.length; i < len; i += 1) {
|
for (var i = 0, len = lis.length; i < len; i += 1) {
|
||||||
var li = lis[i];
|
var li = lis[i];
|
||||||
|
|
@ -4049,6 +4077,11 @@ function walkFetchEmbed(ref, cb) {
|
||||||
if (token.embed.type === 'markdown') {
|
if (token.embed.type === 'markdown') {
|
||||||
embedToken = compile.lexer(text);
|
embedToken = compile.lexer(text);
|
||||||
} else if (token.embed.type === 'code') {
|
} else if (token.embed.type === 'code') {
|
||||||
|
if (token.embed.fragment) {
|
||||||
|
var fragment = token.embed.fragment;
|
||||||
|
var pattern = new RegExp(("(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]([\\s\\S]*)(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]"));
|
||||||
|
text = ((text.match(pattern) || [])[1] || '').trim();
|
||||||
|
}
|
||||||
embedToken = compile.lexer(
|
embedToken = compile.lexer(
|
||||||
'```' +
|
'```' +
|
||||||
token.embed.lang +
|
token.embed.lang +
|
||||||
|
|
@ -5013,7 +5046,7 @@ function initGlobalAPI () {
|
||||||
dom: dom,
|
dom: dom,
|
||||||
get: get,
|
get: get,
|
||||||
slugify: slugify,
|
slugify: slugify,
|
||||||
version: '4.8.6'
|
version: '4.9.0'
|
||||||
};
|
};
|
||||||
window.DocsifyCompiler = Compiler;
|
window.DocsifyCompiler = Compiler;
|
||||||
window.marked = marked;
|
window.marked = marked;
|
||||||
|
|
|
||||||
2
lib/docsify.min.js
vendored
2
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,18 @@
|
||||||
(function () {
|
(function () {
|
||||||
var INDEXS = {};
|
var INDEXS = {};
|
||||||
|
|
||||||
|
var LOCAL_STORAGE = {
|
||||||
|
EXPIRE_KEY: 'docsify.search.expires',
|
||||||
|
INDEX_KEY: 'docsify.search.index'
|
||||||
|
};
|
||||||
|
|
||||||
|
function resolveExpireKey(namespace) {
|
||||||
|
return namespace ? ((LOCAL_STORAGE.EXPIRE_KEY) + "/" + namespace) : LOCAL_STORAGE.EXPIRE_KEY
|
||||||
|
}
|
||||||
|
function resolveIndexKey(namespace) {
|
||||||
|
return namespace ? ((LOCAL_STORAGE.INDEX_KEY) + "/" + namespace) : LOCAL_STORAGE.INDEX_KEY
|
||||||
|
}
|
||||||
|
|
||||||
function escapeHtml(string) {
|
function escapeHtml(string) {
|
||||||
var entityMap = {
|
var entityMap = {
|
||||||
'&': '&',
|
'&': '&',
|
||||||
|
|
@ -34,9 +46,9 @@ function getAllPaths(router) {
|
||||||
return paths
|
return paths
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveData(maxAge) {
|
function saveData(maxAge, expireKey, indexKey) {
|
||||||
localStorage.setItem('docsify.search.expires', Date.now() + maxAge);
|
localStorage.setItem(expireKey, Date.now() + maxAge);
|
||||||
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS));
|
localStorage.setItem(indexKey, JSON.stringify(INDEXS));
|
||||||
}
|
}
|
||||||
|
|
||||||
function genIndex(path, content, router, depth) {
|
function genIndex(path, content, router, depth) {
|
||||||
|
|
@ -154,9 +166,13 @@ function search(query) {
|
||||||
|
|
||||||
function init$1(config, vm) {
|
function init$1(config, vm) {
|
||||||
var isAuto = config.paths === 'auto';
|
var isAuto = config.paths === 'auto';
|
||||||
var isExpired = localStorage.getItem('docsify.search.expires') < Date.now();
|
|
||||||
|
|
||||||
INDEXS = JSON.parse(localStorage.getItem('docsify.search.index'));
|
var expireKey = resolveExpireKey(config.namespace);
|
||||||
|
var indexKey = resolveIndexKey(config.namespace);
|
||||||
|
|
||||||
|
var isExpired = localStorage.getItem(expireKey) < Date.now();
|
||||||
|
|
||||||
|
INDEXS = JSON.parse(localStorage.getItem(indexKey));
|
||||||
|
|
||||||
if (isExpired) {
|
if (isExpired) {
|
||||||
INDEXS = {};
|
INDEXS = {};
|
||||||
|
|
@ -177,7 +193,7 @@ function init$1(config, vm) {
|
||||||
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
INDEXS[path] = genIndex(path, result, vm.router, config.depth);
|
INDEXS[path] = genIndex(path, result, vm.router, config.depth);
|
||||||
len === ++count && saveData(config.maxAge);
|
len === ++count && saveData(config.maxAge, expireKey, indexKey);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -311,7 +327,8 @@ var CONFIG = {
|
||||||
paths: 'auto',
|
paths: 'auto',
|
||||||
depth: 2,
|
depth: 2,
|
||||||
maxAge: 86400000, // 1 day
|
maxAge: 86400000, // 1 day
|
||||||
hideOtherSidebarContent: false
|
hideOtherSidebarContent: false,
|
||||||
|
namespace: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
var install = function (hook, vm) {
|
var install = function (hook, vm) {
|
||||||
|
|
@ -327,6 +344,7 @@ var install = function (hook, vm) {
|
||||||
CONFIG.noData = opts.noData || CONFIG.noData;
|
CONFIG.noData = opts.noData || CONFIG.noData;
|
||||||
CONFIG.depth = opts.depth || CONFIG.depth;
|
CONFIG.depth = opts.depth || CONFIG.depth;
|
||||||
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent;
|
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent;
|
||||||
|
CONFIG.namespace = opts.namespace || CONFIG.namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isAuto = CONFIG.paths === 'auto';
|
var isAuto = CONFIG.paths === 'auto';
|
||||||
|
|
|
||||||
2
lib/plugins/search.min.js
vendored
2
lib/plugins/search.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
lib/themes/dolphin.css
Normal file
1
lib/themes/dolphin.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -37,5 +37,5 @@
|
||||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": "4.8.6"
|
"version": "4.9.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docsify-server-renderer",
|
"name": "docsify-server-renderer",
|
||||||
"version": "4.8.6",
|
"version": "4.9.0",
|
||||||
"description": "docsify server renderer",
|
"description": "docsify server renderer",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "qingwei-li",
|
"name": "qingwei-li",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue