Compare commits

...
23 Commits
Author SHA1 Message Date
qingwei.li 86583e19ab chore: add changelog 4.3.15 2017-10-20 12:55:30 +08:00
qingwei.li 0bef31951c [build] 4.3.15 2017-10-20 12:55:29 +08:00
qingwei.li a2b8eae8c4 fix: scroll active sidebar 2017-10-20 12:54:27 +08:00
qingwei.li 63d08369f6 chore: add changelog 4.3.14 2017-10-20 09:29:30 +08:00
qingwei.li 142623e87e [build] 4.3.14 2017-10-20 09:29:28 +08:00
qingwei.li ab682684ca fix: codesponsor style 2017-10-20 09:29:11 +08:00
qingwei.li e16c89e539 chore: add changelog 4.3.13 2017-10-17 10:28:28 +08:00
qingwei.li f1272a2f1c [build] 4.3.13 2017-10-17 10:28:26 +08:00
LaySentandcinwell.li 1b912272df feat: make whole search result clickable (#285) 2017-10-16 21:27:44 -05:00
Alexander Chibrikinandcinwell.li 3476f6ff1f fix: duplicate results in search fixed #257 (#284) 2017-10-16 21:16:37 -05:00
qingwei.li fac7ce693f chore: fix bootstrap script, fixed #282 2017-10-16 08:23:54 +08:00
Alexander Chibrikinandcinwell.li 470ee474d4 chore: ignore ./lib , force add ./lib on release (#283) 2017-10-15 19:20:35 -05:00
qingwei.li f7cf95a771 chore: add changelog 4.3.12 2017-10-15 21:26:50 +08:00
qingwei.li 4a9d594f7c [build] 4.3.12 2017-10-15 21:26:49 +08:00
LaySentandcinwell.li a3ab37952d fix: incorrect active link (#281)
* fix scroll issue in IE

* add meta tag for IE browser

* fix link render issue after page refreshing

* fix issue of incorrect active link

Should use both `path` and `id` to identify link, as `id` might not be unique under different paths
2017-10-15 08:25:49 -05:00
qingwei.li 6949455899 chore: add changelog 4.3.11 2017-10-15 10:44:35 +08:00
qingwei.li 4e52315564 [build] 4.3.11 2017-10-15 10:44:34 +08:00
qingwei.li 91d6337936 fix: broken links to same page heading, fix #278, fix #279 2017-10-15 10:43:35 +08:00
Gant Labordeandcinwell.li 26cc466420 chore: Add another fan of docsify! (#280)
* Add another fan of docsify!

Thanks for such a great documentation tool!

* Update README.md
2017-10-14 21:34:58 -05:00
Nicolas Gomes De Oliveiraandcinwell.li 6f92a871ca Update language-highlight.md (#277) 2017-10-13 02:46:32 -05:00
qingwei.li 538ee3d0dc chore: add changelog 4.3.10 2017-10-12 22:51:32 +08:00
qingwei.li 49fd30d73d [build] 4.3.10 2017-10-12 22:51:30 +08:00
LaySentandqingwei.li abd885e133 fix: link render issue after page refreshing (#276)
* fix scroll issue in IE

* add meta tag for IE browser

* fix link render issue after page refreshing
2017-10-12 22:48:07 +08:00
27 changed files with 180 additions and 72 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
*.log
.DS_Store
/themes
/themes/
node_modules
/lib/
+65
View File
@@ -1,3 +1,68 @@
<a name="4.3.15"></a>
## [4.3.15](https://github.com/QingWei-Li/docsify/compare/v4.3.14...v4.3.15) (2017-10-20)
### Bug Fixes
* scroll active sidebar ([a2b8eae](https://github.com/QingWei-Li/docsify/commit/a2b8eae))
<a name="4.3.14"></a>
## [4.3.14](https://github.com/QingWei-Li/docsify/compare/v4.3.13...v4.3.14) (2017-10-20)
### Bug Fixes
* codesponsor style ([ab68268](https://github.com/QingWei-Li/docsify/commit/ab68268))
<a name="4.3.13"></a>
## [4.3.13](https://github.com/QingWei-Li/docsify/compare/v4.3.12...v4.3.13) (2017-10-17)
### Bug Fixes
* duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f))
### Features
* make whole search result clickable ([#285](https://github.com/QingWei-Li/docsify/issues/285)) ([1b91227](https://github.com/QingWei-Li/docsify/commit/1b91227))
<a name="4.3.12"></a>
## [4.3.12](https://github.com/QingWei-Li/docsify/compare/v4.3.11...v4.3.12) (2017-10-15)
### Bug Fixes
* incorrect active link ([#281](https://github.com/QingWei-Li/docsify/issues/281)) ([a3ab379](https://github.com/QingWei-Li/docsify/commit/a3ab379))
<a name="4.3.11"></a>
## [4.3.11](https://github.com/QingWei-Li/docsify/compare/v4.3.10...v4.3.11) (2017-10-15)
### Bug Fixes
* broken links to same page heading, fix [#278](https://github.com/QingWei-Li/docsify/issues/278), fix [#279](https://github.com/QingWei-Li/docsify/issues/279) ([91d6337](https://github.com/QingWei-Li/docsify/commit/91d6337))
<a name="4.3.10"></a>
## [4.3.10](https://github.com/QingWei-Li/docsify/compare/v4.3.9...v4.3.10) (2017-10-12)
### Bug Fixes
* link render issue after page refreshing ([#276](https://github.com/QingWei-Li/docsify/issues/276)) ([abd885e](https://github.com/QingWei-Li/docsify/commit/abd885e))
<a name="4.3.9"></a>
## [4.3.9](https://github.com/QingWei-Li/docsify/compare/v4.3.8...v4.3.9) (2017-10-11)
+1
View File
@@ -82,6 +82,7 @@ These projects are using docsify to generate their sites. Pull requests welcome
| [Noty](http://ned.im/noty/) | A Dependency-free notification library |
| [xTeko](https://docs.xteko.com/) | Addins framework for Pin 3.0 |
| [vue2-datatable-component](https://github.com/OneWayTech/vue2-datatable) | The best Datatable for Vue.js 2.x which never sucks |
| [Solidarity](https://infinitered.github.io/solidarity/) | Environment enforcer for your projects across machines. |
## Similar projects
+1
View File
@@ -29,6 +29,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
# commit
git add -A
git add -f lib/ -A
git commit -m "[build] $VERSION $RELEASE_TAG"
npm --no-git-tag-version version $VERSION --message "[release] $VERSION $RELEASE_TAG"
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg)
# docsify <small>4.3.9</small>
# docsify <small>4.3.15</small>
> A magical documentation site generator.
+1 -1
View File
@@ -1,6 +1,6 @@
# language highlight
**docsify** uses [Prism](https://github.com/PrismJS/prism) to highlight code blocks in your pages. By default it only supports CSS, JavaScipt and HTML. You can make **Prism** load additional languages:
**docsify** uses [Prism](https://github.com/PrismJS/prism) to highlight code blocks in your pages. By default it only supports CSS, JavaScript and HTML. You can make **Prism** load additional languages:
```html
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
+23 -12
View File
@@ -3182,7 +3182,7 @@ function scrollTo (el) {
.begin();
}
function highlight () {
function highlight (path) {
if (!enableScrollEvent) { return }
var sidebar = getNode('.sidebar');
var anchors = findAll('.anchor');
@@ -3203,7 +3203,7 @@ function highlight () {
}
}
if (!last) { return }
var li = nav[last.getAttribute('data-id')];
var li = nav[getNavKey(path, last.getAttribute('data-id'))];
if (!li || li === active) { return }
@@ -3226,6 +3226,10 @@ function highlight () {
}
}
function getNavKey (path, id) {
return (path + "?id=" + id)
}
function scrollActiveSidebar (router) {
var cover = find('.cover.show');
coverHeight = cover ? cover.offsetHeight : 0;
@@ -3240,16 +3244,19 @@ function scrollActiveSidebar (router) {
var href = a.getAttribute('href');
if (href !== '/') {
href = router.parse(href).query.id;
var ref = router.parse(href);
var id = ref.query.id;
var path$1 = ref.path;
if (id) { href = getNavKey(path$1, id); }
}
if (href) { nav[decodeURIComponent(href)] = li; }
}
if (isMobile) { return }
off('scroll', highlight);
on('scroll', highlight);
var path = router.getCurrentPath();
off('scroll', function () { return highlight(path); });
on('scroll', function () { return highlight(path); });
on(sidebar, 'mouseover', function () {
hoverOver = true;
});
@@ -3258,13 +3265,13 @@ function scrollActiveSidebar (router) {
});
}
function scrollIntoView (id) {
function scrollIntoView (path, id) {
if (!id) { return }
var section = find('#' + id);
section && scrollTo(section);
var li = nav[id];
var li = nav[getNavKey(path, id)];
var sidebar = getNode('.sidebar');
var active = find(sidebar, 'li.active');
active && active.classList.remove('active');
@@ -3618,7 +3625,7 @@ var HashHistory = (function (History$$1) {
var query = '';
var hashIndex = path.indexOf('#');
if (hashIndex) {
if (hashIndex >= 0) {
path = path.slice(hashIndex + 1);
}
@@ -3643,7 +3650,11 @@ var HashHistory = (function (History$$1) {
path = route.path + stringifyQuery(route.query);
path = path.replace(/\.md(\?)|\.md$/, '$1');
if (local) { path = currentRoute + path; }
if (local) {
var idIndex = currentRoute.indexOf('?');
path =
(idIndex > 0 ? currentRoute.substr(0, idIndex) : currentRoute) + path;
}
return cleanPath('#/' + path)
};
@@ -3778,7 +3789,7 @@ function initRouter (vm) {
function eventMixin (proto) {
proto.$resetEvents = function () {
scrollIntoView(this.route.query.id);
scrollIntoView(this.route.path, this.route.query.id);
getAndActive(this.router, 'nav');
};
}
@@ -3979,7 +3990,7 @@ initGlobalAPI();
/**
* Version
*/
Docsify.version = '4.3.9';
Docsify.version = '4.3.15';
/**
* Run Docsify
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -16,7 +16,7 @@ function tpl (id, options) {
var div = Docsify.dom.create('div');
Docsify.dom.toggleClass(div, 'codesponsor');
div.innerHTML = "<iframe\n scrolling=0\n frameborder=0\n width=250\n height=250\n id=\"code-sponsor-embed-iframe\"\n src=\"https://app.codesponsor.io/widgets/" + id + "?" + (qs.join('&')) + "\">\n </iframe>";
div.innerHTML = "<iframe\n scrolling=0\n frameborder=0\n width=250\n height=auto\n style=\"max-height: 250px;\"\n id=\"code-sponsor-embed-iframe\"\n src=\"https://app.codesponsor.io/widgets/" + id + "?" + (qs.join('&')) + "\">\n </iframe>";
return div
}
+1 -1
View File
@@ -1 +1 @@
!function(){"use strict";function o(o,n){var i=[];for(var s in n)i.push(s+"="+n[s]);var e=Docsify.dom.create("div");return Docsify.dom.toggleClass(e,"codesponsor"),e.innerHTML='<iframe\n scrolling=0\n frameborder=0\n width=250\n height=250\n id="code-sponsor-embed-iframe"\n src="https://app.codesponsor.io/widgets/'+o+"?"+i.join("&")+'">\n </iframe>',e}function n(n,i){var s=o(n,i);Docsify.dom.before(Docsify.dom.find("section.content"),s)}function i(){Docsify.dom.style("\n .codesponsor {\n position: relative;\n float: right;\n right: 10px;\n top: 10px;\n }\n\n @media screen and (min-width: 1600px) {\n body.sticky .codesponsor {\n position: fixed;\n }\n\n .codesponsor {\n position: absolute;\n bottom: 10px;\n top: auto;\n float: none;\n }\n }\n ")}var s={theme:"light",image:"show"},e=function(o,e){var t,r=e.config.codesponsor;"string"==typeof r?(t=r,r={}):t=r.id;var c=Docsify.util.merge(s,r);if(!t)throw Error("codesponsor plugin need id");Docsify.util.isMobile||o.ready(function(){i(),n(t,c)})};window.$docsify.plugins=[].concat(e,window.$docsify.plugins)}();
!function(){"use strict";function o(o,n){var i=[];for(var e in n)i.push(e+"="+n[e]);var s=Docsify.dom.create("div");return Docsify.dom.toggleClass(s,"codesponsor"),s.innerHTML='<iframe\n scrolling=0\n frameborder=0\n width=250\n height=auto\n style="max-height: 250px;"\n id="code-sponsor-embed-iframe"\n src="https://app.codesponsor.io/widgets/'+o+"?"+i.join("&")+'">\n </iframe>',s}function n(n,i){var e=o(n,i);Docsify.dom.before(Docsify.dom.find("section.content"),e)}function i(){Docsify.dom.style("\n .codesponsor {\n position: relative;\n float: right;\n right: 10px;\n top: 10px;\n }\n\n @media screen and (min-width: 1600px) {\n body.sticky .codesponsor {\n position: fixed;\n }\n\n .codesponsor {\n position: absolute;\n bottom: 10px;\n top: auto;\n float: none;\n }\n }\n ")}var e={theme:"light",image:"show"},s=function(o,s){var t,r=s.config.codesponsor;"string"==typeof r?(t=r,r={}):t=r.id;var c=Docsify.util.merge(e,r);if(!t)throw Error("codesponsor plugin need id");Docsify.util.isMobile||o.ready(function(){i(),n(t,c)})};window.$docsify.plugins=[].concat(s,window.$docsify.plugins)}();
+11 -3
View File
@@ -70,14 +70,22 @@ function genIndex (path, content, router, depth) {
return index
}
function search (keywords) {
/**
* @param {String} query
* @returns {Array}
*/
function search (query) {
var matchingResults = [];
var data = [];
Object.keys(INDEXS).forEach(function (key) {
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
});
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\\\/]+/));
query = query.trim();
var keywords = query.split(/[\s\-\\\/]+/);
if (keywords.length !== 1) {
keywords = [].concat(query, keywords);
}
var loop = function ( i ) {
var post = data[i];
@@ -202,7 +210,7 @@ function doSearch (value) {
var html = '';
matchs.forEach(function (post) {
html += "<div class=\"matching-post\">\n<h2><a href=\"" + (post.url) + "\">" + (post.title) + "</a></h2>\n<p>" + (post.content) + "</p>\n</div>";
html += "<div class=\"matching-post\">\n<a href=\"" + (post.url) + "\"> \n<h2>" + (post.title) + "</h2>\n<p>" + (post.content) + "</p>\n</a>\n</div>";
});
$panel.classList.add('show');
+1 -1
View File
@@ -1 +1 @@
!function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=[].concat(n,n.trim().split(/[\s\-\\\\/]+/));for(var i=0;i<o.length;i++)!function(i){var r=o[i],a=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),f=r.slug||"";if(c&&l&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=l&&l.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var f=0,d=0;f=r<11?0:r-10,d=0===f?70:r+n.length+60,d>l.length&&(d=l.length);var p="..."+e(l).substring(f,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:f};t.push(d)}}(i);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),a)g={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,l=0;s.forEach(function(n){if(g[n])return l++;h.get(i.router.getFile(n)).then(function(r){g[n]=o(n,r,i.router,e.depth),c===++l&&t(e.maxAge)})})}function a(){Docsify.dom.style("\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}")}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<h2><a href="'+e.url+'">'+e.title+"</a></h2>\n<p>"+e.content+"</p>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+y+"</p>"}function l(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function f(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];y=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),l(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){f(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData,m.depth=o.depth||m.depth);var i="auto"===m.paths;e.mounted(function(e){p(m,n),!i&&r(m,n)}),e.doneEach(function(e){u(m,n),i&&r(m,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
!function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=n.trim();var i=n.split(/[\s\-\\\\/]+/);1!==i.length&&(i=[].concat(n,i));for(var r=0;r<o.length;r++)!function(n){var r=o[n],a=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),f=r.slug||"";if(c&&l&&(i.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=l&&l.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var f=0,d=0;f=r<11?0:r-10,d=0===f?70:r+n.length+60,d>l.length&&(d=l.length);var p="..."+e(l).substring(f,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:f};t.push(d)}}(r);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),a)g={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,l=0;s.forEach(function(n){if(g[n])return l++;h.get(i.router.getFile(n)).then(function(r){g[n]=o(n,r,i.router,e.depth),c===++l&&t(e.maxAge)})})}function a(){Docsify.dom.style("\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}")}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<a href="'+e.url+'"> \n<h2>'+e.title+"</h2>\n<p>"+e.content+"</p>\n</a>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+y+"</p>"}function l(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function f(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];y=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),l(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){f(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData,m.depth=o.depth||m.depth);var i="auto"===m.paths;e.mounted(function(e){p(m,n),!i&&r(m,n)}),e.doneEach(function(e){u(m,n),i&&r(m,n)})};$docsify.plugins=[].concat(v,$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
+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
+26 -26
View File
@@ -1,9 +1,19 @@
{
"name": "docsify",
"version": "4.3.9",
"version": "4.3.15",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"JSONStream": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz",
"integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=",
"dev": true,
"requires": {
"jsonparse": "1.3.1",
"through": "2.3.8"
}
},
"abbrev": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
@@ -991,8 +1001,8 @@
"integrity": "sha1-4ye1MZThp61dxjR57pCZpSsCSGU=",
"dev": true,
"requires": {
"is-text-path": "1.0.1",
"JSONStream": "1.3.1",
"is-text-path": "1.0.1",
"lodash": "4.17.4",
"meow": "3.7.0",
"split2": "2.1.1",
@@ -2846,11 +2856,6 @@
}
}
},
"string_decoder": {
"version": "0.10.31",
"bundled": true,
"dev": true
},
"string-width": {
"version": "1.0.2",
"bundled": true,
@@ -2861,6 +2866,11 @@
"strip-ansi": "3.0.1"
}
},
"string_decoder": {
"version": "0.10.31",
"bundled": true,
"dev": true
},
"stringstream": {
"version": "0.0.5",
"bundled": true,
@@ -3785,16 +3795,6 @@
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
"dev": true
},
"JSONStream": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz",
"integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=",
"dev": true,
"requires": {
"jsonparse": "1.3.1",
"through": "2.3.8"
}
},
"jsx-ast-utils": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz",
@@ -6500,15 +6500,6 @@
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true
},
"string_decoder": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"string-hash": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz",
@@ -6535,6 +6526,15 @@
"strip-ansi": "3.0.1"
}
},
"string_decoder": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "4.3.9",
"version": "4.3.15",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
@@ -20,7 +20,7 @@
"themes"
],
"scripts": {
"bootstrap": "npm i && lerna bootstrap",
"bootstrap": "npm i && lerna bootstrap && npm run build:ssr",
"build": "rm -rf lib themes && node build/build && mkdir lib/themes && mkdir themes && node build/build-css && npm run build:ssr && node build/build-cover",
"dev:build": "rm -rf lib themes && mkdir themes && node build/build --dev && node build/build-css --dev",
"dev": "node app & nodemon -w src -e js,css --exec 'npm run dev:build'",
+1 -1
View File
@@ -37,5 +37,5 @@
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
}
},
"version": "4.3.9"
"version": "4.3.15"
}
@@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
"version": "4.3.9",
"version": "4.3.15",
"description": "docsify server renderer",
"author": {
"name": "qingwei-li",
+1 -1
View File
@@ -5,7 +5,7 @@ import { scrollIntoView } from './scroll'
export function eventMixin (proto) {
proto.$resetEvents = function () {
scrollIntoView(this.route.query.id)
scrollIntoView(this.route.path, this.route.query.id)
sidebar.getAndActive(this.router, 'nav')
}
}
+13 -8
View File
@@ -24,7 +24,7 @@ function scrollTo (el) {
.begin()
}
function highlight () {
function highlight (path) {
if (!enableScrollEvent) return
const sidebar = dom.getNode('.sidebar')
const anchors = dom.findAll('.anchor')
@@ -45,7 +45,7 @@ function highlight () {
}
}
if (!last) return
const li = nav[last.getAttribute('data-id')]
const li = nav[getNavKey(path, last.getAttribute('data-id'))]
if (!li || li === active) return
@@ -68,6 +68,10 @@ function highlight () {
}
}
function getNavKey (path, id) {
return `${path}?id=${id}`
}
export function scrollActiveSidebar (router) {
const cover = dom.find('.cover.show')
coverHeight = cover ? cover.offsetHeight : 0
@@ -82,16 +86,17 @@ export function scrollActiveSidebar (router) {
let href = a.getAttribute('href')
if (href !== '/') {
href = router.parse(href).query.id
const { query: { id }, path } = router.parse(href)
if (id) href = getNavKey(path, id)
}
if (href) nav[decodeURIComponent(href)] = li
}
if (isMobile) return
dom.off('scroll', highlight)
dom.on('scroll', highlight)
const path = router.getCurrentPath()
dom.off('scroll', () => highlight(path))
dom.on('scroll', () => highlight(path))
dom.on(sidebar, 'mouseover', () => {
hoverOver = true
})
@@ -100,13 +105,13 @@ export function scrollActiveSidebar (router) {
})
}
export function scrollIntoView (id) {
export function scrollIntoView (path, id) {
if (!id) return
const section = dom.find('#' + id)
section && scrollTo(section)
const li = nav[id]
const li = nav[getNavKey(path, id)]
const sidebar = dom.getNode('.sidebar')
const active = dom.find(sidebar, 'li.active')
active && active.classList.remove('active')
+6 -2
View File
@@ -55,7 +55,7 @@ export class HashHistory extends History {
let query = ''
const hashIndex = path.indexOf('#')
if (hashIndex) {
if (hashIndex >= 0) {
path = path.slice(hashIndex + 1)
}
@@ -80,7 +80,11 @@ export class HashHistory extends History {
path = route.path + stringifyQuery(route.query)
path = path.replace(/\.md(\?)|\.md$/, '$1')
if (local) path = currentRoute + path
if (local) {
const idIndex = currentRoute.indexOf('?')
path =
(idIndex > 0 ? currentRoute.substr(0, idIndex) : currentRoute) + path
}
return cleanPath('#/' + path)
}
+2 -1
View File
@@ -17,7 +17,8 @@ function tpl (id, options) {
scrolling=0
frameborder=0
width=250
height=250
height=auto
style="max-height: 250px;"
id="code-sponsor-embed-iframe"
src="https://app.codesponsor.io/widgets/${id}?${qs.join('&')}">
</iframe>`
+3 -1
View File
@@ -94,8 +94,10 @@ function doSearch (value) {
let html = ''
matchs.forEach(post => {
html += `<div class="matching-post">
<h2><a href="${post.url}">${post.title}</a></h2>
<a href="${post.url}">
<h2>${post.title}</h2>
<p>${post.content}</p>
</a>
</div>`
})
+10 -2
View File
@@ -65,14 +65,22 @@ export function genIndex (path, content = '', router, depth) {
return index
}
export function search (keywords) {
/**
* @param {String} query
* @returns {Array}
*/
export function search (query) {
const matchingResults = []
let data = []
Object.keys(INDEXS).forEach(key => {
data = data.concat(Object.keys(INDEXS[key]).map(page => INDEXS[key][page]))
})
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\\\/]+/))
query = query.trim()
let keywords = query.split(/[\s\-\\\/]+/)
if (keywords.length !== 1) {
keywords = [].concat(query, keywords)
}
for (let i = 0; i < data.length; i++) {
const post = data[i]
+1
View File
@@ -52,6 +52,7 @@ div#app {
.search .search-keyword {
color: var(--theme-color, $color-primary);
font-style: normal;
font-weight: bold;
}
html,