[build] 4.3.5
This commit is contained in:
parent
ae3f74bfd4
commit
97793bfd6c
14 changed files with 89 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||

|
||||
|
||||
# docsify <small>4.3.4</small>
|
||||
# docsify <small>4.3.5</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
|
|
|||
|
|
@ -238,6 +238,11 @@ function toggleClass (el, type, val) {
|
|||
el && el.classList[val ? type : 'toggle'](val || type);
|
||||
}
|
||||
|
||||
function style (content) {
|
||||
appendTo(head, create('style', content));
|
||||
}
|
||||
|
||||
|
||||
|
||||
var dom = Object.freeze({
|
||||
getNode: getNode,
|
||||
|
|
@ -251,7 +256,8 @@ var dom = Object.freeze({
|
|||
before: before,
|
||||
on: on,
|
||||
off: off,
|
||||
toggleClass: toggleClass
|
||||
toggleClass: toggleClass,
|
||||
style: style
|
||||
});
|
||||
|
||||
var inBrowser = typeof window !== 'undefined';
|
||||
|
|
@ -484,10 +490,10 @@ var cssVars = function (color) {
|
|||
if (!/\.css$/.test(href)) { return }
|
||||
|
||||
get(href).then(function (res) {
|
||||
var style = create('style', res);
|
||||
var style$$1 = create('style', res);
|
||||
|
||||
head.appendChild(style);
|
||||
replaceVar(style, color);
|
||||
head.appendChild(style$$1);
|
||||
replaceVar(style$$1, color);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -3950,7 +3956,7 @@ initGlobalAPI();
|
|||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.3.4';
|
||||
Docsify.version = '4.3.5';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
|
|
|||
4
lib/docsify.min.js
vendored
4
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
64
lib/plugins/codesponsor.js
Normal file
64
lib/plugins/codesponsor.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
var DEFAULT_OPTIONS = {
|
||||
theme: 'light',
|
||||
image: 'show'
|
||||
};
|
||||
|
||||
function tpl (id, options) {
|
||||
var qs = [];
|
||||
|
||||
for (var key in options) {
|
||||
qs.push((key + "=" + (options[key])));
|
||||
}
|
||||
|
||||
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>";
|
||||
|
||||
return div
|
||||
}
|
||||
|
||||
function appIframe (id, opts) {
|
||||
var html = tpl(id, opts);
|
||||
|
||||
Docsify.dom.before(Docsify.dom.find('section.content'), html);
|
||||
}
|
||||
|
||||
function appendStyle () {
|
||||
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: 1300px) {\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 install = function (hook, vm) {
|
||||
var config = vm.config.codesponsor;
|
||||
var id;
|
||||
|
||||
if (typeof config === 'string') {
|
||||
id = config;
|
||||
config = {};
|
||||
} else {
|
||||
id = config.id;
|
||||
}
|
||||
|
||||
var opts = Docsify.util.merge(DEFAULT_OPTIONS, config);
|
||||
|
||||
if (!id) {
|
||||
throw Error('codesponsor plugin need id')
|
||||
}
|
||||
|
||||
if (Docsify.util.isMobile) {
|
||||
return
|
||||
}
|
||||
|
||||
// Append style
|
||||
hook.ready(function () {
|
||||
appendStyle();
|
||||
appIframe(id, opts);
|
||||
});
|
||||
};
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
|
||||
|
||||
}());
|
||||
1
lib/plugins/codesponsor.min.js
vendored
Normal file
1
lib/plugins/codesponsor.min.js
vendored
Normal file
|
|
@ -0,0 +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: 1300px) {\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)}();
|
||||
|
|
@ -171,8 +171,8 @@ var NO_DATA_TEXT = '';
|
|||
|
||||
function style () {
|
||||
var code = "\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}";
|
||||
var style = Docsify.dom.create('style', code);
|
||||
Docsify.dom.appendTo(Docsify.dom.head, style);
|
||||
|
||||
Docsify.dom.style(code);
|
||||
}
|
||||
|
||||
function tpl (opts, defaultValue) {
|
||||
|
|
|
|||
2
lib/plugins/search.min.js
vendored
2
lib/plugins/search.min.js
vendored
|
|
@ -1 +1 @@
|
|||
!function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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(y))}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(y).forEach(function(e){o=o.concat(Object.keys(y[e]).map(function(n){return y[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(),f=r.body&&r.body.trim(),l=r.slug||"";if(c&&f&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=f&&f.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var l=0,d=0;l=r<11?0:r-10,d=0===l?70:r+n.length+60,d>f.length&&(d=f.length);var p="..."+e(f).substring(l,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:l};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(y=JSON.parse(localStorage.getItem("docsify.search.index")),a)y={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,f=0;s.forEach(function(n){if(y[n])return f++;h.get(i.router.getFile(n)).then(function(r){y[n]=o(n,r,i.router,e.depth),c===++f&&t(e.maxAge)})})}function a(){var e=Docsify.dom.create("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}");Docsify.dom.appendTo(Docsify.dom.head,e)}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">'+m+"</p>"}function f(){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 l(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)m=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];m=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),f(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){l(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,y={},m="",g={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||g;Array.isArray(o)?g.paths=o:"object"==typeof o&&(g.paths=Array.isArray(o.paths)?o.paths:"auto",g.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:g.maxAge,g.placeholder=o.placeholder||g.placeholder,g.noData=o.noData||g.noData,g.depth=o.depth||g.depth);var i="auto"===g.paths;e.mounted(function(e){p(g,n),!i&&r(g,n)}),e.doneEach(function(e){u(g,n),i&&r(g,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
|
||||
!function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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)}();
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -37,5 +37,5 @@
|
|||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.3.4"
|
||||
"version": "4.3.5"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.3.4",
|
||||
"version": "4.3.5",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const DEFAULT_OPTIONS = {
|
|||
function tpl (id, options) {
|
||||
const qs = []
|
||||
|
||||
for (let key in options) {
|
||||
for (const key in options) {
|
||||
qs.push(`${key}=${options[key]}`)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue