[build] 4.2.0
This commit is contained in:
parent
b430993f4f
commit
4dabae3bf2
5 changed files with 61 additions and 19 deletions
|
|
@ -1,6 +1,6 @@
|
||||||

|

|
||||||
|
|
||||||
# docsify <small>4.1.14</small>
|
# docsify <small>4.2.0</small>
|
||||||
|
|
||||||
> A magical documentation site generator.
|
> A magical documentation site generator.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,8 @@ var config = merge({
|
||||||
mergeNavbar: false,
|
mergeNavbar: false,
|
||||||
formatUpdated: '',
|
formatUpdated: '',
|
||||||
externalLinkTarget: '_blank',
|
externalLinkTarget: '_blank',
|
||||||
routerModel: 'hash'
|
routerModel: 'hash',
|
||||||
|
noCompileLinks: []
|
||||||
}, window.$docsify);
|
}, window.$docsify);
|
||||||
|
|
||||||
var script = document.currentScript ||
|
var script = document.currentScript ||
|
||||||
|
|
@ -2717,8 +2718,9 @@ function parseQuery (query) {
|
||||||
query.split('&').forEach(function (param) {
|
query.split('&').forEach(function (param) {
|
||||||
var parts = param.replace(/\+/g, ' ').split('=');
|
var parts = param.replace(/\+/g, ' ').split('=');
|
||||||
|
|
||||||
res[parts[0]] = decode(parts[1]);
|
res[parts[0]] = parts[1] && decode(parts[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2726,7 +2728,9 @@ function stringifyQuery (obj) {
|
||||||
var qs = [];
|
var qs = [];
|
||||||
|
|
||||||
for (var key in obj) {
|
for (var key in obj) {
|
||||||
qs.push(((encode(key)) + "=" + (encode(obj[key]))).toLowerCase());
|
qs.push(obj[key]
|
||||||
|
? ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase()
|
||||||
|
: encode(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return qs.length ? ("?" + (qs.join('&'))) : ''
|
return qs.length ? ("?" + (qs.join('&'))) : ''
|
||||||
|
|
@ -2757,6 +2761,8 @@ var cleanPath = cached(function (path) {
|
||||||
.replace(/([^:])\/{2,}/g, '$1/')
|
.replace(/([^:])\/{2,}/g, '$1/')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var cachedLinks = {};
|
||||||
|
|
||||||
var Compiler = function Compiler (config, router) {
|
var Compiler = function Compiler (config, router) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.router = router;
|
this.router = router;
|
||||||
|
|
@ -2791,6 +2797,19 @@ var Compiler = function Compiler (config, router) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Compiler.prototype.matchNotCompileLink = function matchNotCompileLink (link) {
|
||||||
|
var links = this.config.noCompileLinks;
|
||||||
|
|
||||||
|
for (var i = 0; i < links.length; i++) {
|
||||||
|
var n = links[i];
|
||||||
|
var re = cachedLinks[n] || (cachedLinks[n] = new RegExp(("^" + n + "$")));
|
||||||
|
|
||||||
|
if (re.test(link)) {
|
||||||
|
return link
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Compiler.prototype._initRenderer = function _initRenderer () {
|
Compiler.prototype._initRenderer = function _initRenderer () {
|
||||||
var renderer = new marked.Renderer();
|
var renderer = new marked.Renderer();
|
||||||
var ref = this;
|
var ref = this;
|
||||||
|
|
@ -2834,11 +2853,16 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||||
};
|
};
|
||||||
renderer.link = function (href, title, text) {
|
renderer.link = function (href, title, text) {
|
||||||
var blank = '';
|
var blank = '';
|
||||||
if (!/:|(\/{2})/.test(href)) {
|
|
||||||
|
if (!/:|(\/{2})/.test(href) &&
|
||||||
|
!_self.matchNotCompileLink(href) &&
|
||||||
|
!/(\s?:ignore)(\s\S+)?$/.test(title)) {
|
||||||
href = router.toURL(href, null, router.getCurrentPath());
|
href = router.toURL(href, null, router.getCurrentPath());
|
||||||
} else {
|
} else {
|
||||||
blank = " target=\"" + linkTarget + "\"";
|
blank = " target=\"" + linkTarget + "\"";
|
||||||
|
title = title && title.replace(/:ignore/g, '').trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
title = " title=\"" + title + "\"";
|
title = " title=\"" + title + "\"";
|
||||||
}
|
}
|
||||||
|
|
@ -3200,6 +3224,10 @@ function renderMixin (proto) {
|
||||||
var this$1 = this;
|
var this$1 = this;
|
||||||
if ( opt === void 0 ) opt = {};
|
if ( opt === void 0 ) opt = {};
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return renderMain.call(this, text)
|
||||||
|
}
|
||||||
|
|
||||||
callHook(this, 'beforeEach', text, function (result) {
|
callHook(this, 'beforeEach', text, function (result) {
|
||||||
var html = this$1.isHTML ? result : this$1.compiler.compile(result);
|
var html = this$1.isHTML ? result : this$1.compiler.compile(result);
|
||||||
if (opt.updatedAt) {
|
if (opt.updatedAt) {
|
||||||
|
|
@ -3298,8 +3326,15 @@ function initRender (vm) {
|
||||||
toggleClass(body, 'ready');
|
toggleClass(body, 'ready');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAlias (path, alias) {
|
var cached$1 = {};
|
||||||
return alias[path] ? getAlias(alias[path], alias) : path
|
|
||||||
|
function getAlias (path, alias, last) {
|
||||||
|
var match = Object.keys(alias).filter(function (key) {
|
||||||
|
var re = cached$1[key] || (cached$1[key] = new RegExp(("^" + key + "$")));
|
||||||
|
return re.test(path) && path !== last
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
return match ? getAlias(path.replace(cached$1[match], alias[match]), alias, path) : path
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileName (path) {
|
function getFileName (path) {
|
||||||
|
|
@ -3623,17 +3658,24 @@ function fetchMixin (proto) {
|
||||||
// Current page is html
|
// Current page is html
|
||||||
this.isHTML = /\.html$/g.test(path);
|
this.isHTML = /\.html$/g.test(path);
|
||||||
|
|
||||||
// Load main content
|
var loadSideAndNav = function () {
|
||||||
last.then(function (text, opt) {
|
|
||||||
this$1._renderMain(text, opt);
|
|
||||||
if (!loadSidebar) { return cb() }
|
if (!loadSidebar) { return cb() }
|
||||||
|
|
||||||
var fn = function (result) { this$1._renderSidebar(result); cb(); };
|
var fn = function (result) { this$1._renderSidebar(result); cb(); };
|
||||||
|
|
||||||
// Load sidebar
|
// Load sidebar
|
||||||
loadNested(path, loadSidebar, fn, this$1, true);
|
loadNested(path, loadSidebar, fn, this$1, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Load main content
|
||||||
|
last.then(function (text, opt) {
|
||||||
|
this$1._renderMain(text, opt);
|
||||||
|
loadSideAndNav();
|
||||||
},
|
},
|
||||||
function (_) { return this$1._renderMain(null); });
|
function (_) {
|
||||||
|
this$1._renderMain(null);
|
||||||
|
loadSideAndNav();
|
||||||
|
});
|
||||||
|
|
||||||
// Load nav
|
// Load nav
|
||||||
loadNavbar &&
|
loadNavbar &&
|
||||||
|
|
@ -3758,7 +3800,7 @@ initGlobalAPI();
|
||||||
/**
|
/**
|
||||||
* Version
|
* Version
|
||||||
*/
|
*/
|
||||||
Docsify.version = '4.1.14';
|
Docsify.version = '4.2.0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run Docsify
|
* Run Docsify
|
||||||
|
|
|
||||||
4
lib/docsify.min.js
vendored
4
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docsify-server-renderer",
|
"name": "docsify-server-renderer",
|
||||||
"version": "4.1.14",
|
"version": "4.2.0",
|
||||||
"description": "docsify server renderer",
|
"description": "docsify server renderer",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "qingwei-li",
|
"name": "qingwei-li",
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export class Compiler {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
matchNotCompileLink(link) {
|
matchNotCompileLink (link) {
|
||||||
const links = this.config.noCompileLinks
|
const links = this.config.noCompileLinks
|
||||||
|
|
||||||
for (var i = 0; i < links.length; i++) {
|
for (var i = 0; i < links.length; i++) {
|
||||||
|
|
@ -96,9 +96,9 @@ export class Compiler {
|
||||||
renderer.link = function (href, title, text) {
|
renderer.link = function (href, title, text) {
|
||||||
let blank = ''
|
let blank = ''
|
||||||
|
|
||||||
if (!/:|(\/{2})/.test(href)
|
if (!/:|(\/{2})/.test(href) &&
|
||||||
&& !_self.matchNotCompileLink(href)
|
!_self.matchNotCompileLink(href) &&
|
||||||
&& !/(\s?:ignore)(\s\S+)?$/.test(title)) {
|
!/(\s?:ignore)(\s\S+)?$/.test(title)) {
|
||||||
href = router.toURL(href, null, router.getCurrentPath())
|
href = router.toURL(href, null, router.getCurrentPath())
|
||||||
} else {
|
} else {
|
||||||
blank = ` target="${linkTarget}"`
|
blank = ` target="${linkTarget}"`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue