Compare commits

...
8 Commits
Author SHA1 Message Date
qingwei.li 4492c3e19f [release] 4.1.14 2017-06-24 20:52:21 +08:00
qingwei.li f598e53098 [build] 4.1.14 2017-06-24 20:52:21 +08:00
qingwei.li 4bde6d685c add changelog 2017-06-24 20:51:53 +08:00
qingwei.li ce0e9acd50 feat: add context attribute, fixed #191 2017-06-23 17:09:13 +08:00
qingwei.li e8117e515d fix: get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070 2017-06-23 16:52:37 +08:00
cinwell.liandGitHub 25e09dfe07 Merge pull request #195 from crawt/master
Filter picture
2017-06-18 02:19:14 +08:00
Leo PanandGitHub a6b46a3e26 Filter picture
use regular filter picturn in search
2017-06-16 16:45:21 +08:00
Kevin Leungandcinwell.li d469442eae Update doc for external link target (#194) 2017-06-16 16:14:23 +08:00
13 changed files with 49 additions and 25 deletions
+8
View File
@@ -1,5 +1,13 @@
# Changelog
4.1.14 / 2017-06-24
* feat: add context attribute, fixed #191
* fix: get file path
* Merge pull request #195 from crawt/master
* Filter picture
* Update doc for external link target (#194)
4.1.13 / 2017-06-11
* fix ga
+1 -2
View File
@@ -33,11 +33,10 @@
subMaxLevel: 0,
mergeNavbar: true,
formatUpdated: '{MM}/{DD} {HH}:{mm}',
routerMode: 'history',
plugins: [
function(hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/QingWei-Li/docsify/blob/master' + vm.router.getFile()
var url = 'https://github.com/QingWei-Li/docsify/blob/master/' + vm.route.file
var editHtml = '[:memo: Edit Document](' + url + ')\n'
return editHtml
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg)
# docsify <small>4.1.13</small>
# docsify <small>4.1.14</small>
> A magical documentation site generator.
+1 -1
View File
@@ -333,7 +333,7 @@ window.$docsify = {
## external-link-target
Currently it defaults to _blank, would be nice if configurable:
Target to open external links. Default `'_blank'` (new window/tab)
```js
window.$docsify = {
+1 -1
View File
@@ -53,7 +53,7 @@
plugins: [
function(hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs' + vm.route.file
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs/' + vm.route.file
var editHtml = '[:memo: Edit Document](' + url + ')\n'
return editHtml
+16 -8
View File
@@ -3318,7 +3318,7 @@ History.prototype.getBasePath = function getBasePath () {
return this.config.basePath
};
History.prototype.getFile = function getFile (path) {
History.prototype.getFile = function getFile (path, isRelative) {
path = path || this.getCurrentPath();
var ref = this;
@@ -3330,6 +3330,10 @@ History.prototype.getFile = function getFile (path) {
path = path === '/README.md' ? (config.homepage || path) : path;
path = isAbsolutePath(path) ? path : getPath(base, path);
if (isRelative) {
path = path.replace(new RegExp(("^" + base)), '');
}
return path
};
@@ -3423,7 +3427,7 @@ var HashHistory = (function (History$$1) {
return {
path: path,
file: this.getFile(path),
file: this.getFile(path, true),
query: parseQuery(query)
}
};
@@ -3536,6 +3540,12 @@ function routerMixin (proto) {
var lastRoute = {};
function updateRender (vm) {
vm.router.normalize();
vm.route = vm.router.parse();
body.setAttribute('data-page', vm.route.file);
}
function initRouter (vm) {
var config = vm.config;
var mode = config.routerMode || 'hash';
@@ -3548,13 +3558,11 @@ function initRouter (vm) {
}
vm.router = router;
router.normalize();
lastRoute = vm.route = router.parse();
updateRender(vm);
lastRoute = vm.route;
router.onchange(function (_) {
router.normalize();
vm.route = router.parse();
updateRender(vm);
vm._updateRender();
if (lastRoute.path === vm.route.path) {
@@ -3750,7 +3758,7 @@ initGlobalAPI();
/**
* Version
*/
Docsify.version = '4.1.13';
Docsify.version = '4.1.14';
/**
* Run Docsify
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "4.1.13",
"version": "4.1.14",
"lockfileVersion": 1,
"dependencies": {
"abbrev": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "4.1.13",
"version": "4.1.14",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
@@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
"version": "4.1.13",
"version": "4.1.14",
"description": "docsify server renderer",
"author": {
"name": "qingwei-li",
+5 -1
View File
@@ -22,7 +22,7 @@ export class History {
return this.config.basePath
}
getFile (path) {
getFile (path, isRelative) {
path = path || this.getCurrentPath()
const { config } = this
@@ -33,6 +33,10 @@ export class History {
path = path === '/README.md' ? (config.homepage || path) : path
path = isAbsolutePath(path) ? path : getPath(base, path)
if (isRelative) {
path = path.replace(new RegExp(`^${base}`), '')
}
return path
}
+1 -1
View File
@@ -71,7 +71,7 @@ export class HashHistory extends History {
return {
path,
file: this.getFile(path),
file: this.getFile(path, true),
query: parseQuery(query)
}
}
+10 -5
View File
@@ -1,6 +1,7 @@
import { HashHistory } from './history/hash'
import { HTML5History } from './history/html5'
import { supportsPushState } from '../util/env'
import * as dom from '../util/dom'
export function routerMixin (proto) {
proto.route = {}
@@ -8,6 +9,12 @@ export function routerMixin (proto) {
let lastRoute = {}
function updateRender (vm) {
vm.router.normalize()
vm.route = vm.router.parse()
dom.body.setAttribute('data-page', vm.route.file)
}
export function initRouter (vm) {
const config = vm.config
const mode = config.routerMode || 'hash'
@@ -20,13 +27,11 @@ export function initRouter (vm) {
}
vm.router = router
router.normalize()
lastRoute = vm.route = router.parse()
updateRender(vm)
lastRoute = vm.route
router.onchange(_ => {
router.normalize()
vm.route = router.parse()
updateRender(vm)
vm._updateRender()
if (lastRoute.path === vm.route.path) {