[build] 4.5.8
This commit is contained in:
parent
368754ebd9
commit
0e479613bc
9 changed files with 52 additions and 23 deletions
|
|
@ -612,10 +612,6 @@ block.list = replace(block.list)
|
|||
('def', '\\n+(?=' + block.def.source + ')')
|
||||
();
|
||||
|
||||
block.blockquote = replace(block.blockquote)
|
||||
('def', block.def)
|
||||
();
|
||||
|
||||
block._tag = '(?!(?:'
|
||||
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
|
||||
+ '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
|
||||
|
|
@ -1032,7 +1028,7 @@ var inline = {
|
|||
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
|
||||
strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
|
||||
em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
|
||||
code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
|
||||
code: /^(`+)([\s\S]*?[^`])\1(?!`)/,
|
||||
br: /^ {2,}\n(?!\s*$)/,
|
||||
del: noop,
|
||||
text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
|
||||
|
|
@ -1155,9 +1151,11 @@ InlineLexer.prototype.output = function(src) {
|
|||
if (cap = this$1.rules.autolink.exec(src)) {
|
||||
src = src.substring(cap[0].length);
|
||||
if (cap[2] === '@') {
|
||||
text = cap[1].charAt(6) === ':'
|
||||
text = escape(
|
||||
cap[1].charAt(6) === ':'
|
||||
? this$1.mangle(cap[1].substring(7))
|
||||
: this$1.mangle(cap[1]);
|
||||
: this$1.mangle(cap[1])
|
||||
);
|
||||
href = this$1.mangle('mailto:') + text;
|
||||
} else {
|
||||
text = escape(cap[1]);
|
||||
|
|
@ -1238,7 +1236,7 @@ InlineLexer.prototype.output = function(src) {
|
|||
// code
|
||||
if (cap = this$1.rules.code.exec(src)) {
|
||||
src = src.substring(cap[0].length);
|
||||
out += this$1.renderer.codespan(escape(cap[2], true));
|
||||
out += this$1.renderer.codespan(escape(cap[2].trim(), true));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1452,10 +1450,13 @@ Renderer.prototype.link = function(href, title, text) {
|
|||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {
|
||||
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
if (this.options.baseUrl && !originIndependentUrl.test(href)) {
|
||||
href = resolveUrl(this.options.baseUrl, href);
|
||||
}
|
||||
var out = '<a href="' + href + '"';
|
||||
if (title) {
|
||||
out += ' title="' + title + '"';
|
||||
|
|
@ -1465,6 +1466,9 @@ Renderer.prototype.link = function(href, title, text) {
|
|||
};
|
||||
|
||||
Renderer.prototype.image = function(href, title, text) {
|
||||
if (this.options.baseUrl && !originIndependentUrl.test(href)) {
|
||||
href = resolveUrl(this.options.baseUrl, href);
|
||||
}
|
||||
var out = '<img src="' + href + '" alt="' + text + '"';
|
||||
if (title) {
|
||||
out += ' title="' + title + '"';
|
||||
|
|
@ -1677,8 +1681,8 @@ function escape(html, encode) {
|
|||
}
|
||||
|
||||
function unescape(html) {
|
||||
// explicitly match decimal, hex, and named HTML entities
|
||||
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) {
|
||||
// explicitly match decimal, hex, and named HTML entities
|
||||
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) {
|
||||
n = n.toLowerCase();
|
||||
if (n === 'colon') { return ':'; }
|
||||
if (n.charAt(0) === '#') {
|
||||
|
|
@ -1702,6 +1706,30 @@ function replace(regex, opt) {
|
|||
};
|
||||
}
|
||||
|
||||
function resolveUrl(base, href) {
|
||||
if (!baseUrls[' ' + base]) {
|
||||
// we can ignore everything in base after the last slash of its path component,
|
||||
// but we might need to add _that_
|
||||
// https://tools.ietf.org/html/rfc3986#section-3
|
||||
if (/^[^:]+:\/*[^/]*$/.test(base)) {
|
||||
baseUrls[' ' + base] = base + '/';
|
||||
} else {
|
||||
baseUrls[' ' + base] = base.replace(/[^/]*$/, '');
|
||||
}
|
||||
}
|
||||
base = baseUrls[' ' + base];
|
||||
|
||||
if (href.slice(0, 2) === '//') {
|
||||
return base.replace(/:[^]*/, ':') + href;
|
||||
} else if (href.charAt(0) === '/') {
|
||||
return base.replace(/(:\/*[^/]*)[^]*/, '$1') + href;
|
||||
} else {
|
||||
return base + href;
|
||||
}
|
||||
}
|
||||
baseUrls = {};
|
||||
originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
||||
|
||||
function noop() {}
|
||||
noop.exec = noop;
|
||||
|
||||
|
|
@ -1838,7 +1866,8 @@ marked.defaults = {
|
|||
smartypants: false,
|
||||
headerPrefix: '',
|
||||
renderer: new Renderer,
|
||||
xhtml: false
|
||||
xhtml: false,
|
||||
baseUrl: null
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -3101,7 +3130,7 @@ function getAndActive (router, el, isParent, autoTitle) {
|
|||
el = getNode(el);
|
||||
|
||||
var links = findAll(el, 'a');
|
||||
var hash = router.toURL(router.getCurrentPath());
|
||||
var hash = decodeURI(router.toURL(router.getCurrentPath()));
|
||||
var target;
|
||||
|
||||
links.sort(function (a, b) { return b.href.length - a.href.length; }).forEach(function (a) {
|
||||
|
|
@ -4063,7 +4092,7 @@ initGlobalAPI();
|
|||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.5.7';
|
||||
Docsify.version = '4.5.8';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue