Description
- Type:
- String
- Default:
- ''
可选,用来指定文章标题锚点链接图标的链接地址:
// Default URL - 默认链接,点击图标,页面会滚动到当前标题位置
new Outline()
// Customize URL - 直接打开链接了
@@ -717,6 +723,8 @@
stickyHeight: 0,
// 是否显示标题编号
showCode: true,
+ // 是否显示侧边的按钮工具栏
+ hasToolbar: true,
// 指定是否采用动画定位高亮当前的章节标题,默认值:true
// 当值为 false 时,则采用高亮当前章节标题的链接文字并加粗文字
// 如果喜欢更简洁的高亮效果,可以选择设置为 false
diff --git a/docs/js/anchors.min.js b/docs/js/anchors.min.js
new file mode 100644
index 00000000..7be3e599
--- /dev/null
+++ b/docs/js/anchors.min.js
@@ -0,0 +1,2 @@
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Anchors=e()}(this,(function(){"use strict";const t=t=>"string"==typeof t,e=t=>Object.prototype.toString.apply(t),s=t=>"function"==typeof t||"[object Function]"===e(t),r=t=>("[object Object]"===e(t)||"object"==typeof t||s(t))&&null!==t,n=t=>!!(r(t)&&t.nodeName&&t.tagName&&1===t.nodeType),i=(t,e=300)=>!!s(t)&&setTimeout((()=>{t()}),e),o=[];let l,c;function a(t){for(;t.timeRemaining()>0&&o.length;){const t=o.shift();if(!s(t))return!1;t()}o.length?l=requestIdleCallback(a):(l=0,s(c)&&(c(),c=null))}void 0===window.requestIdleCallback&&(window.requestIdleCallback=function(t){const e=Date.now();return i((function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})}),10)},window.cancelIdleCallback=function(t){clearTimeout(t)});const h=(t,e=null)=>{o.push(t),s(e)&&(c=e),l||requestIdleCallback(a)},d=t=>t*t,u=(e=null)=>{let s,r;return e?t(e)?r=document.querySelector(e):n(e)&&(r=e):(s=document.querySelectorAll("html,body"),r=s[0].scrollTop-s[1].scrollTop>=0?s[0]:s[1]),r},p=t=>{let e=t.offsetTop;return null!==t.offsetParent&&(e+=p(t.offsetParent)),e},m=(t,e="")=>{const s=e.replace(/^>/i,"");return!!(e&&s&&t)&&(t.matches?t.matches(s):!!t.msMatchesSelector&&t.msMatchesSelector(s))},f=t=>t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode,y=["focusout","blur","focusin","focus","load","unload","mouseenter","mouseleave"],b=(t,e,s)=>{const r=y.indexOf(e)>-1;s._delegateListener&&delete(s=s._delegateListener)._delegateListener,function(t,e,s){const r=t._listeners;let n=-1;if(r.length<1)return!1;r.forEach(((t,r)=>{const i=t.fn;e===t.type&&(n=r,i===s&&(n=r))})),n>-1&&r.splice(n,1)}(t,e,s),t.removeEventListener(e,s,r)},g=function(e,s,r=!1){const i=t(e)?document.querySelector(e):e,o=i.childNodes,l=((e,s)=>{let r=e._listeners||[];return t(s)&&s&&(r=r.filter((t=>t.type===s))),r})(i,s);l.forEach((t=>{b(i,t.type,t.fn)})),(r||!0===s||1===arguments.length)&&i&&o&&o.forEach((t=>{n(t)&&g(t,s,r)}))},v=(t,e,r)=>{if(!s(r))return g(t,e);b(t,e,r)},z=(t,e,s,r,n,i,o=!1)=>{const l=y.indexOf(s)>-1,c=function(l){const a=function(t){const e=t.target;return(s=e)&&3===s.nodeType?s.parentNode:s;var s}(l),h=((t,e,s,r)=>{const n=s||document;if(!t)return null;do{if(null!=e&&(e.startsWith(">")?t.parentNode===n&&m(t,e):m(t,e))||r&&t===n)return t;if(t===n)break}while(t=f(t))})(a,e,t);let d=i||t;l.delegateTarget=h,!0===i&&(d=n),h&&(!0===o&&v(t,s,c),r.call(d,l,n))};t._listeners||(t._listeners=[]),t._listeners.push({el:t,selector:e,type:s,fn:c,data:n,context:i,capture:l}),r._delegateListener=c,t.addEventListener(s,c,l)},x=t=>Array.isArray?Array.isArray(t):"[object Array]"===e(t),M=['','','','','','','','','','','','','','','','','','',''],$=(e,s="icon")=>t(e)?((t,e="icon")=>{const s=/id="(.*?)"/,r=/^(\w+)-/;return M.find((n=>{const i=s.exec(n)[1];return r.exec(i)[1]===e&&i===("icon"===e?`${e}-${t}`:`${e}-icon-${t}`)}))})(e,s):[...M],L=(e="")=>{const s=document.body;let r=document.querySelector("#outline-icons"),n=[];(e=>{if(!e)return!1;x(e)&&e.length>0?e.forEach((e=>{-1===M.indexOf(e)&&t(e)&&M.push(e)})):t(e)&&M.push(e)})(e),n=$(),r?r.innerHTML=n.join(""):(r=document.createElement("div"),r.innerHTML=``,s.insertBefore(r.firstChild,s.firstChild))},w=e=>!!t(e)&&e.replace(/(^\s+)|(\s+$)/g,""),A=t=>{return!(!r(t)||!(n(t)||(t=>!(!r(t)||"[object NodeList]"!==e(t)))(t)||(s=t,r(s)&&"[object DocumentFragment]"===e(s))||(t=>!(!r(t)||!("[object Text]"===e(t)||t.tagName&&3===t.nodeType)))(t)));var s},T=(t,e)=>{const s=Object.prototype.hasOwnProperty;return t&&s.call(t,e)},E=(t,e)=>{if(!t||!r(e))return!1;Object.keys(e).forEach((s=>{const r=e[s];T(e,s)&&((t,e,s)=>{let r=t.tagName.toLowerCase();switch(e){case"style":t.style.cssText=s;break;case"value":"input"===r||"textarea"===r?t.value=s:t.setAttribute(e,s);break;case"htmlFor":t.setAttribute("for",s);break;case"className":t.className=s;break;case"innerHTML":t.innerHTML=s;break;case"innerText":t.innerText=s;break;default:t.setAttribute(e,s)}})(t,s,r)}))},S=(e,s={})=>{const r="outline-icon",n=s.size||0,i=s.color||"",o=s.iconSet||"",l=x(n)?n[0]:n,c=x(n)?n[1]:n,a=n?`width:${l}px;height:${c}px;`:"",h=i?a+`color:${i}`:a,d=s.attrs||{},u=document.createElement("i");let p,m="",f="";return t(e)?((e=>{const s=new RegExp("^\\s*(?:<\\?xml[^>]*>\\s*)?(?:<\\!doctype svg[^>]*\\s*(?:\\[?(?:\\s*]*>\\s*)*\\]?)*[^>]*>\\s*)?