[build] 4.9.0

This commit is contained in:
liqingwei 2019-02-19 11:26:53 +08:00
parent 8cd786c9d5
commit d1c72686bb
12 changed files with 74 additions and 22 deletions

View File

@ -1,6 +1,6 @@
![logo](_media/icon.svg)
# docsify <small>4.8.6</small>
# docsify <small>4.9.0</small>
> A magical documentation site generator.

View File

@ -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(/&quot;/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;

2
lib/docsify.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -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 = {
'&': '&amp;',
@ -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';

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

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

View File

@ -37,5 +37,5 @@
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
}
},
"version": "4.8.6"
"version": "4.9.0"
}

View File

@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
"version": "4.8.6",
"version": "4.9.0",
"description": "docsify server renderer",
"author": {
"name": "qingwei-li",