diff --git a/CHANGELOG.md b/CHANGELOG.md index ef22f2903..74b302250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.3 +### Bug fixes +- fix: rendering emojis +- fix: css var polyfill + ## 2.0.2 ### Bug fixes diff --git a/docs/_coverpage.md b/docs/_coverpage.md index c2c1d696b..bc99caabd 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@ ![logo](_media/icon.svg) -# docsify 2.0.2 +# docsify 2.0.3 > A magical documentation site generator. diff --git a/lib/docsify.js b/lib/docsify.js index 8c6948d4d..585994046 100644 --- a/lib/docsify.js +++ b/lib/docsify.js @@ -170,6 +170,7 @@ var merge = Object.assign || function (to) { function emojify (text) { return text + .replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, function (match) { return match.replace(/:/g, '__colon__'); }) .replace(/:(\w*?):/ig, '$1') .replace(/__colon__/g, ':') } @@ -2509,14 +2510,17 @@ function cssVars () { if (block.nodeName === 'STYLE') { replaceVar(block); } else if (block.nodeName === 'LINK') { - load(block.getAttribute('href')) - .then(function (res) { - var style = document.createElement('style'); + var href = block.getAttribute('href'); - style.innerHTML = res; - document.head.appendChild(style); - replaceVar(style); - }); + if (!/\.css$/.test(href)) { return } + + load(href).then(function (res) { + var style = document.createElement('style'); + + style.innerHTML = res; + document.head.appendChild(style); + replaceVar(style); + }); } }); } @@ -2557,7 +2561,7 @@ function init () { var hl = prism.highlight(code, prism.languages[lang] || prism.languages.markup); - return ("
" + (hl.replace(/:/g, '__colon__')) + "
") + return ("
" + hl + "
") }; renderer.link = function (href, title, text) { if (!/:/.test(href)) { diff --git a/lib/docsify.min.js b/lib/docsify.min.js index af0534917..70a30c1e0 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 i=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(i)})}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 i=e.level||1,a=i-1;i>t||(r[a]?(r[a].children=r[a].children||[],r[a].children.push(e)):n.push(e),r[i]=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 i(){var e=window.location;if(M===e.hash&&!r(j))return j;var t=e.hash.match(/^#\/([^#]+)/);return t=t&&2===t.length?t[1]:/^#\//.test(e.hash)?"":e.pathname,j=t,M=e.hash,t}function a(){return document.body.clientWidth<=600}function o(e){var t=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g,n=!1,r="-";if(o.occurrences=o.occurrences||{},"string"!=typeof e)return"";n||(e=e.toLowerCase());var i=e.trim().replace(/<[^>\d]+>/g,"").replace(t,"").replace(/\s/g,r).replace(/-+/g,r).replace(/^(\d)/,"_$1"),a=o.occurrences[i];return o.occurrences.hasOwnProperty(i)?a++:a=0,o.occurrences[i]=a,a&&(i=i+"-"+a),i}function s(e){return e.replace(/:(\w*?):/gi,'$1').replace(/__colon__/g,":")}function l(){function e(){for(var e,a=document.body.scrollTop,s=0,c=n.length;sa){e||(e=u);break}e=u}if(e){var p=o[e.getAttribute("data-id")];if(p&&p!==l&&(l&&l.classList.remove("active"),p.classList.add("active"),l=p,!t&&!h.noSticky)){var d=0,g=l.offsetTop+l.clientHeight+40,f=l.offsetTop>=r.scrollTop&&g<=r.scrollTop+i,m=g-d=e||h.dom.classList.contains("hidden")?(document.body.classList.add("sticky"),h.noSticky=!1):(document.body.classList.remove("sticky"),h.noSticky=!0)}()}function g(e,t){return t={exports:{}},e(t,t.exports),t.exports}function f(e){return e?(/\/\//.test(e)||(e="https://github.com/"+e),e=e.replace(/^git\+/,""),'\n \n \n '):""}function m(){var e=b()+'';return(a()?e+"
":"
"+e)+'
\n
\n
\n
'}function y(){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 k(e,t){return'

    '+t.slice(5).trim()+"

    "}function w(e){return""}function _(e){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,__docsify__.themeColor)}function x(){if(!(window.CSS&&window.CSS.supports&&window.CSS.supports("(--foo: red)"))){var t=document.querySelectorAll("style:not(.inserted),link");[].forEach.call(t,function(t){"STYLE"===t.nodeName?_(t):"LINK"===t.nodeName&&e(t.getAttribute("href")).then(function(e){var t=document.createElement("style");t.innerHTML=e,document.head.appendChild(t),_(t)})})}}function L(){var e=new I.Renderer;e.heading=function(e,t){var n=o(e),r="";return r="#/"+i(),z.push({level:t,slug:r+"#"+encodeURIComponent(n),title:e}),"'+e+""},e.code=function(e,t){void 0===t&&(t="");var n=F.highlight(e,F.languages[t]||F.languages.markup);return'
    '+n.replace(/:/g,"__colon__")+"
    "},e.link=function(e,t,n){return/:/.test(e)||(e=("#/"+e).replace(/\/\//g,"/")),''+n+""},e.paragraph=function(e){return/^!>/.test(e)?k("tip",e):/^\?>/.test(e)?k("warn",e):"

    "+e+"

    "},"function"==typeof __docsify__.markdown?(W.setOptions({renderer:e}),W=__docsify__.markdown.call(this,W)):W.setOptions(O({renderer:e},__docsify__.markdown));var t=W;W=function(e){return s(t(e))}}function S(e,t){var n=document.querySelector("nav")||document.createElement("nav");__docsify__.repo||n.classList.add("no-badge"),e[t?"outerHTML":"innerHTML"]=f(__docsify__.repo)+(__docsify__.coverpage?y():"")+m(),document.body.insertBefore(n,document.body.children[0]),__docsify__.themeColor&&(document.head.innerHTML+=w(__docsify__.themeColor),x()),p("button.sidebar-toggle"),__docsify__.coverpage?!a()&&window.addEventListener("scroll",h):document.body.classList.add("sticky")}function C(e){if(R("article",e?W(e):"not found"),__docsify__.loadSidebar||E(),e&&"undefined"!=typeof Vue){H.vm&&H.vm.$destroy();var t=[].slice.call(document.body.querySelectorAll("article>script")).filter(function(e){return!/template/.test(e.type)})[0],n=t?t.innerText.trim():null;t&&t.remove(),H.vm=n?new Function("return "+n)():new Vue({el:"main"}),H.vm&&H.vm.$nextTick(function(e){return l()})}__docsify__.auto2top&&setTimeout(function(){return d(__docsify__.auto2top)},0)}function $(e){H.navbar&&H.navbar===e||(H.navbar=e,e&&R("nav",W(e)),u("nav"))}function E(e){var n;e?(n=W(e),n=n.match(/]*>([\s\S]+)<\/ul>/g)[0]):n=v(t(z,__docsify__.maxLevel),"