mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-09 21:36:10 +10:00
[build] 4.9.0
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>4.8.6</small>
|
||||
# docsify <small>4.9.0</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
+39
-6
@@ -3335,7 +3335,7 @@ function getAndRemoveConfig(str) {
|
||||
str = str
|
||||
.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;
|
||||
return ''
|
||||
})
|
||||
@@ -3483,6 +3483,7 @@ Compiler.prototype.compileEmbed = function compileEmbed (href, title) {
|
||||
embed = compileMedia[type].call(this, href, title);
|
||||
embed.type = type;
|
||||
}
|
||||
embed.fragment = config.fragment;
|
||||
|
||||
return embed
|
||||
}
|
||||
@@ -3633,6 +3634,23 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
|
||||
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;
|
||||
|
||||
@@ -3708,6 +3726,9 @@ function btn(el) {
|
||||
var toggle = function (_) { return body.classList.toggle('close'); };
|
||||
|
||||
el = getNode(el);
|
||||
if (el == null) {
|
||||
return
|
||||
}
|
||||
on(el, 'click', function (e) {
|
||||
e.stopPropagation();
|
||||
toggle();
|
||||
@@ -3723,7 +3744,9 @@ function btn(el) {
|
||||
|
||||
function collapse(el) {
|
||||
el = getNode(el);
|
||||
|
||||
if (el == null) {
|
||||
return
|
||||
}
|
||||
on(el, 'click', function (ref) {
|
||||
var target = ref.target;
|
||||
|
||||
@@ -3761,8 +3784,10 @@ function sticky() {
|
||||
*/
|
||||
function getAndActive(router, el, isParent, autoTitle) {
|
||||
el = getNode(el);
|
||||
|
||||
var links = findAll(el, 'a');
|
||||
var links = [];
|
||||
if (el != null) {
|
||||
links = findAll(el, 'a');
|
||||
}
|
||||
var hash = decodeURI(router.toURL(router.getCurrentPath()));
|
||||
var target;
|
||||
|
||||
@@ -3965,7 +3990,10 @@ function scrollActiveSidebar(router) {
|
||||
coverHeight = cover ? cover.offsetHeight : 0;
|
||||
|
||||
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) {
|
||||
var li = lis[i];
|
||||
@@ -4049,6 +4077,11 @@ function walkFetchEmbed(ref, cb) {
|
||||
if (token.embed.type === 'markdown') {
|
||||
embedToken = compile.lexer(text);
|
||||
} 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(
|
||||
'```' +
|
||||
token.embed.lang +
|
||||
@@ -5013,7 +5046,7 @@ function initGlobalAPI () {
|
||||
dom: dom,
|
||||
get: get,
|
||||
slugify: slugify,
|
||||
version: '4.8.6'
|
||||
version: '4.9.0'
|
||||
};
|
||||
window.DocsifyCompiler = Compiler;
|
||||
window.marked = marked;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+25
-7
@@ -1,6 +1,18 @@
|
||||
(function () {
|
||||
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) {
|
||||
var entityMap = {
|
||||
'&': '&',
|
||||
@@ -34,9 +46,9 @@ function getAllPaths(router) {
|
||||
return paths
|
||||
}
|
||||
|
||||
function saveData(maxAge) {
|
||||
localStorage.setItem('docsify.search.expires', Date.now() + maxAge);
|
||||
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS));
|
||||
function saveData(maxAge, expireKey, indexKey) {
|
||||
localStorage.setItem(expireKey, Date.now() + maxAge);
|
||||
localStorage.setItem(indexKey, JSON.stringify(INDEXS));
|
||||
}
|
||||
|
||||
function genIndex(path, content, router, depth) {
|
||||
@@ -154,9 +166,13 @@ function search(query) {
|
||||
|
||||
function init$1(config, vm) {
|
||||
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) {
|
||||
INDEXS = {};
|
||||
@@ -177,7 +193,7 @@ function init$1(config, vm) {
|
||||
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
||||
.then(function (result) {
|
||||
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',
|
||||
depth: 2,
|
||||
maxAge: 86400000, // 1 day
|
||||
hideOtherSidebarContent: false
|
||||
hideOtherSidebarContent: false,
|
||||
namespace: undefined
|
||||
};
|
||||
|
||||
var install = function (hook, vm) {
|
||||
@@ -327,6 +344,7 @@ var install = function (hook, vm) {
|
||||
CONFIG.noData = opts.noData || CONFIG.noData;
|
||||
CONFIG.depth = opts.depth || CONFIG.depth;
|
||||
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent;
|
||||
CONFIG.namespace = opts.namespace || CONFIG.namespace;
|
||||
}
|
||||
|
||||
var isAuto = CONFIG.paths === 'auto';
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.8.6"
|
||||
"version": "4.9.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.8.6",
|
||||
"version": "4.9.0",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
Reference in New Issue
Block a user