bump: 3.5.2

This commit is contained in:
qingwei.li 2017-04-05 21:31:22 +08:00
commit be0230ebe9
3 changed files with 14 additions and 4 deletions

View file

@ -380,14 +380,18 @@ function parse (path) {
* to URL
* @param {string} path
* @param {object} qs query params
* @param {string} currentRoute optional current route
*/
function toURL (path, params) {
function toURL (path, params, currentRoute) {
var local = currentRoute && path[0] === '#';
var route = parse(replaceSlug(path));
route.query = merge({}, route.query, params);
path = route.path + stringifyQuery(route.query);
path = path.replace(/\.md(\?)|\.md$/, '$1');
if (local) { path = currentRoute + path; }
return cleanPath('#/' + path)
}
@ -3025,7 +3029,7 @@ renderer.code = function (code, lang) {
renderer.link = function (href, title, text) {
var blank = '';
if (!/:|(\/{2})/.test(href)) {
href = toURL(href);
href = toURL(href, null, currentPath);
} else {
blank = ' target="_blank"';
}