From 98d1b19bea618911c49eb9759c54da11497bcda5 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Tue, 24 Jan 2017 22:31:27 +0800 Subject: [PATCH] bump 1.9.0 --- CHANGELOG.md | 1 + docs/_coverpage.md | 2 +- lib/docsify.js | 20 ++++++++++++++------ lib/docsify.min.js | 4 ++-- lib/themes/buble.css | 2 +- lib/themes/pure.css | 2 +- lib/themes/vue.css | 2 +- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32a8839..67c3fba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +## 1.9.0 ### Bug fixes - Destroys the vue instance when the route is changed diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 89b6ea8..4847726 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@ ![logo](_media/icon.svg) -# docsify 1.8.0 +# docsify 1.9.0 > A magical documentation site generator. diff --git a/lib/docsify.js b/lib/docsify.js index ff1a8c7..79262f9 100644 --- a/lib/docsify.js +++ b/lib/docsify.js @@ -2463,11 +2463,14 @@ function tree (toc, tpl) { return tpl } +function helper (className, content) { + return ("

" + (content.slice(5).trim()) + "

") +} + var OPTIONS$1 = {}; var markdown = marked; var toc = []; var CACHE = {}; -var TIP_RE = /^!\s/; var renderTo = function (dom, content) { dom = typeof dom === 'object' ? dom : document.querySelector(dom); @@ -2517,8 +2520,12 @@ function init (options) { return ("" + text + "") }; renderer.paragraph = function (text) { - var isTip = TIP_RE.test(text); - return isTip ? ("

" + (text.replace(TIP_RE, '')) + "

") : ("

" + text + "

") + if (/^!>/.test(text)) { + return helper('tip', text) + } else if (/^\?>/.test(text)) { + return helper('warn', text) + } + return ("

" + text + "

") }; if (typeof OPTIONS$1.markdown === 'function') { @@ -2561,12 +2568,13 @@ function renderArticle (content) { if (content && typeof Vue !== 'undefined') { var script = content.match(']*?>([^<]+)'); - script && document.body.querySelector('article script').remove(); - var vm = script + script && document.body.querySelector('article script').remove(); + CACHE.vm && CACHE.vm.$destroy(); + CACHE.vm = script ? new Function(("return " + (script[1].trim())))() : new Vue({ el: 'main' }); // eslint-disable-line - vm && vm.$nextTick(function (_) { return scrollActiveSidebar(); }); + CACHE.vm && CACHE.vm.$nextTick(function (_) { return scrollActiveSidebar(); }); } if (OPTIONS$1.auto2top) { setTimeout(function () { return scroll2Top(OPTIONS$1.auto2top); }, 0); } } diff --git a/lib/docsify.min.js b/lib/docsify.min.js index 11274b2..65859bb 100644 --- a/lib/docsify.min.js +++ b/lib/docsify.min.js @@ -1,2 +1,2 @@ -var Docsify=function(){"use strict";function e(e,t,n){void 0===t&&(t="GET");var r=new XMLHttpRequest;return r.open(t,e),r.send(),{then:function(e,t){if(void 0===t&&(t=function(){}),n){var a=setInterval(function(e){return n({step:Math.floor(5*Math.random()+1)})},500);r.addEventListener("progress",n),r.addEventListener("loadend",function(e){n(e),clearInterval(a)})}r.addEventListener("error",t),r.addEventListener("load",function(n){var r=n.target;r.status>=400?t(r):e(r.response)})},abort:function(){return 4!==r.readyState&&r.abort()}}}function t(e,t){var n=[],r={};return e.forEach(function(e){var a=e.level||1,i=a-1;a>t||(r[i]?(r[i].children=r[i].children||[],r[i].children.push(e)):n.push(e),r[a]=e)}),n}function n(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}function r(e){return null===e||void 0===e}function a(){var e=window.location;if(E===e.hash&&!r($))return $;var t=e.hash.match(/^#\/([^#]+)/);return t=t&&2===t.length?t[1]:/^#\//.test(e.hash)?"":e.pathname,$=t,E=e.hash,t}function i(){return document.body.clientWidth<=600}function s(e){var t=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g,n=!1,r="-";if(s.occurrences=s.occurrences||{},"string"!=typeof e)return"";n||(e=e.toLowerCase());var a=e.trim().replace(/<[^>\d]+>/g,"").replace(t,"").replace(/\s/g,r).replace(/-+/g,r).replace(/^(\d)/,"_$1"),i=s.occurrences[a];return s.occurrences.hasOwnProperty(a)?i++:i=0,s.occurrences[a]=i,i&&(a=a+"-"+i),a}function o(){function e(){for(var e,r=document.body.scrollTop,i=0,s=n.length;ir){e||(e=l);break}e=l}if(e){var c=a[e.getAttribute("data-id")];c&&c!==o&&(o&&o.classList.remove("active"),c.classList.add("active"),o=c,!t&&!d.noSticky&&o.scrollIntoView(!1))}}if(!i()){for(var t=!1,n=document.querySelectorAll(".anchor"),r=document.querySelector("aside.sidebar"),a={},s=r.querySelectorAll("li"),o=r.querySelector("li.active"),l=0,c=s.length;l=e||d.dom.classList.contains("hidden")?(document.body.classList.add("sticky"),d.noSticky=!1):(document.body.classList.remove("sticky"),d.noSticky=!0)}()}function g(e,t){return t={exports:{}},e(t,t.exports),t.exports}function h(e){return e?(/\/\//.test(e)||(e="https://github.com/"+e),e=e.replace(/^git\+/,""),'\n \n \n '):""}function f(e){var t=e+'';return(i()?t+"
":"
"+t)+'
\n
\n
\n
'}function m(){var e=", 100%, 85%",t="linear-gradient(to left bottom, hsl("+(Math.floor(255*Math.random())+e)+") 0%, hsl("+(Math.floor(255*Math.random())+e)+") 100%)";return'
\n
\n
\n
'}function b(){return''}function v(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='
  • '+e.title+"
  • ",e.children&&(t+='
    • '+v(e.children)+"
    ")}),t):""}function y(e){M=e;var t=new j.Renderer;t.heading=function(e,t){var n=s(e),r="";return M.router&&(r="#/"+a()),P.push({level:t,slug:r+"#"+encodeURIComponent(n),title:e}),"'+e+""},t.code=function(e,t){void 0===t&&(t="");var n=O.highlight(e,O.languages[t]||O.languages.markup);return'
    '+n+"
    "},t.link=function(e,t,n){return M.router&&!/:/.test(e)&&(e=("#/"+e).replace(/\/\//g,"/")),''+n+""},t.paragraph=function(e){var t=F.test(e);return t?'

    '+e.replace(F,"")+"

    ":"

    "+e+"

    "},"function"==typeof M.markdown?(N.setOptions({renderer:t}),N=M.markdown.call(this,N)):N.setOptions(q({renderer:t},M.markdown))}function k(e,t){var n=document.querySelector("nav")||document.createElement("nav");M.repo||n.classList.add("no-badge"),e[t?"outerHTML":"innerHTML"]=h(M.repo)+(M.coverpage?m():"")+f(M.sidebarToggle?b():""),document.body.insertBefore(n,document.body.children[0]),u("button.sidebar-toggle"),M.coverpage?!i()&&window.addEventListener("scroll",d):document.body.classList.add("sticky")}function w(e){if(W("article",e?N(e):"not found"),M.sidebar||M.loadSidebar||L(),e&&"undefined"!=typeof Vue){var t=e.match("]*?>([^<]+)");t&&document.body.querySelector("article script").remove();var n=t?new Function("return "+t[1].trim())():new Vue({el:"main"});n&&n.$nextTick(function(e){return o()})}M.auto2top&&setTimeout(function(){return p(M.auto2top)},0)}function x(e){I.navbar&&I.navbar===e||(I.navbar=e,e&&W("nav",N(e)),c("nav"))}function L(e){var n;e?(n=N(e),n=n.match(/]*>([\s\S]+)<\/ul>/g)[0]):n=M.sidebar?v(M.sidebar,"