Compare commits

..
22 changed files with 119 additions and 36 deletions
+10 -12
View File
@@ -20,21 +20,19 @@ about: Create a report to help us improve
#### What is the expected behaviour #### What is the expected behaviour
---
#### Other relevant information
<!-- (Update "[ ]" to "[x]" to check a box) -->
- [ ] Bug does still occur when all/other plugins are disabled? - [ ] Bug does still occur when all/other plugins are disabled?
<!-- Please type in your environment --> - Your OS:
Environment: - Node.js version:
- npm/yarn version:
``` - Browser version:
operating system: - Docsify version:
npm version: - Docsify plugins:
nodejs version:
docsify version:
docsify plugins:
browser:
```
<!-- Love docsify? Please consider supporting our collective: <!-- Love docsify? Please consider supporting our collective:
👉 https://opencollective.com/docsify/donate --> 👉 https://opencollective.com/docsify/donate -->
+15
View File
@@ -1,3 +1,18 @@
<a name="4.9.2"></a>
## [4.9.2](https://github.com/docsifyjs/docsify/compare/v4.9.1...v4.9.2) (2019-04-21)
### Bug Fixes
* re-render gitalk when router changed ([11ea1f8](https://github.com/docsifyjs/docsify/commit/11ea1f8))
### Features
* allows relative path, fixed [#590](https://github.com/docsifyjs/docsify/issues/590) ([31654f1](https://github.com/docsifyjs/docsify/commit/31654f1))
<a name="4.9.1"></a> <a name="4.9.1"></a>
## [4.9.1](https://github.com/docsifyjs/docsify/compare/v4.9.0...v4.9.1) (2019-02-21) ## [4.9.1](https://github.com/docsifyjs/docsify/compare/v4.9.0...v4.9.1) (2019-02-21)
+2 -1
View File
@@ -27,6 +27,7 @@
## Links ## Links
- [`develop` branch preview](https://docsifyjs.netlify.com/)
- [Documentation](https://docsify.js.org) - [Documentation](https://docsify.js.org)
- [CLI](https://github.com/docsifyjs/docsify-cli) - [CLI](https://github.com/docsifyjs/docsify-cli)
- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify) - CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify)
@@ -40,7 +41,7 @@
- Smart full-text search plugin - Smart full-text search plugin
- Multiple themes - Multiple themes
- Useful plugin API - Useful plugin API
- Compatible with IE10+ - Compatible with IE11
- Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo)) - Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo))
- Support embedded files - Support embedded files
Regular → Executable
View File
+1 -1
View File
@@ -16,7 +16,7 @@ See the [Quick start](quickstart.md) guide for more details.
- Multiple themes - Multiple themes
- Useful plugin API - Useful plugin API
- Emoji support - Emoji support
- Compatible with IE10+ - Compatible with IE11
- Support server-side rendering ([example](https://github.com/docsifyjs/docsify-ssr-demo)) - Support server-side rendering ([example](https://github.com/docsifyjs/docsify-ssr-demo))
## Examples ## Examples
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg) ![logo](_media/icon.svg)
# docsify <small>4.9.1</small> # docsify <small>4.9.2</small>
> A magical documentation site generator. > A magical documentation site generator.
+5
View File
@@ -44,6 +44,10 @@
maxLevel: 4, maxLevel: 4,
subMaxLevel: 2, subMaxLevel: 2,
ga: 'UA-106147152-1', ga: 'UA-106147152-1',
matomo: {
host: '//matomo.thunderwave.de',
id: 6
},
name: 'docsify', name: 'docsify',
search: { search: {
noData: { noData: {
@@ -84,6 +88,7 @@
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script> <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script> <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script> <script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/matomo.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script> <script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script> <script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script> <script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
+23 -3
View File
@@ -85,7 +85,8 @@ function config () {
formatUpdated: '', formatUpdated: '',
externalLinkTarget: '_blank', externalLinkTarget: '_blank',
routerMode: 'hash', routerMode: 'hash',
noCompileLinks: [] noCompileLinks: [],
relativePath: false
}, },
window.$docsify window.$docsify
); );
@@ -3222,6 +3223,20 @@ var cleanPath = cached(function (path) {
return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/') return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/')
}); });
var resolvePath = cached(function (path) {
var segments = path.replace(/^\//, '').split('/');
var resolved = [];
for (var i = 0, len = segments.length; i < len; i++) {
var segment = segments[i];
if (segment === '..') {
resolved.pop();
} else if (segment !== '.') {
resolved.push(segment);
}
}
return '/' + resolved.join('/')
});
function getPath() { function getPath() {
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while ( len-- ) args[ len ] = arguments[ len ];
@@ -4517,9 +4532,13 @@ History.prototype.toURL = function toURL (path, params, currentRoute) {
if (local) { if (local) {
var idIndex = currentRoute.indexOf('?'); var idIndex = currentRoute.indexOf('?');
path = path =
(idIndex > 0 ? currentRoute.substr(0, idIndex) : currentRoute) + path; (idIndex > 0 ? currentRoute.substring(0, idIndex) : currentRoute) + path;
} }
if (this.config.relativePath && path.indexOf('/') !== 0) {
var currentDir = currentRoute.substring(0, currentRoute.lastIndexOf('/') + 1);
return cleanPath(resolvePath(currentDir + path))
}
return cleanPath('/' + path) return cleanPath('/' + path)
}; };
@@ -5036,6 +5055,7 @@ var util = Object.freeze({
isAbsolutePath: isAbsolutePath, isAbsolutePath: isAbsolutePath,
getParentPath: getParentPath, getParentPath: getParentPath,
cleanPath: cleanPath, cleanPath: cleanPath,
resolvePath: resolvePath,
getPath: getPath, getPath: getPath,
replaceSlug: replaceSlug replaceSlug: replaceSlug
}); });
@@ -5046,7 +5066,7 @@ function initGlobalAPI () {
dom: dom, dom: dom,
get: get, get: get,
slugify: slugify, slugify: slugify,
version: '4.9.1' version: '4.9.2'
}; };
window.DocsifyCompiler = Compiler; window.DocsifyCompiler = Compiler;
window.marked = marked; window.marked = marked;
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -4
View File
@@ -8,10 +8,16 @@ function install(hook) {
var main = dom.getNode('#main'); var main = dom.getNode('#main');
div.style = "width: " + (main.clientWidth) + "px; margin: 0 auto 20px;"; div.style = "width: " + (main.clientWidth) + "px; margin: 0 auto 20px;";
dom.appendTo(dom.find('.content'), div); dom.appendTo(dom.find('.content'), div);
var script = dom.create('script'); });
var content = "gitalk.render('gitalk-container')";
script.textContent = content; hook.doneEach(function (_) {
dom.appendTo(dom.body, script); var el = document.getElementById('gitalk-container');
while (el.hasChildNodes()) {
el.removeChild(el.firstChild);
}
// eslint-disable-next-line
gitalk.render('gitalk-container');
}); });
} }
+1 -1
View File
@@ -1 +1 @@
$docsify.plugins=[].concat(function(t){var a=Docsify.dom;t.mounted(function(t){var n=a.create("div");n.id="gitalk-container";var i=a.getNode("#main");n.style="width: "+i.clientWidth+"px; margin: 0 auto 20px;",a.appendTo(a.find(".content"),n);var e=a.create("script");e.textContent="gitalk.render('gitalk-container')",a.appendTo(a.body,e)})},$docsify.plugins); $docsify.plugins=[].concat(function(i){var e=Docsify.dom;i.mounted(function(i){var n=e.create("div");n.id="gitalk-container";var t=e.getNode("#main");n.style="width: "+t.clientWidth+"px; margin: 0 auto 20px;",e.appendTo(e.find(".content"),n)}),i.doneEach(function(i){for(var n=document.getElementById("gitalk-container");n.hasChildNodes();)n.removeChild(n.firstChild);gitalk.render("gitalk-container")})},$docsify.plugins);
+1 -1
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
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
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.9.1", "version": "4.9.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "docsify", "name": "docsify",
"version": "4.9.1", "version": "4.9.2",
"description": "A magical documentation generator.", "description": "A magical documentation generator.",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",
@@ -32,11 +32,11 @@
"watch:css": "run-p 'css -- -o themes -w'", "watch:css": "run-p 'css -- -o themes -w'",
"watch:js": "node build/build.js", "watch:js": "node build/build.js",
"build:css:min": "mkdir lib/themes && run-p 'css -- -o lib/themes' && node build/mincss.js", "build:css:min": "mkdir lib/themes && run-p 'css -- -o lib/themes' && node build/mincss.js",
"build:css": "mkdir themes && run-p 'css -- -o themes'", "build:css": "mkdir -p themes && run-p 'css -- -o themes'",
"build:js": "cross-env NODE_ENV=production node build/build.js", "build:js": "cross-env NODE_ENV=production node build/build.js",
"build:ssr": "node build/ssr.js", "build:ssr": "node build/ssr.js",
"build:cover": "node build/cover.js", "build:cover": "node build/cover.js",
"build": "rimraf lib themes && run-s build:js build:css build:css:min build:ssr build:cover", "build": "rimraf lib themes/* && run-s build:js build:css build:css:min build:ssr build:cover",
"pub:next": "cross-env RELEASE_TAG=next sh build/release.sh", "pub:next": "cross-env RELEASE_TAG=next sh build/release.sh",
"pub": "sh build/release.sh", "pub": "sh build/release.sh",
"postinstall": "opencollective postinstall" "postinstall": "opencollective postinstall"
+1 -1
View File
@@ -37,5 +37,5 @@
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ=" "integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
} }
}, },
"version": "4.9.1" "version": "4.9.2"
} }
@@ -1,6 +1,6 @@
{ {
"name": "docsify-server-renderer", "name": "docsify-server-renderer",
"version": "4.9.1", "version": "4.9.2",
"description": "docsify server renderer", "description": "docsify server renderer",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",
+37
View File
@@ -0,0 +1,37 @@
function appendScript(options) {
const script = document.createElement('script')
script.async = true
script.src = options.host + '/matomo.js'
document.body.appendChild(script)
}
function init(options) {
window._paq = window._paq || []
window._paq.push(['trackPageView'])
window._paq.push(['enableLinkTracking'])
setTimeout(function() {
appendScript(options)
window._paq.push(['setTrackerUrl', options.host + '/matomo.php'])
window._paq.push(['setSiteId', options.id + ''])
}, 0)
}
function collect() {
if (!window._paq) {
init($docsify.matomo)
}
window._paq.push(['setCustomUrl', window.location.hash.substr(1)])
window._paq.push(['setDocumentTitle', document.title])
window._paq.push(['trackPageView'])
}
const install = function (hook) {
if (!$docsify.matomo) {
console.error('[Docsify] matomo is required.')
return
}
hook.beforeEach(collect)
}
$docsify.plugins = [].concat(install, $docsify.plugins)
+1
View File
@@ -0,0 +1 @@