Compare commits

...
9 Commits
14 changed files with 57 additions and 21 deletions
-6
View File
@@ -1,9 +1,3 @@
sudo: false sudo: false
cache:
directories:
- $HOME/.yarn-cache
language: node_js language: node_js
node_js: stable node_js: stable
os:
- linux
- osx
+25
View File
@@ -1,3 +1,28 @@
<a name="4.3.4"></a>
## [4.3.4](https://github.com/QingWei-Li/docsify/compare/v4.3.3...v4.3.4) (2017-09-07)
### Bug Fixes
* scroll position issue, fixed [#234](https://github.com/QingWei-Li/docsify/issues/234) ([388ed3d](https://github.com/QingWei-Li/docsify/commit/388ed3d))
<a name="4.3.3"></a>
## [4.3.3](https://github.com/QingWei-Li/docsify/compare/v4.3.2...v4.3.3) (2017-09-06)
### Bug Fixes
* **buble.css:** tweaks code block style, fixed [#249](https://github.com/QingWei-Li/docsify/issues/249) ([9d43051](https://github.com/QingWei-Li/docsify/commit/9d43051))
### Features
* add doc for react and vue demo box plugin ([#247](https://github.com/QingWei-Li/docsify/issues/247)) ([f0aca19](https://github.com/QingWei-Li/docsify/commit/f0aca19))
<a name="4.3.2"></a> <a name="4.3.2"></a>
## [4.3.2](https://github.com/QingWei-Li/docsify/compare/v4.3.1...v4.3.2) (2017-09-01) ## [4.3.2](https://github.com/QingWei-Li/docsify/compare/v4.3.1...v4.3.2) (2017-09-01)
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg) ![logo](_media/icon.svg)
# docsify <small>4.3.2</small> # docsify <small>4.3.4</small>
> A magical documentation site generator. > A magical documentation site generator.
+8
View File
@@ -100,3 +100,11 @@ Medium's Image Zoom. Based on [zoom-image](https://github.com/egoist/zoom-image)
## Edit on github ## Edit on github
Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github) Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github)
## Demo code with instant preview and jsfiddle integration
With this plugin, sample code can be rendered on the page instantly, so that the readers can see the preview immediately.
When readers expand the demo box, the source code and description are shown there. if they click the button `Try in Jsfiddle`,
`jsfiddle.net` will be open with the code of this sample, which allow readers to revise the code and try on their own.
[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
+8 -4
View File
@@ -80,7 +80,7 @@ var config = merge({
mergeNavbar: false, mergeNavbar: false,
formatUpdated: '', formatUpdated: '',
externalLinkTarget: '_blank', externalLinkTarget: '_blank',
routerModel: 'hash', routerMode: 'hash',
noCompileLinks: [] noCompileLinks: []
}, window.$docsify); }, window.$docsify);
@@ -3130,6 +3130,7 @@ var nav = {};
var hoverOver = false; var hoverOver = false;
var scroller = null; var scroller = null;
var enableScrollEvent = true; var enableScrollEvent = true;
var coverHeight = 0;
function scrollTo (el) { function scrollTo (el) {
if (scroller) { scroller.stop(); } if (scroller) { scroller.stop(); }
@@ -3151,7 +3152,7 @@ function highlight () {
var wrap = find(sidebar, '.sidebar-nav'); var wrap = find(sidebar, '.sidebar-nav');
var active = find(sidebar, 'li.active'); var active = find(sidebar, 'li.active');
var doc = document.documentElement; var doc = document.documentElement;
var top = doc && doc.scrollTop || document.body.scrollTop; var top = (doc && doc.scrollTop || document.body.scrollTop) - coverHeight;
var last; var last;
for (var i = 0, len = anchors.length; i < len; i += 1) { for (var i = 0, len = anchors.length; i < len; i += 1) {
@@ -3195,7 +3196,8 @@ function highlight () {
} }
function scrollActiveSidebar (router) { function scrollActiveSidebar (router) {
if (isMobile) { return } var cover = find('.cover.show');
coverHeight = cover ? cover.offsetHeight : 0;
var sidebar = getNode('.sidebar'); var sidebar = getNode('.sidebar');
var lis = findAll(sidebar, 'li'); var lis = findAll(sidebar, 'li');
@@ -3213,6 +3215,8 @@ function scrollActiveSidebar (router) {
if (href) { nav[decodeURIComponent(href)] = li; } if (href) { nav[decodeURIComponent(href)] = li; }
} }
if (isMobile) { return }
off('scroll', highlight); off('scroll', highlight);
on('scroll', highlight); on('scroll', highlight);
on(sidebar, 'mouseover', function () { hoverOver = true; }); on(sidebar, 'mouseover', function () { hoverOver = true; });
@@ -3946,7 +3950,7 @@ initGlobalAPI();
/** /**
* Version * Version
*/ */
Docsify.version = '4.3.2'; Docsify.version = '4.3.4';
/** /**
* Run Docsify * Run Docsify
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "docsify", "name": "docsify",
"version": "4.3.2", "version": "4.3.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "docsify", "name": "docsify",
"version": "4.3.2", "version": "4.3.4",
"description": "A magical documentation generator.", "description": "A magical documentation generator.",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",
+1 -1
View File
@@ -37,5 +37,5 @@
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ=" "integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
} }
}, },
"version": "4.3.2" "version": "4.3.4"
} }
@@ -1,6 +1,6 @@
{ {
"name": "docsify-server-renderer", "name": "docsify-server-renderer",
"version": "4.3.2", "version": "4.3.4",
"description": "docsify server renderer", "description": "docsify server renderer",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",
+1 -1
View File
@@ -21,7 +21,7 @@ const config = merge({
mergeNavbar: false, mergeNavbar: false,
formatUpdated: '', formatUpdated: '',
externalLinkTarget: '_blank', externalLinkTarget: '_blank',
routerModel: 'hash', routerMode: 'hash',
noCompileLinks: [] noCompileLinks: []
}, window.$docsify) }, window.$docsify)
+6 -2
View File
@@ -6,6 +6,7 @@ const nav = {}
let hoverOver = false let hoverOver = false
let scroller = null let scroller = null
let enableScrollEvent = true let enableScrollEvent = true
let coverHeight = 0
function scrollTo (el) { function scrollTo (el) {
if (scroller) scroller.stop() if (scroller) scroller.stop()
@@ -27,7 +28,7 @@ function highlight () {
const wrap = dom.find(sidebar, '.sidebar-nav') const wrap = dom.find(sidebar, '.sidebar-nav')
let active = dom.find(sidebar, 'li.active') let active = dom.find(sidebar, 'li.active')
const doc = document.documentElement const doc = document.documentElement
const top = doc && doc.scrollTop || document.body.scrollTop const top = (doc && doc.scrollTop || document.body.scrollTop) - coverHeight
let last let last
for (let i = 0, len = anchors.length; i < len; i += 1) { for (let i = 0, len = anchors.length; i < len; i += 1) {
@@ -71,7 +72,8 @@ function highlight () {
} }
export function scrollActiveSidebar (router) { export function scrollActiveSidebar (router) {
if (isMobile) return const cover = dom.find('.cover.show')
coverHeight = cover ? cover.offsetHeight : 0
const sidebar = dom.getNode('.sidebar') const sidebar = dom.getNode('.sidebar')
const lis = dom.findAll(sidebar, 'li') const lis = dom.findAll(sidebar, 'li')
@@ -89,6 +91,8 @@ export function scrollActiveSidebar (router) {
if (href) nav[decodeURIComponent(href)] = li if (href) nav[decodeURIComponent(href)] = li
} }
if (isMobile) return
dom.off('scroll', highlight) dom.off('scroll', highlight)
dom.on('scroll', highlight) dom.on('scroll', highlight)
dom.on(sidebar, 'mouseover', () => { hoverOver = true }) dom.on(sidebar, 'mouseover', () => { hoverOver = true })
+1
View File
@@ -226,6 +226,7 @@ $sidebar-width: 16rem;
overflow: inherit; overflow: inherit;
padding: 20px 0.8em 20px; padding: 20px 0.8em 20px;
position: relative; position: relative;
white-space: inherit;
} }
.markdown-section code::after, .markdown-section code::before { .markdown-section code::after, .markdown-section code::before {