Compare commits

..
25 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
qingwei.li 9f310bbd7d [release] 4.1.13 2017-06-11 18:58:32 +08:00
qingwei.li cc8a7c97b6 [build] 4.1.13 2017-06-11 18:58:31 +08:00
qingwei.li 19da658ba2 add changelog 2017-06-11 18:58:13 +08:00
qingwei.li 97db30a0b9 fix ga 2017-06-11 18:57:21 +08:00
Tony Nganandcinwell.li 3a0765e11e add samlify (#189) 2017-06-08 22:03:25 +08:00
Samina Fuandcinwell.li aaf71b1ac0 Add CDNJS version badge in README.md (#185)
This badge will show the version on CDNJS!
2017-06-06 12:44:33 +08:00
qingwei.li b37781e949 [release] 4.1.12 2017-06-03 20:12:32 +08:00
qingwei.li 54a48dd3ff [build] 4.1.12 2017-06-03 20:12:32 +08:00
qingwei.li 1aabc41db7 add changelog 2017-06-03 20:12:08 +08:00
qingwei.li d087d5753b fix(render): ubtitle in side bar shows undefined, fixed #182 2017-06-03 20:11:34 +08:00
qingwei.li bb793ec08e update package size 2017-06-02 22:37:27 +08:00
qingwei.li 6a78ae7ddc [release] 4.1.11 2017-06-02 22:18:36 +08:00
qingwei.li ac28040bd7 [build] 4.1.11 2017-06-02 22:18:36 +08:00
qingwei.li b12f74b159 add changelog 2017-06-02 22:16:39 +08:00
qingwei.li 1304d2ea1a fix(render): autoHeader does not work 2017-06-02 22:14:28 +08:00
qingwei.li ccf4c7c5cc fix(compiler): force reset toc when rendering sidebar fixed #181 2017-06-02 22:12:07 +08:00
qingwei.li 9b15d8d577 update cdn version 2017-06-02 18:04:20 +08:00
24 changed files with 122 additions and 75 deletions
+25 -4
View File
@@ -1,5 +1,26 @@
# 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
4.1.12 / 2017-06-03
* fix(render): ubtitle in side bar shows undefined, fixed [#182](https://github.com/QingWei-Li/docsify/issues/182)
4.1.11 / 2017-06-02
* fix(render): autoHeader does not work
* fix(compiler): force reset toc when rendering sidebar fixed [#181](https://github.com/QingWei-Li/docsify/issues/181)
4.1.10 / 2017-06-02
* fix(hash): hash routing crashes when url has querystring
@@ -7,13 +28,13 @@
4.1.9 / 2017-05-31
* fix(lifecycle): continue to handle data
* fix: can't render toc on first load, fixed #171
* fix(render): broken name link, fixed #167
* fix: can't render toc on first load, fixed [#171](https://github.com/QingWei-Li/docsify/issues/171)
* fix(render): broken name link, fixed [#167](https://github.com/QingWei-Li/docsify/issues/167)
## 4.1.8(since 4.1.1) / 2017-05-31
* fix(pure-css):add coverpage style, fixed #165
* feat: add edit button demo, close #162
* fix(pure-css):add coverpage style, fixed [#165](https://github.com/QingWei-Li/docsify/issues/165)
* feat: add edit button demo, close [#162](https://github.com/QingWei-Li/docsify/issues/162)
* fix some ssr bugs
## 4.1.0 / 2017-05-30 🎂 to me
+3 -1
View File
@@ -11,6 +11,7 @@
<p align="center">
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/QingWei-Li/docsify/master.svg?style=flat-square"></a>
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
<a href="https://cdnjs.com/libraries/docsify"><img alt="cdnjs" src="https://img.shields.io/cdnjs/v/docsify.svg?style=flat-square"></a>
<a href="https://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
<a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify.svg?type=shield"/></a>
</p>
@@ -23,7 +24,7 @@
## Features
- No statically built html files
- Simple and lightweight (~16kB gzipped)
- Simple and lightweight (~18kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
@@ -69,6 +70,7 @@ These projects are using docsify to generate their sites. Pull requests welcome
| [JS MythBusters](https://mythbusters.js.org) | An optimization handbook from a high level point of view. |
| [hire-me](https://fvcproductions.github.io/hire-me) | A path to getting an awesome tech gig. |
| [vue-amap](https://elemefe.github.io/vue-amap/) | A Map Component Library Base on Vue 2.x and Gaode Map. |
| [samlify](https://samlify.js.org) | Node.js SAML2 library |
## Similar projects
+2 -3
View File
@@ -30,14 +30,13 @@
loadSidebar: true,
coverpage: true,
name: 'docsify',
subMaxLevel: 2,
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
@@ -11,7 +11,7 @@ See the [Quick start](quickstart.md) for more details.
## Features
* No statically built html files
* Simple and lightweight (~16kB gzipped)
* Simple and lightweight (~18kB gzipped)
* Smart full-text search plugin
* Multiple themes
* Useful plugin API
+2 -2
View File
@@ -1,10 +1,10 @@
![logo](_media/icon.svg)
# docsify <small>4.1.10</small>
# docsify <small>4.1.14</small>
> A magical documentation site generator.
- Simple and lightweight (~16kB gzipped)
- Simple and lightweight (~18kB gzipped)
- No statically built html files
- Multiple themes
+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
@@ -26,7 +26,7 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
> A magical documentation site generator.
- Simple and lightweight (~16kB gzipped)
- Simple and lightweight (~18kB gzipped)
- No statically built html files
- Multiple themes
+1 -1
View File
@@ -11,7 +11,7 @@ Siehe [Schnellstart](de-de/quickstart.md) für weitere Informationen.
## Features
* keine generierten, statischen HTML Dateien
* einfach und klein (~16kB gzipped)
* einfach und klein (~18kB gzipped)
* smarte Erweiterung mit Volltextsuche
* mehrere Themes
* praktische API für Erweiterungen
+1 -1
View File
@@ -26,7 +26,7 @@ Setze `coverpage` auf **true**, und erstelle `_coverpage.md`:
> Ein magischer Generator für Dokumentationsseiten.
- Einfach und wenig Speicherbedarf (~16kB gzipped)
- Einfach und wenig Speicherbedarf (~18kB gzipped)
- Keine statischen HTML Dateien
- Mehrere Themes
+7 -7
View File
@@ -7,10 +7,10 @@
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
<meta name="description" content="A magical documentation generator.">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css" title="vue">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/buble.css" title="buble" disabled>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/pure.css" title="pure" disabled>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/vue.css" title="vue">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/buble.css" title="buble" disabled>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/pure.css" title="pure" disabled>
<style>
nav.app-nav li ul {
min-width: 100px;
@@ -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
@@ -66,8 +66,8 @@
]
}
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-markdown.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-nginx.min.js"></script>
+1 -1
View File
@@ -12,7 +12,7 @@ docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo
## 特性
- 无需构建,写完文档直接发布
- 容易使用并且轻量 (~16kB gzipped)
- 容易使用并且轻量 (~18kB gzipped)
- 智能的全文搜索
- 提供多套主题
- 丰富的 API
+25 -10
View File
@@ -2889,6 +2889,10 @@ Compiler.prototype.sidebar = function sidebar (text, level) {
* Compile sub sidebar
*/
Compiler.prototype.subSidebar = function subSidebar (level) {
if (!level) {
this.toc = [];
return
}
var currentPath = this.router.getCurrentPath();
var ref = this;
var cacheTree = ref.cacheTree;
@@ -3158,10 +3162,13 @@ function renderMixin (proto) {
this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel));
var activeEl = getAndActive(this.router, '.sidebar-nav', true, true);
if (loadSidebar && activeEl) {
activeEl.parentNode.innerHTML += this.compiler.subSidebar(subMaxLevel);
activeEl.parentNode.innerHTML += (this.compiler.subSidebar(subMaxLevel) || '');
} else {
// reset toc
this.compiler.subSidebar();
}
// bind event
this._bindEventOnRendered();
this._bindEventOnRendered(activeEl);
};
proto._bindEventOnRendered = function (activeEl) {
@@ -3311,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;
@@ -3323,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
};
@@ -3416,7 +3427,7 @@ var HashHistory = (function (History$$1) {
return {
path: path,
file: this.getFile(path),
file: this.getFile(path, true),
query: parseQuery(query)
}
};
@@ -3529,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';
@@ -3541,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) {
@@ -3743,7 +3758,7 @@ initGlobalAPI();
/**
* Version
*/
Docsify.version = '4.1.10';
Docsify.version = '4.1.14';
/**
* Run Docsify
+2 -2
View File
File diff suppressed because one or more lines are too long
+11 -14
View File
@@ -11,24 +11,21 @@ function appendScript () {
}
function init (id) {
var ga = window.ga;
if (!ga) {
appendScript();
ga = ga || function () {
(ga.q = ga.q || []).push(arguments);
};
ga.l = Number(new Date());
ga('create', id, 'auto');
}
return ga
appendScript();
window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments);
};
window.ga.l = Number(new Date());
window.ga('create', id, 'auto');
}
function collect () {
var ga = init($docsify.ga);
if (!window.ga) {
init($docsify.ga);
}
ga('set', 'page', location.hash);
ga('send', 'pageview');
window.ga('set', 'page', location.hash);
window.ga('send', 'pageview');
}
var install = function (hook) {
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function c(c){var e=window.ga;return e||(n(),e=e||function(){(e.q=e.q||[]).push(arguments)},e.l=Number(new Date),e("create",c,"auto")),e}function e(){var n=c($docsify.ga);n("set","page",location.hash),n("send","pageview")}var i=function(n){if(!$docsify.ga)return void console.error("[Docsify] ga is required.");n.beforeEach(e)};$docsify.plugins=[].concat(i,$docsify.plugins)}();
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function i(i){n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",i,"auto")}function o(){window.ga||i($docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}var a=function(n){if(!$docsify.ga)return void console.error("[Docsify] ga is required.");n.beforeEach(o)};$docsify.plugins=[].concat(a,$docsify.plugins)}();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "4.1.10",
"version": "4.1.14",
"lockfileVersion": 1,
"dependencies": {
"abbrev": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "4.1.10",
"version": "4.1.14",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
@@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
"version": "4.1.10",
"version": "4.1.14",
"description": "docsify server renderer",
"author": {
"name": "qingwei-li",
+4
View File
@@ -135,6 +135,10 @@ export class Compiler {
* Compile sub sidebar
*/
subSidebar (level) {
if (!level) {
this.toc = []
return
}
const currentPath = this.router.getCurrentPath()
const { cacheTree, toc } = this
+5 -2
View File
@@ -84,10 +84,13 @@ export function renderMixin (proto) {
this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel))
const activeEl = getAndActive(this.router, '.sidebar-nav', true, true)
if (loadSidebar && activeEl) {
activeEl.parentNode.innerHTML += this.compiler.subSidebar(subMaxLevel)
activeEl.parentNode.innerHTML += (this.compiler.subSidebar(subMaxLevel) || '')
} else {
// reset toc
this.compiler.subSidebar()
}
// bind event
this._bindEventOnRendered()
this._bindEventOnRendered(activeEl)
}
proto._bindEventOnRendered = function (activeEl) {
+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) {
+10 -13
View File
@@ -7,24 +7,21 @@ function appendScript () {
}
function init (id) {
let ga = window.ga
if (!ga) {
appendScript()
ga = ga || function () {
(ga.q = ga.q || []).push(arguments)
}
ga.l = Number(new Date())
ga('create', id, 'auto')
appendScript()
window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments)
}
return ga
window.ga.l = Number(new Date())
window.ga('create', id, 'auto')
}
function collect () {
const ga = init($docsify.ga)
if (!window.ga) {
init($docsify.ga)
}
ga('set', 'page', location.hash)
ga('send', 'pageview')
window.ga('set', 'page', location.hash)
window.ga('send', 'pageview')
}
const install = function (hook) {