mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-10 05:48:18 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8100c0755 | ||
|
|
be0230ebe9 | ||
|
|
aa6d2afce8 | ||
|
|
a706203879 | ||
|
|
fbc75bdb95 | ||
|
|
5af174bd20 |
@@ -1,3 +1,9 @@
|
||||
# 3.5.2/ 2017-04-05
|
||||
|
||||
* add optional current route param to toURL and use it to properly compose local anchor links
|
||||
* fix code style by removing semicolons
|
||||
* in toURL test for anchor links and if so prepend the currentPath to the generated path. fixes ([#142](https://github.com/QingWei-Li/docsify/issues/142))
|
||||
|
||||
# 3.5.1 / 2017-03-25
|
||||
|
||||
* fix: .md file extension regex
|
||||
|
||||
+6
-2
@@ -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"';
|
||||
}
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "3.5.1",
|
||||
"version": "3.5.2",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
@@ -82,7 +82,7 @@ renderer.code = function (code, lang = '') {
|
||||
renderer.link = function (href, title, text) {
|
||||
let blank = ''
|
||||
if (!/:|(\/{2})/.test(href)) {
|
||||
href = toURL(href)
|
||||
href = toURL(href, null, currentPath)
|
||||
} else {
|
||||
blank = ' target="_blank"'
|
||||
}
|
||||
|
||||
@@ -64,13 +64,17 @@ export function parse (path = window.location.href) {
|
||||
* to URL
|
||||
* @param {string} path
|
||||
* @param {object} qs query params
|
||||
* @param {string} currentRoute optional current route
|
||||
*/
|
||||
export function toURL (path, params) {
|
||||
export function toURL (path, params, currentRoute) {
|
||||
const local = currentRoute && path[0] === '#'
|
||||
const 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user