518 lines
1.3 MiB
JavaScript
518 lines
1.3 MiB
JavaScript
/*
|
|||
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
|
|
if you want to view the source, please visit the github repository of this plugin
|
||
|
|
*/
|
||
|
|
|
||
|
|
var M1=Object.defineProperty;var Q2=Object.getOwnPropertyDescriptor;var X2=Object.getOwnPropertyNames;var c4=Object.prototype.hasOwnProperty;var a4=(i,n)=>{for(var c in n)M1(i,c,{get:n[c],enumerable:!0})},e4=(i,n,c,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of X2(n))!c4.call(i,e)&&e!==c&&M1(i,e,{get:()=>n[e],enumerable:!(a=Q2(n,e))||a.enumerable});return i};var i4=i=>e4(M1({},"__esModule",{value:!0}),i);var $L={};a4($L,{default:()=>d1});module.exports=i4($L);var u=require("obsidian");var O1='<svg viewBox="0 0 100 100" class="add-admonition-command"><path fill="currentColor" stroke="currentColor" d="M37,16c-4.4,0-8.3,3.3-9.2,7.6l-11.6,52c-0.5,2.2,0,4.3,1.2,5.9c1.2,1.6,3.2,2.6,5.4,2.6H79c4.4,0,8.3-3.3,9.2-7.6 l11.6-52c0.5-2.2,0-4.3-1.2-5.9C97.4,17,95.4,16,93.2,16L37,16z M37,20h56.2c1.1,0,1.8,0.4,2.2,1c0.5,0.6,0.7,1.4,0.4,2.6l-1,4.4 H30.8l0.8-3.6C32.1,22.2,34.8,20,37,20z M29.9,32H94l-9.6,43.6C83.9,77.8,81.2,80,79,80H22.8c-1.1,0-1.8-0.4-2.2-1 c-0.5-0.6-0.7-1.4-0.4-2.6L29.9,32z M0,36v4h19.6l0.9-4L0,36z M36.7,38c-0.8,0.1-1.4,0.7-1.6,1.5l-3.5,14c-0.2,0.6,0,1.2,0.4,1.7 c0.4,0.5,1,0.8,1.6,0.8H81c0.9,0,1.7-0.6,1.9-1.5l3.5-14c0.2-0.6,0-1.3-0.4-1.8c-0.4-0.5-1-0.8-1.6-0.8H37.1c-0.1,0-0.1,0-0.2,0 C36.9,38,36.8,38,36.7,38L36.7,38z M38.7,42h43.2l-2.4,10H36.2L38.7,42z M0,52v4h16l0.9-4H0z M0,68v4h12.4l0.9-4H0z"></path><circle fill="white" transform="translate(50 50) scale(3 3)" cx="8" cy="8" r="8"/><path fill="green" transform="translate(50 50) scale(3 3)" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3z"/></svg>',a1="admonition-add-command",F1='<svg viewBox="0 0 100 100" class="remove-admonition-command"><path fill="currentColor" stroke="currentColor" d="M37,16c-4.4,0-8.3,3.3-9.2,7.6l-11.6,52c-0.5,2.2,0,4.3,1.2,5.9c1.2,1.6,3.2,2.6,5.4,2.6H79c4.4,0,8.3-3.3,9.2-7.6 l11.6-52c0.5-2.2,0-4.3-1.2-5.9C97.4,17,95.4,16,93.2,16L37,16z M37,20h56.2c1.1,0,1.8,0.4,2.2,1c0.5,0.6,0.7,1.4,0.4,2.6l-1,4.4 H30.8l0.8-3.6C32.1,22.2,34.8,20,37,20z M29.9,32H94l-9.6,43.6C83.9,77.8,81.2,80,79,80H22.8c-1.1,0-1.8-0.4-2.2-1 c-0.5-0.6-0.7-1.4-0.4-2.6L29.9,32z M0,36v4h19.6l0.9-4L0,36z M36.7,38c-0.8,0.1-1.4,0.7-1.6,1.5l-3.5,14c-0.2,0.6,0,1.2,0.4,1.7 c0.4,0.5,1,0.8,1.6,0.8H81c0.9,0,1.7-0.6,1.9-1.5l3.5-14c0.2-0.6,0-1.3-0.4-1.8c-0.4-0.5-1-0.8-1.6-0.8H37.1c-0.1,0-0.1,0-0.2,0 C36.9,38,36.8,38,36.7,38L36.7,38z M38.7,42h43.2l-2.4,10H36.2L38.7,42z M0,52v4h16l0.9-4H0z M0,68v4h12.4l0.9-4H0z"></path><circle fill="white" transform="translate(50 50) scale(3 3)" cx="8" cy="8" r="8"/><path fill="#dc3545" transform="translate(50 50) scale(3 3)" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM4.5 7.5a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7z"/></svg>',e1="admonition-remove-command",q1='<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/></svg>',U="admonition-warning",R1='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M304 48C304 74.51 282.5 96 256 96C229.5 96 208 74.51 208 48C208 21.49 229.5 0 256 0C282.5 0 304 21.49 304 48zM304 464C304 490.5 282.5 512 256 512C229.5 512 208 490.5 208 464C208 437.5 229.5 416 256 416C282.5 416 304 437.5 304 464zM0 256C0 229.5 21.49 208 48 208C74.51 208 96 229.5 96 256C96 282.5 74.51 304 48 304C21.49 304 0 282.5 0 256zM512 256C512 282.5 490.5 304 464 304C437.5 304 416 28
|
||
|
|
`),r=0,f={};for(let d=0;d<l.length;d++){let C=n4(l[d],e);if(C===!1)break;let V=o[C];if(f[V]!==void 0)break;f[V]=l[d].slice(e[C].length).trim(),++r}let{title:h,collapse:v,icon:m,color:s,metadata:p}=f;if(s?.startsWith("rgb")&&(s=s.slice(4,-1)),s?.startsWith("#")){let d=s.slice(1),C=Number.parseInt(d,16),V=C>>16&255,L=C>>8&255,g=C&255;s=`${V}, ${L}, ${g}`}if(s?.startsWith("hsl")){let[d,C,V]=s.slice(4,-1).split(",").map(y=>Number(y.replace("%","").trim())),[L,g,x]=l4(d,C,V);s=`${L}, ${g}, ${x}`}if(s&&(s.startsWith("hsb")||s.startsWith("hsv"))){let[d,C,V]=s.slice(4,-1).split(",").map(y=>Number(y.replace("%","").trim())),[L,g,x]=o4(d,C,V);s=`${L}, ${g}, ${x}`}let M=l.slice(r).join(`
|
||
|
|
`);return v!==void 0&&v!=="none"&&v!=="open"&&v!=="closed"&&(v="closed"),"title"in f||c.noTitle||(h=a),h&&h.trim()===""&&v!==void 0&&v!=="none"&&(h=a,new G1.Notice("An admonition must have a title if it is collapsible.")),{title:h,collapse:v,content:M,icon:m,color:s,metadata:p}}function l4(i,n,c){let a=i/360,e=n/100,o=c/100,l=0,r=0,f=0;if(e===0)l=o,r=o,f=o;else{let h=(s,p,M)=>{let d=M<0?M+1:M>1?M-1:M;return d<.16666666666666666?s+(p-s)*6*d:d<.5?p:d<.6666666666666666?s+(p-s)*(.6666666666666666-d)*6:s},v=o<.5?o*(1+e):o+e-o*e,m=2*o-v;l=h(m,v,a+1/3),r=h(m,v,a),f=h(m,v,a-1/3)}return[Math.round(l*255),Math.round(r*255),Math.round(f*255)]}function o4(i,n,c){let a=i/360,e=n/100,o=c/100,l=0,r=0,f=0,h=Math.floor(a*6),v=a*6-h,m=o*(1-e),s=o*(1-v*e),p=o*(1-(1-v)*e);switch(h%6){case 0:l=o,r=p,f=m;break;case 1:l=s,r=o,f=m;break;case 2:l=m,r=o,f=p;break;case 3:l=m,r=s,f=o;break;case 4:l=p,r=m,f=o;break;case 5:l=o,r=m,f=s;break}return[Math.round(l*255),Math.round(r*255),Math.round(f*255)]}var I=require("obsidian");var _1=require("obsidian"),i1=class extends _1.EditorSuggest{constructor(c){super(c.app);this.plugin=c}getSuggestions(c){return c.query?.length?Object.entries(this.plugin.admonitions).filter(a=>a[0].toLowerCase().contains(c.query.toLowerCase())):Object.entries(this.plugin.admonitions)}renderSuggestion([c,a],e){e.addClasses(["admonition-suggester-item","mod-complex"]),e.style.setProperty("--callout-color",a.color),e.createSpan({text:c});let o=e.createDiv("suggestion-aux").createDiv({cls:"suggestion-flair",attr:{style:"color: rgb(var(--callout-color))"}}),l=this.plugin.iconManager.getIconNode(a.icon);l instanceof HTMLDivElement&&l.childElementCount===1?l=l.firstElementChild:l!==null&&(l.removeClass("svg-inline--fa"),l.addClass("svg-icon")),o.appendChild(l??createDiv())}onTrigger(c,a){let e=a.getLine(c.line),o=this.testAndReturnQuery(e,c);if(!o)return null;let[l,r,f]=o;return Object.keys(this.plugin.admonitions).find(h=>h.toLowerCase()===f.toLowerCase())?null:{end:c,start:{ch:o.index+r.length,line:c.line},query:f}}},n1=class extends i1{selectSuggestion([n],c){if(!this.context)return;let{editor:a,query:e,start:o,end:l}=this.context,r=a.getLine(l.line).slice(l.ch),[f,h]=r.match(/^(\] ?)/)??[];a.replaceRange(`${n}] `,o,{...l,ch:o.ch+e.length+(h?.length??0)},"admonitions"),a.setCursor(o.line,o.ch+n.length+2),this.close()}testAndReturnQuery(n,c){if(/> ?\[!\w+\]/.test(n.slice(0,c.ch)))return null;let a=n.match(/(> ?\[!)(\w*)\]?/);return a||null}},l1=class extends i1{selectSuggestion([n],c){if(!this.context)return;let{editor:a,start:e,end:o}=this.context;a.replaceRange(`${n}`,e,o,"admonitions"),a.setCursor(e.line,e.ch+n.length),this.close()}testAndReturnQuery(n,c){if(!/```ad-\w*/.test(n))return null;let a=n.match(/(```ad-)(\w*)/);return a||null}};var W=class extends I.Component{constructor(c){super();this.plugin=c;this.heights=["height","padding-top","padding-bottom","margin-top","margin-bottom"];this.heightMap=new WeakMap;this.indexing=[];this.style=document.head.createEl("style",{attr:{id:"ADMONITIONS_CUSTOM_STYLE_SHEET"}})}onload(){document.head.appendChild(this.style);for(let c of Object.values(this.plugin.data.userAdmonitions))this.addAdmonition(c);this.setUseSnippet(),this.plugin.registerEditorSuggest(new n1(this.plugin)),this.plugin.registerMarkdownPostProcessor(this.calloutProcessor.bind(this))}calloutProcessor(c,a){let e=c?.querySelector(".callout");if(!e)return;let o=e.dataset.callout,l=this.plugin.admonitions[o];if(!l)return;let r=e.querySelector(".callout-title"),f=e.querySelector(".callout-content"),h=a.getSectionInfo(c);if(h){let{text:v,lineStart:m,lineEnd:s}=h,p=v.split(`
|
||
|
|
`)[m],[,M]=p.match(/> \[!.+\|(.*)]/)??[];if(M&&(e.dataset.calloutMetadata=M),f&&(this.plugin.admonitions[o].copy??this.plugin.data.copyButton)){let d=f.createDiv("admonition-content-copy");(0,I.setIcon)(d,"copy"),d.addEventListener("click",()=>{navigator.clipboard.writeText(v.split(`
|
||
|
|
`).slice(m+1,s+1).join(`
|
||
|
|
`).replace(/^> /gm,"")).then(async()=>{new I.Notice("Callout content copied to clipboard.")})})}}if(l.noTitle&&!e.dataset.calloutFold&&r.querySelector(".callout-title-inner")?.textContent?.toLowerCase()===l.type.toLowerCase()&&r.addClass("no-title"),!l.noTitle&&this.plugin.data.autoCollapse&&!e.dataset.calloutFold&&this.setCollapsible(e),l.title&&r.textContent===o[0].toUpperCase()+o.slice(1).toLowerCase()){let v=r.querySelector(".callout-title-inner");v&&v.setText(l.title)}this.plugin.data.dropShadow&&e.addClass("drop-shadow")}setCollapsible(c){let a=c.querySelector(".callout-title"),e=c.querySelector(".callout-content");if(!e)return;c.addClass("is-collapsible"),this.plugin.data.defaultCollapseType==="closed"?(c.dataset.calloutFold="-",c.addClass("is-collapsed")):c.dataset.calloutFold="+";let o=a.createDiv("callout-fold");(0,I.setIcon)(o,"chevron-down");let l=c.hasClass("is-collapsed");if(this.getComputedHeights(e),l)for(let r of this.heights)e.style.setProperty(r,"0px");a.onclick=r=>{this.collapse(c,r)}}collapse(c,a){a?.preventDefault();let e=c.querySelector(".callout-content");function o(r){e.removeEventListener("transitionend",o),e.style.removeProperty("transition")}e.addEventListener("transitionend",o),e.style.setProperty("transition","all 100ms cubic-bezier(.02, .01, .47, 1)");let l=c.hasClass("is-collapsed");if(!a||a.button===0){let r=this.getComputedHeights(e);for(let f of this.heights)e.style.setProperty(f,l?r[f]:"0px");c.toggleClass("is-collapsed",!l)}}getComputedHeights(c){if(this.heightMap.has(c))return this.heightMap.get(c);let a=getComputedStyle(c),e={};for(let o of this.heights)e[o]=a.getPropertyValue(o);return this.heightMap.set(c,e),e}generateCssString(){let c=[`/* This snippet was auto-generated by the Admonitions plugin */
|
||
|
|
|
||
|
|
`];for(let a of Array.from(this.sheet.cssRules))c.push(a.cssText);return c.join(`
|
||
|
|
|
||
|
|
`)}addAdmonition(c){let a=c.type.toLowerCase();if(this.indexing.contains(a)){let l=this.indexing.indexOf(a);this.sheet.deleteRule(l),this.indexing.splice(l,1)}if(this.plugin.isIconWithCss(c)){this.updateSnippet();return}if(!c.icon){this.updateSnippet();return}let e,o=this.plugin.shouldInjectColor(c)?`--callout-color: ${c.color};`:"";c.icon.type==="obsidian"?e=`.callout[data-callout="${a}"] {
|
||
|
|
${o}
|
||
|
|
--callout-icon: ${c.icon.name}; /* Icon name from the Obsidian Icon Set */
|
||
|
|
}`:e=`.callout[data-callout="${a}"] {
|
||
|
|
${o}
|
||
|
|
--callout-icon: "${(this.plugin.iconManager.getIconNode(c.icon)?.outerHTML??"").replace(/(width|height)=(\\?"|')\d+(\\?"|')/g,"").replace(/"/g,'\\"')}";
|
||
|
|
}`,this.indexing=[...this.indexing.filter(l=>l!==a),a],this.sheet.insertRule(e,this.sheet.cssRules.length),this.updateSnippet()}removeAdmonition(c){if(!this.indexing.contains(c.type))return;let a=this.indexing.indexOf(c.type);this.sheet.deleteRule(a),this.indexing.splice(a,1),this.updateSnippet()}get sheet(){return this.style.sheet}unload(){this.style.detach()}get snippetPath(){return this.plugin.app.customCss.getSnippetPath(this.plugin.data.snippetPath)}setUseSnippet(){this.plugin.data.useSnippet?this.updateSnippet():(this.plugin.app.customCss.setCssEnabledStatus(this.plugin.data.snippetPath,!1),this.plugin.app.customCss.readSnippets(),this.plugin.data.snippetPath&&this.plugin.app.vault.adapter.remove(this.snippetPath).catch(()=>{}))}async updateSnippet(){if(!this.plugin.data.useSnippet)return;let c=this.snippetPath,a=c.substring(0,c.lastIndexOf("/"));await this.plugin.app.vault.adapter.exists(a)||await this.plugin.app.vault.adapter.mkdir(a),await this.plugin.app.vault.adapter.write(c,this.generateCssString()),this.plugin.app.customCss.setCssEnabledStatus(this.plugin.data.snippetPath,!0),this.plugin.app.customCss.readSnippets()}};function j(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(n){return typeof n}:j=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},j(i)}function r4(i,n){if(!(i instanceof n))throw new TypeError("Cannot call a class as a function")}function j1(i,n){for(var c=0;c<n.length;c++){var a=n[c];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(i,a.key,a)}}function f4(i,n,c){return n&&j1(i.prototype,n),c&&j1(i,c),i}function t4(i,n,c){return n in i?Object.defineProperty(i,n,{value:c,enumerable:!0,configurable:!0,writable:!0}):i[n]=c,i}function H(i){for(var n=1;n<arguments.length;n++){var c=arguments[n]!=null?arguments[n]:{},a=Object.keys(c);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(c).filter(function(e){return Object.getOwnPropertyDescriptor(c,e).enumerable}))),a.forEach(function(e){t4(i,e,c[e])})}return i}function n2(i,n){return s4(i)||h4(i,n)||v4()}function s4(i){if(Array.isArray(i))return i}function h4(i,n){var c=[],a=!0,e=!1,o=void 0;try{for(var l=i[Symbol.iterator](),r;!(a=(r=l.next()).done)&&(c.push(r.value),!(n&&c.length===n));a=!0);}catch(f){e=!0,o=f}finally{try{!a&&l.return!=null&&l.return()}finally{if(e)throw o}}return c}function v4(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var $1=function(){},x1={},l2={},m4=null,o2={mark:$1,measure:$1};try{typeof window<"u"&&(x1=window),typeof document<"u"&&(l2=document),typeof MutationObserver<"u"&&(m4=MutationObserver),typeof performance<"u"&&(o2=performance)}catch{}var z4=x1.navigator||{},Y1=z4.userAgent,K1=Y1===void 0?"":Y1,h1=x1,b=l2;var o1=o2,ng=!!h1.document,b1=!!b.documentElement&&!!b.head&&typeof b.addEventListener=="function"&&typeof b.createElement=="function",lg=~K1.indexOf("MSIE")||~K1.indexOf("Trident/"),T="___FONT_AWESOME___";var r2="fa",f2="svg-inline--fa",p4="data-fa-i2svg";var og=(function(){try{return!0}catch{return!1}})();var t2=[1,2,3,4,5,6,7,8,9,10],d4=t2.concat([11,12,13,14,15,16,17,18,19,20]);var Z={GROUP:"group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},rg=["xs","sm","lg","fw","ul","li","border","pull-left","pull-right","spin","pulse","rotate-90","rotate-180","rotate-270","flip-horizontal","flip-vertical","flip-both","stack","stack-1x","stack-2x","inverse","layers","layers-text","layers-counter",Z.GROUP,Z.SWAP_OPACITY,Z.PRIMARY,Z.SECONDARY].concat(t2.map(function(i){return"".concat(i,"x")})).concat(d4.map(function(i){return"w-".concat(i)})),s2=h1.FontAwesomeConfig||{};function M4(i){var n=b.querySelector("script["+i+"]");if(n)return n.getAttribute(i)}function u4(i){return i===""?!0:i==="false"?!1:i==="true"?!0:i}b&&typeof b.querySelector=="function"&&(J1=[["data-family-prefix","familyPrefix"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],
|
||
|
|
overflow: visible;
|
||
|
|
}
|
||
|
|
|
||
|
|
.svg-inline--fa {
|
||
|
|
display: inline-block;
|
||
|
|
font-size: inherit;
|
||
|
|
height: 1em;
|
||
|
|
overflow: visible;
|
||
|
|
vertical-align: -0.125em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-lg {
|
||
|
|
vertical-align: -0.225em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-1 {
|
||
|
|
width: 0.0625em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-2 {
|
||
|
|
width: 0.125em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-3 {
|
||
|
|
width: 0.1875em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-4 {
|
||
|
|
width: 0.25em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-5 {
|
||
|
|
width: 0.3125em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-6 {
|
||
|
|
width: 0.375em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-7 {
|
||
|
|
width: 0.4375em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-8 {
|
||
|
|
width: 0.5em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-9 {
|
||
|
|
width: 0.5625em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-10 {
|
||
|
|
width: 0.625em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-11 {
|
||
|
|
width: 0.6875em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-12 {
|
||
|
|
width: 0.75em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-13 {
|
||
|
|
width: 0.8125em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-14 {
|
||
|
|
width: 0.875em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-15 {
|
||
|
|
width: 0.9375em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-16 {
|
||
|
|
width: 1em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-17 {
|
||
|
|
width: 1.0625em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-18 {
|
||
|
|
width: 1.125em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-19 {
|
||
|
|
width: 1.1875em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-w-20 {
|
||
|
|
width: 1.25em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-pull-left {
|
||
|
|
margin-right: 0.3em;
|
||
|
|
width: auto;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-pull-right {
|
||
|
|
margin-left: 0.3em;
|
||
|
|
width: auto;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-border {
|
||
|
|
height: 1.5em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-li {
|
||
|
|
width: 2em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-fw {
|
||
|
|
width: 1.25em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers svg.svg-inline--fa {
|
||
|
|
bottom: 0;
|
||
|
|
left: 0;
|
||
|
|
margin: auto;
|
||
|
|
position: absolute;
|
||
|
|
right: 0;
|
||
|
|
top: 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers {
|
||
|
|
display: inline-block;
|
||
|
|
height: 1em;
|
||
|
|
position: relative;
|
||
|
|
text-align: center;
|
||
|
|
vertical-align: -0.125em;
|
||
|
|
width: 1em;
|
||
|
|
}
|
||
|
|
.fa-layers svg.svg-inline--fa {
|
||
|
|
-webkit-transform-origin: center center;
|
||
|
|
transform-origin: center center;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers-counter, .fa-layers-text {
|
||
|
|
display: inline-block;
|
||
|
|
position: absolute;
|
||
|
|
text-align: center;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers-text {
|
||
|
|
left: 50%;
|
||
|
|
top: 50%;
|
||
|
|
-webkit-transform: translate(-50%, -50%);
|
||
|
|
transform: translate(-50%, -50%);
|
||
|
|
-webkit-transform-origin: center center;
|
||
|
|
transform-origin: center center;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers-counter {
|
||
|
|
background-color: #ff253a;
|
||
|
|
border-radius: 1em;
|
||
|
|
-webkit-box-sizing: border-box;
|
||
|
|
box-sizing: border-box;
|
||
|
|
color: #fff;
|
||
|
|
height: 1.5em;
|
||
|
|
line-height: 1;
|
||
|
|
max-width: 5em;
|
||
|
|
min-width: 1.5em;
|
||
|
|
overflow: hidden;
|
||
|
|
padding: 0.25em;
|
||
|
|
right: 0;
|
||
|
|
text-overflow: ellipsis;
|
||
|
|
top: 0;
|
||
|
|
-webkit-transform: scale(0.25);
|
||
|
|
transform: scale(0.25);
|
||
|
|
-webkit-transform-origin: top right;
|
||
|
|
transform-origin: top right;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers-bottom-right {
|
||
|
|
bottom: 0;
|
||
|
|
right: 0;
|
||
|
|
top: auto;
|
||
|
|
-webkit-transform: scale(0.25);
|
||
|
|
transform: scale(0.25);
|
||
|
|
-webkit-transform-origin: bottom right;
|
||
|
|
transform-origin: bottom right;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers-bottom-left {
|
||
|
|
bottom: 0;
|
||
|
|
left: 0;
|
||
|
|
right: auto;
|
||
|
|
top: auto;
|
||
|
|
-webkit-transform: scale(0.25);
|
||
|
|
transform: scale(0.25);
|
||
|
|
-webkit-transform-origin: bottom left;
|
||
|
|
transform-origin: bottom left;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers-top-right {
|
||
|
|
right: 0;
|
||
|
|
top: 0;
|
||
|
|
-webkit-transform: scale(0.25);
|
||
|
|
transform: scale(0.25);
|
||
|
|
-webkit-transform-origin: top right;
|
||
|
|
transform-origin: top right;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-layers-top-left {
|
||
|
|
left: 0;
|
||
|
|
right: auto;
|
||
|
|
top: 0;
|
||
|
|
-webkit-transform: scale(0.25);
|
||
|
|
transform: scale(0.25);
|
||
|
|
-webkit-transform-origin: top left;
|
||
|
|
transform-origin: top left;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-lg {
|
||
|
|
font-size: 1.3333333333em;
|
||
|
|
line-height: 0.75em;
|
||
|
|
vertical-align: -0.0667em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-xs {
|
||
|
|
font-size: 0.75em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-sm {
|
||
|
|
font-size: 0.875em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-1x {
|
||
|
|
font-size: 1em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-2x {
|
||
|
|
font-size: 2em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-3x {
|
||
|
|
font-size: 3em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-4x {
|
||
|
|
font-size: 4em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-5x {
|
||
|
|
font-size: 5em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-6x {
|
||
|
|
font-size: 6em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-7x {
|
||
|
|
font-size: 7em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-8x {
|
||
|
|
font-size: 8em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-9x {
|
||
|
|
font-size: 9em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-10x {
|
||
|
|
font-size: 10em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-fw {
|
||
|
|
text-align: center;
|
||
|
|
width: 1.25em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-ul {
|
||
|
|
list-style-type: none;
|
||
|
|
margin-left: 2.5em;
|
||
|
|
padding-left: 0;
|
||
|
|
}
|
||
|
|
.fa-ul > li {
|
||
|
|
position: relative;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-li {
|
||
|
|
left: -2em;
|
||
|
|
position: absolute;
|
||
|
|
text-align: center;
|
||
|
|
width: 2em;
|
||
|
|
line-height: inherit;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-border {
|
||
|
|
border: solid 0.08em #eee;
|
||
|
|
border-radius: 0.1em;
|
||
|
|
padding: 0.2em 0.25em 0.15em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-pull-left {
|
||
|
|
float: left;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-pull-right {
|
||
|
|
float: right;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa.fa-pull-left,
|
||
|
|
.fas.fa-pull-left,
|
||
|
|
.far.fa-pull-left,
|
||
|
|
.fal.fa-pull-left,
|
||
|
|
.fab.fa-pull-left {
|
||
|
|
margin-right: 0.3em;
|
||
|
|
}
|
||
|
|
.fa.fa-pull-right,
|
||
|
|
.fas.fa-pull-right,
|
||
|
|
.far.fa-pull-right,
|
||
|
|
.fal.fa-pull-right,
|
||
|
|
.fab.fa-pull-right {
|
||
|
|
margin-left: 0.3em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-spin {
|
||
|
|
-webkit-animation: fa-spin 2s infinite linear;
|
||
|
|
animation: fa-spin 2s infinite linear;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-pulse {
|
||
|
|
-webkit-animation: fa-spin 1s infinite steps(8);
|
||
|
|
animation: fa-spin 1s infinite steps(8);
|
||
|
|
}
|
||
|
|
|
||
|
|
@-webkit-keyframes fa-spin {
|
||
|
|
0% {
|
||
|
|
-webkit-transform: rotate(0deg);
|
||
|
|
transform: rotate(0deg);
|
||
|
|
}
|
||
|
|
100% {
|
||
|
|
-webkit-transform: rotate(360deg);
|
||
|
|
transform: rotate(360deg);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@keyframes fa-spin {
|
||
|
|
0% {
|
||
|
|
-webkit-transform: rotate(0deg);
|
||
|
|
transform: rotate(0deg);
|
||
|
|
}
|
||
|
|
100% {
|
||
|
|
-webkit-transform: rotate(360deg);
|
||
|
|
transform: rotate(360deg);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
.fa-rotate-90 {
|
||
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
|
||
|
|
-webkit-transform: rotate(90deg);
|
||
|
|
transform: rotate(90deg);
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-rotate-180 {
|
||
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
|
||
|
|
-webkit-transform: rotate(180deg);
|
||
|
|
transform: rotate(180deg);
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-rotate-270 {
|
||
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
|
||
|
|
-webkit-transform: rotate(270deg);
|
||
|
|
transform: rotate(270deg);
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-flip-horizontal {
|
||
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
|
||
|
|
-webkit-transform: scale(-1, 1);
|
||
|
|
transform: scale(-1, 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-flip-vertical {
|
||
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
|
||
|
|
-webkit-transform: scale(1, -1);
|
||
|
|
transform: scale(1, -1);
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-flip-both, .fa-flip-horizontal.fa-flip-vertical {
|
||
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
|
||
|
|
-webkit-transform: scale(-1, -1);
|
||
|
|
transform: scale(-1, -1);
|
||
|
|
}
|
||
|
|
|
||
|
|
:root .fa-rotate-90,
|
||
|
|
:root .fa-rotate-180,
|
||
|
|
:root .fa-rotate-270,
|
||
|
|
:root .fa-flip-horizontal,
|
||
|
|
:root .fa-flip-vertical,
|
||
|
|
:root .fa-flip-both {
|
||
|
|
-webkit-filter: none;
|
||
|
|
filter: none;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-stack {
|
||
|
|
display: inline-block;
|
||
|
|
height: 2em;
|
||
|
|
position: relative;
|
||
|
|
width: 2.5em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-stack-1x,
|
||
|
|
.fa-stack-2x {
|
||
|
|
bottom: 0;
|
||
|
|
left: 0;
|
||
|
|
margin: auto;
|
||
|
|
position: absolute;
|
||
|
|
right: 0;
|
||
|
|
top: 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
.svg-inline--fa.fa-stack-1x {
|
||
|
|
height: 1em;
|
||
|
|
width: 1.25em;
|
||
|
|
}
|
||
|
|
.svg-inline--fa.fa-stack-2x {
|
||
|
|
height: 2em;
|
||
|
|
width: 2.5em;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fa-inverse {
|
||
|
|
color: #fff;
|
||
|
|
}
|
||
|
|
|
||
|
|
.sr-only {
|
||
|
|
border: 0;
|
||
|
|
clip: rect(0, 0, 0, 0);
|
||
|
|
height: 1px;
|
||
|
|
margin: -1px;
|
||
|
|
overflow: hidden;
|
||
|
|
padding: 0;
|
||
|
|
position: absolute;
|
||
|
|
width: 1px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.sr-only-focusable:active, .sr-only-focusable:focus {
|
||
|
|
clip: auto;
|
||
|
|
height: auto;
|
||
|
|
margin: 0;
|
||
|
|
overflow: visible;
|
||
|
|
position: static;
|
||
|
|
width: auto;
|
||
|
|
}
|
||
|
|
|
||
|
|
.svg-inline--fa .fa-primary {
|
||
|
|
fill: var(--fa-primary-color, currentColor);
|
||
|
|
opacity: 1;
|
||
|
|
opacity: var(--fa-primary-opacity, 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
.svg-inline--fa .fa-secondary {
|
||
|
|
fill: var(--fa-secondary-color, currentColor);
|
||
|
|
opacity: 0.4;
|
||
|
|
opacity: var(--fa-secondary-opacity, 0.4);
|
||
|
|
}
|
||
|
|
|
||
|
|
.svg-inline--fa.fa-swap-opacity .fa-primary {
|
||
|
|
opacity: 0.4;
|
||
|
|
opacity: var(--fa-secondary-opacity, 0.4);
|
||
|
|
}
|
||
|
|
|
||
|
|
.svg-inline--fa.fa-swap-opacity .fa-secondary {
|
||
|
|
opacity: 1;
|
||
|
|
opacity: var(--fa-primary-opacity, 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
.svg-inline--fa mask .fa-primary,
|
||
|
|
.svg-inline--fa mask .fa-secondary {
|
||
|
|
fill: black;
|
||
|
|
}
|
||
|
|
|
||
|
|
.fad.fa-inverse {
|
||
|
|
color: #fff;
|
||
|
|
}`;function G4(){var i=r2,n=f2,c=N.familyPrefix,a=N.replacementClass,e=U4;if(c!==i||a!==n){var o=new RegExp("\\.".concat(i,"\\-"),"g"),l=new RegExp("\\--".concat(i,"\\-"),"g"),r=new RegExp("\\.".concat(n),"g");e=e.replace(o,".".concat(c,"-")).replace(l,"--".concat(c,"-")).replace(r,".".concat(a))}return e}var W4=(function(){function i(){r4(this,i),this.definitions={}}return f4(i,[{key:"add",value:function(){for(var c=this,a=arguments.length,e=new Array(a),o=0;o<a;o++)e[o]=arguments[o];var l=e.reduce(this._pullDefinitions,{});Object.keys(l).forEach(function(r){c.definitions[r]=H({},c.definitions[r]||{},l[r]),V2(r,l[r]),L2()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(c,a){var e=a.prefix&&a.iconName&&a.icon?{0:a}:a;return Object.keys(e).map(function(o){var l=e[o],r=l.prefix,f=l.iconName,h=l.icon;c[r]||(c[r]={}),c[r][f]=h}),c}}]),i})();function _4(){N.autoAddCss&&!i2&&(y4(G4()),i2=!0)}function j4(i,n){return Object.defineProperty(i,"abstract",{get:n}),Object.defineProperty(i,"html",{get:function(){return i.abstract.map(function(a){return g2(a)})}}),Object.defineProperty(i,"node",{get:function(){if(b1){var a=b.createElement("div");return a.innerHTML=i.html,a.children}}}),i}function B(i){var n=i.prefix,c=n===void 0?"fa":n,a=i.iconName;if(a)return a2(y1.definitions,c,a)||a2(k.styles,c,a)}function $4(i){return function(n){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=(n||{}).icon?n:B(n||{}),e=c.mask;return e&&(e=(e||{}).icon?e:B(e||{})),i(a,H({},c,{mask:e}))}}var y1=new W4;var i2=!1;var b2=$4(function(i){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=n.transform,a=c===void 0?F:c,e=n.symbol,o=e===void 0?!1:e,l=n.mask,r=l===void 0?null:l,f=n.maskId,h=f===void 0?null:f,v=n.title,m=v===void 0?null:v,s=n.titleId,p=s===void 0?null:s,M=n.classes,d=M===void 0?[]:M,C=n.attributes,V=C===void 0?{}:C,L=n.styles,g=L===void 0?{}:L;if(i){var x=i.prefix,y=i.iconName,w=i.icon;return j4(H({type:"icon"},i),function(){return _4(),N.autoA11y&&(m?V["aria-labelledby"]="".concat(N.replacementClass,"-title-").concat(p||s1()):(V["aria-hidden"]="true",V.focusable="false")),Z4({icons:{main:e2(w),mask:r?e2(r.icon):{found:!1,width:null,height:null,icon:{}}},prefix:x,iconName:y,transform:H({},F,a),symbol:o,title:m,maskId:h,titleId:p,extra:{attributes:V,styles:g,classes:d}})})}});var Y4={prefix:"fab",iconName:"500px",icon:[448,512,[],"f26e","M103.3 344.3c-6.5-14.2-6.9-18.3 7.4-23.1 25.6-8 8 9.2 43.2 49.2h.3v-93.9c1.2-50.2 44-92.2 97.7-92.2 53.9 0 97.7 43.5 97.7 96.8 0 63.4-60.8 113.2-128.5 93.3-10.5-4.2-2.1-31.7 8.5-28.6 53 0 89.4-10.1 89.4-64.4 0-61-77.1-89.6-116.9-44.6-23.5 26.4-17.6 42.1-17.6 157.6 50.7 31 118.3 22 160.4-20.1 24.8-24.8 38.5-58 38.5-93 0-35.2-13.8-68.2-38.8-93.3-24.8-24.8-57.8-38.5-93.3-38.5s-68.8 13.8-93.5 38.5c-.3.3-16 16.5-21.2 23.9l-.5.6c-3.3 4.7-6.3 9.1-20.1 6.1-6.9-1.7-14.3-5.8-14.3-11.8V20c0-5 3.9-10.5 10.5-10.5h241.3c8.3 0 8.3 11.6 8.3 15.1 0 3.9 0 15.1-8.3 15.1H130.3v132.9h.3c104.2-109.8 282.8-36 282.8 108.9 0 178.1-244.8 220.3-310.1 62.8zm63.3-260.8c-.5 4.2 4.6 24.5 14.6 20.6C306 56.6 384 144.5 390.6 144.5c4.8 0 22.8-15.3 14.3-22.8-93.2-89-234.5-57-238.3-38.2zM393 414.7C283 524.6 94 475.5 61 310.5c0-12.2-30.4-7.4-28.9 3.3 24 173.4 246 256.9 381.6 121.3 6.9-7.8-12.6-28.4-20.7-20.4zM213.6 306.6c0 4 4.3 7.3 5.5 8.5 3 3 6.1 4.4 8.5 4.4 3.8 0 2.6.2 22.3-19.5 19.6 19.3 19.1 19.5 22.3 19.5 5.4 0 18.5-10.4 10.7-18.2L265.6 284l18.2-18.2c6.3-6.8-10.1-21.8-16.2-15.7L249.7 268c-18.6-18.8-18.4-19.5-21.5-19.5-5 0-18 11.7-12.4 17.3L234 284c-18.1 17.9-20.4 19.2-20.4 22.6z"]},K4={prefix:"fab",iconName:"accessible-icon",icon:[448,512,[],"f368","M423.9 255.8L411 413.1c-3.3 40.7-63.9 35.1-60.6-4.9l10-122.5-41.1 2.3c10.1 20.7 15.8 43.9 15.8 68.5 0 41.2-16.1 78.7-42.3 106.5l-39.3-39.3c57.9-63.7 13.1-167.2-74-167.2-25.9 0-49.5 9.9-67.2 26L73 243.2c22-20.7 50.1-35.1 81.4-40.2l75.3-85.7-42.6-24.8-51.6 46c-30 26.8-70.6-18.5-40.5-45.4l68-60.7c9.8-8.8 24.1-10.2 35.5-3.6 0 0 139.3 80.9 139.5 81.1 16.2 10.1 20.7 36 6.1 52.6L285.7 229l106.1-5.9c18.5-1.1 33.6 14.4 32.1 32.
|
||
|
|
`).slice(1,-1)){if(v){if(/^title:/.test(s)){r=s.match(/^title:(.*)/)?.[1].trim()??l[0].toUpperCase()+l.slice(1).toLowerCase();continue}if(/^collapse:/.test(s)){f=(s.match(/^collapse:\s?(.*)/)?.[1].trim()??"open")==="open"?"+":"-";continue}/^(title|collapse|color|icon):/.test(s)||(v=!1)}h.push(s)}let m=h.join(`
|
||
|
|
`);/^(`{3,})ad-(\w+)([\s\S]*?)?\n^\1/m.test(m)&&(m=this.replaceCodeBlockInPlace(m)),a=a.replace(o,`> [!${l}]${f}${r.length?" ":""}${r}
|
||
|
|
> ${m.split(`
|
||
|
|
`).join(`
|
||
|
|
> `)}`),this.converted++}return a}buildAdvanced(c){c.empty(),new z.Setting(c).setHeading().setName(t("heading.advanced")),new z.Setting(c).setName(t("markdown-highlight.name")).setDesc(t("markdown-highlight.desc")).addToggle(a=>{a.setValue(this.plugin.data.syntaxHighlight),a.onChange(async e=>{this.plugin.data.syntaxHighlight=e,e?this.plugin.turnOnSyntaxHighlighting():this.plugin.turnOffSyntaxHighlighting(),await this.plugin.saveSettings()})})}buildTypes(){this.additionalEl.empty();for(let c of Object.values(this.plugin.data.userAdmonitions)){let a=new z.Setting(this.additionalEl),e=this.plugin.getAdmonitionElement(c.type,c.type[0].toUpperCase()+c.type.slice(1).toLowerCase(),this.plugin.isIconWithCss(c)?{}:c.icon,this.plugin.shouldInjectColor(c)?c.color:null);a.infoEl.replaceWith(e),c.command?a.addExtraButton(o=>{o.setIcon(e1.toString()).setTooltip(t("btn.unregister")).onClick(async()=>{this.plugin.unregisterCommandsFor(c),await this.plugin.saveSettings(),this.display()})}):a.addExtraButton(o=>{o.setIcon(a1.toString()).setTooltip(t("btn.register")).onClick(async()=>{this.plugin.registerCommandsFor(c),await this.plugin.saveSettings(),this.display()})}),a.addExtraButton(o=>{o.setIcon("pencil").setTooltip(t("btn.edit")).onClick(()=>{let l=new p1(this.plugin,c);l.onClose=async()=>{if(l.saved){let r=c.command,f={type:l.type,color:l.color,icon:l.icon,command:r,title:l.title,iconWithCss:l.iconWithCss,injectColor:l.injectColor,noTitle:l.noTitle,copy:l.copy};if(f.type!==c.type){this.plugin.unregisterType(c);let h=Object.entries(this.plugin.data.userAdmonitions);this.plugin.data.userAdmonitions=Object.fromEntries(h.map(([v,m])=>v===c.type?[f.type,f]:[v,m]))}else this.plugin.data.userAdmonitions[f.type]=f;this.plugin.registerType(f.type),this.plugin.calloutManager.addAdmonition(f),this.display()}},l.open()})}).addExtraButton(o=>{o.setIcon("trash").setTooltip(t("btn.delete")).onClick(()=>{this.plugin.removeAdmonition(c),this.display()})})}}},p1=class i extends z.Modal{constructor(c,a){super(c.app);this.plugin=c;this.color="#7d7d7d";this.icon={};this.saved=!1;this.error=!1;this.iconWithCss=!1;this.injectColor=this.plugin.data.injectColor;this.noTitle=!1;this.editing=!1;a&&(this.editing=!0,this.color=a.color,this.icon=a.icon,this.type=a.type,this.originalType=a.type,this.title=a.title,this.iconWithCss=this.plugin.isIconWithCss(a),this.injectColor=this.plugin.shouldInjectColor(a),this.noTitle=a.noTitle??!1,this.copy=a.copy??this.plugin.data.copyButton)}setAdmonitionElement(c){this.admonitionPreviewParent.empty(),this.admonitionPreview=this.plugin.getAdmonitionElement(this.type,c[0].toUpperCase()+c.slice(1).toLowerCase(),this.iconWithCss?{}:this.icon,this.injectColor?this.color:null),this.admonitionPreview.createDiv("callout-content admonition-content").createEl("p",{text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla."}),this.admonitionPreviewParent.appendChild(this.admonitionPreview)}async display(){this.containerEl.addClass("admonition-settings-modal"),this.titleEl.setText(`${this.editing?"Edit":"Add"} Admonition`);let{contentEl:c}=this;c.empty();let a=c.createDiv(),e=this.title??this.type??"...";this.admonitionPreviewParent=c.createDiv(),this.setAdmonitionElement(e[0].toUpperCase()+e.slice(1).toLowerCase());let o,l=new z.Setting(a).setName(t("admonition-type.name")).addText(s=>{o=s,o.setValue(this.type).onChange(p=>{let M=E.validateType(p,this.plugin,this.originalType);if(M.success===!1){i.setValidationError(s.inputEl,M.message);return}i.removeValidationError(s.inputEl),this.type=p,this.title||this.setAdmonitionElement(this.type?.[0].toUpperCase()+this.type?.slice(1).toLowerCase())})});l.controlEl.addClass("admonition-type-setting"),l.descEl.createSpan({text:"This is used to create the admonition (e.g., "}),l.descEl.createEl("code",{text:"note"}),l.descEl.createSpan({text:" or "}),l.descEl.createEl("code",{text:"abstract"}),l.descEl.createSpan({text:")"}),new z.Setting(a).setName(t("admonition-title.name")).setDesc(t("admonition-title.desc")).addText(s=>{s.setValue(this.title).onChange(p=>{if(!p.l
|
||
|
|
`),e.collapse!=="default"&&(l=`collapse: ${e.collapse}
|
||
|
|
`),c.getDoc().replaceSelection(`\`\`\`ad-${e.type}
|
||
|
|
${o}${l}
|
||
|
|
${c.getDoc().getSelection()}
|
||
|
|
\`\`\`
|
||
|
|
`);let r=c.getCursor();c.setCursor(r.line-3)},e.open()}}),this.addCommand({id:"insert-callout",name:"Insert Callout",editorCallback:(c,a)=>{let e=new K(this);e.onClose=()=>{if(!e.insert)return;let o="",l="";if(e.collapse!=="default")switch(e.collapse){case"open":l="+";break;case"closed":l="-";break;case"none":l="";break}e.title.length&&e.title.toLowerCase()!==e.type.toLowerCase()&&(o=` ${e.title}`);let r=c.getDoc().getSelection();c.getDoc().replaceSelection(`> [!${e.type}]${l}${o}
|
||
|
|
> ${r.split(`
|
||
|
|
`).join(`
|
||
|
|
> `)}
|
||
|
|
`)},e.open()}})})}async downloadIcon(c){this.iconManager.downloadIcon(c)}async removeIcon(c){this.iconManager.removeIcon(c)}async postprocessor(c,a,e,o){if(this.admonitions[c])try{let l=typeof o=="string"?o:o?.sourcePath??this.app.workspace.getActiveFile()?.path??"",{title:r,collapse:f,content:h,icon:v,color:m,metadata:s}=W1(c,a,this.admonitions[c]);this.data.autoCollapse&&!f?f=this.data.defaultCollapseType??"open":f&&f.trim()==="none"&&(f="");let p=this.admonitions[c],M=v?this.iconManager.iconDefinitions.find(({name:L})=>v===L):null,d=this.getAdmonitionElement(c,r,M??(this.isIconWithCss(p)?{}:p.icon),m??(this.shouldInjectColor(p)?p.color:null),f,l,s);this.renderAdmonitionContent(d,c,h,o,l,a),f&&f!=="none"&&this.calloutManager.setCollapsible(d);let C=e.parentElement;C&&C.addClass("admonition-parent",`admonition-${c}-parent`),e.replaceWith(d);let V=app.workspace.getActiveViewOfType(u.MarkdownView);if(V?.editor?.cm?.state?.field(u.editorLivePreviewField)){let L=V.editor.cm;d.onClickEvent(g=>{if(g.defaultPrevented||g.detail>1||g.shiftKey)return;let y=g.target.closest("input, button, select, textarea, a[href], label, [contenteditable='true'], [tabindex]:not([tabindex='-1'])");if(!(y&&y!==d&&d.contains(y)))try{setTimeout(()=>{try{let w=L.posAtDOM(d);L.focus(),L.dispatch({selection:{head:w,anchor:w}})}catch{}},10)}catch{}})}return d}catch(l){console.error(l);let r=createEl("pre");r.createEl("code",{attr:{style:"color: var(--text-error) !important"}}).createSpan({text:`There was an error rendering the admonition:
|
||
|
|
|
||
|
|
`+a}),e.replaceWith(r)}}getAdmonitionElement(c,a,e,o,l,r,f){let h=createDiv({cls:`callout admonition admonition-${c} admonition-plugin ${a?.trim().length?"":"no-title"}`,attr:{style:o?`--callout-color: ${o};`:"","data-callout":c,"data-callout-fold":"","data-callout-metadata":f??""}}),v=h.createDiv({cls:`callout-title admonition-title ${a?.trim().length?"":"no-title"}`});if(a?.trim().length){let m=v.createDiv("callout-icon admonition-title-icon");e?.name&&e.type&&m.appendChild(this.iconManager.getIconNode(e)??createDiv());let s=v.createDiv("callout-title-inner admonition-title-content");u.MarkdownRenderer.render(this.app,a,s,r??"",this),s.firstElementChild&&s.firstElementChild instanceof HTMLParagraphElement&&s.setChildrenInPlace(Array.from(s.firstElementChild.childNodes))}return l&&(h.addClass("is-collapsible"),l==="closed"&&h.addClass("is-collapsed")),this.data.dropShadow||h.addClass("no-drop"),h}renderAdmonitionContent(c,a,e,o,l,r){let f=new u.MarkdownRenderChild(c);if(f.containerEl=c,o&&typeof o!="string"&&o.addChild(f),e?.trim().length){let h=this.getAdmonitionContentElement(a,c,e);if(/^`{3,}mermaid/m.test(e)){let m=!c.hasAttribute("open");c instanceof HTMLDetailsElement&&c.setAttribute("open","open"),setImmediate(()=>{u.MarkdownRenderer.renderMarkdown(e,h,l,f),c instanceof HTMLDetailsElement&&m&&c.removeAttribute("open")})}else u.MarkdownRenderer.renderMarkdown(e,h,l,f);(!e.length||h.textContent.trim()==="")&&this.data.hideEmpty&&c.addClass("no-content");let v=h.querySelectorAll(".task-list-item-checkbox");if(v?.length){let m=r.split(`
|
||
|
|
`),s=0;v.forEach(p=>{let M=m.slice(s).findIndex(d=>/^[ \t>]*- \[.\]/.test(d));M!==-1&&(p.dataset.line=`${M+s+1}`,s=M+s+1)})}}}getAdmonitionContentElement(c,a,e){let o=a.createDiv("callout-content admonition-content");if(this.admonitions[c].copy??this.data.copyButton){let l=o.createDiv("admonition-content-copy");(0,u.setIcon)(l,"copy"),l.addEventListener("click",()=>{navigator.clipboard.writeText(e.trim()).then(async()=>{new u.Notice("Admonition content copied to clipboard.")})})}return o}registerType(c){this.data.syntaxHighlight&&this.turnOnSyntaxHighlighting([c]),this.postprocessors.has(c)&&u.MarkdownPreviewRenderer.unregisterCodeBlockPostProcessor(`ad-${c}`),this.postprocessors.set(c,this.registerMarkdownCodeBlockProcessor(`ad-${c}`,(e,o,l)=>this.postprocessor(c,e,o,l)));let a=this.admonitions[c];a.command&&this.registerCommandsFor(a)}get admonitions(){return{...U1,...this.data.userAdmonitions}}async addAdmonition(c){c.type=c.type.toLowerCase(),this.data.userAdmonitions={...this.data.userAdmonitions,[c.type]:c},this.registerType(c.type),this.calloutManager.addAdmonition(c),await this.saveSettings()}registerCommandsFor(c){c.command=!0,this.addCommand({id:`insert-${c.type}-callout`,name:`Insert ${c.type} Callout`,editorCheckCallback:(a,e,o)=>{if(a)return c.command;if(c.command)try{let l=e.getDoc().getSelection();e.getDoc().replaceSelection(`> [!${c.type}]
|
||
|
|
> ${l.split(`
|
||
|
|
`).join(`
|
||
|
|
> `)}
|
||
|
|
`);let r=e.getCursor();e.setCursor(r.line-2)}catch{new u.Notice("There was an issue inserting the admonition.")}}}),this.addCommand({id:`insert-${c.type}`,name:`Insert ${c.type}`,editorCheckCallback:(a,e,o)=>{if(a)return c.command;if(c.command)try{e.getDoc().replaceSelection(`\`\`\`ad-${c.type}
|
||
|
|
|
||
|
|
${e.getDoc().getSelection()}
|
||
|
|
|
||
|
|
\`\`\`
|
||
|
|
`);let l=e.getCursor();e.setCursor(l.line-2)}catch{new u.Notice("There was an issue inserting the admonition.")}}}),this.addCommand({id:`insert-${c.type}-with-title`,name:`Insert ${c.type} With Title`,editorCheckCallback:(a,e,o)=>{if(a)return c.command;if(c.command)try{let l=c.title??"";e.getDoc().replaceSelection(`\`\`\`ad-${c.type}
|
||
|
|
title: ${l}
|
||
|
|
|
||
|
|
${e.getDoc().getSelection()}
|
||
|
|
|
||
|
|
\`\`\`
|
||
|
|
`);let r=e.getCursor();e.setCursor(r.line-3)}catch{new u.Notice("There was an issue inserting the admonition.")}}})}unregisterType(c){this.data.syntaxHighlight&&this.turnOffSyntaxHighlighting([c.type]),c.command&&this.unregisterCommandsFor(c),this.postprocessors.has(c.type)&&(u.MarkdownPreviewRenderer.unregisterPostProcessor(this.postprocessors.get(c.type)),u.MarkdownPreviewRenderer.unregisterCodeBlockPostProcessor(`ad-${c.type}`),this.postprocessors.delete(c.type))}async removeAdmonition(c){this.data.userAdmonitions[c.type]&&delete this.data.userAdmonitions[c.type],this.unregisterType(c),this.calloutManager.removeAdmonition(c),await this.saveSettings()}unregisterCommandsFor(c){c.command=!1,this.app.commands.findCommand(`obsidian-admonition:insert-${c.type}`)&&(delete this.app.commands.editorCommands[`obsidian-admonition:insert-${c.type}`],delete this.app.commands.editorCommands[`obsidian-admonition:insert-${c.type}-with-title`],delete this.app.commands.commands[`obsidian-admonition:insert-${c.type}`],delete this.app.commands.commands[`obsidian-admonition:insert-${c.type}-with-title`])}async saveSettings(){this.data.version=this.manifest.version,await this.saveData(this.data)}async loadSettings(){let c=await this.loadData();if(this.data=Object.assign({},jL,c),this.data.userAdmonitions){if(!this.data.version||Number(this.data.version.split(".")[0])<5)for(let a in this.data.userAdmonitions)Object.hasOwn(this.data.userAdmonitions[a],"type")||(this.data.userAdmonitions[a]={...this.data.userAdmonitions[a],icon:{type:"font-awesome",name:this.data.userAdmonitions[a].icon}});(!this.data.version||Number(this.data.version.split(".")[0])<8)&&new u.Notice(createFragment(a=>{a.createSpan({text:"Admonitions: Obsidian now has native support for callouts! Check out the "}),a.createEl("a",{text:"Admonitions ReadMe",href:"obsidian://show-plugin?id=obsidian-admonition"}),a.createSpan({text:" for what that means for Admonitions going forward."})}),0);for(let a of Object.keys(this.data.userAdmonitions)){let e=this.data.userAdmonitions[a];e.styleWithCss===!0&&(e.iconWithCss=!0,e.injectColor=!1,delete e.styleWithCss)}}if(!this.data.rpgDownloadedOnce&&this.data.userAdmonitions&&Object.values(this.data.userAdmonitions).some(a=>a.icon.type==="rpg")&&!this.data.icons.includes("rpg"))try{await this.downloadIcon("rpg"),this.data.rpgDownloadedOnce=!0}catch{}if(this.data.userAdmonitions)for(let a of Object.keys(this.data.userAdmonitions)){let e=a.toLowerCase();e!==a&&(this.data.userAdmonitions[e]={...this.data.userAdmonitions[a],type:e},delete this.data.userAdmonitions[a])}await this.saveSettings()}turnOnSyntaxHighlighting(c=Object.keys(this.admonitions)){this.data.syntaxHighlight&&(c.forEach(a=>{if(this.data.syntaxHighlight){let[,e]=`${a}`.match(/^([\w+#-]*)[^\n`]*$/);window.CodeMirror.defineMode(`ad-${e}`,(o,l)=>window.CodeMirror.getMode({},"hypermd"))}}),this.app.workspace.onLayoutReady(()=>this.app.workspace.iterateCodeMirrors(a=>a.setOption("mode",a.getOption("mode")))))}turnOffSyntaxHighlighting(c=Object.keys(this.admonitions)){c.forEach(a=>{Object.hasOwn(window.CodeMirror.modes,`ad-${a}`)&&delete window.CodeMirror.modes[`ad-${a}`]}),this.app.workspace.onLayoutReady(()=>this.app.workspace.iterateCodeMirrors(a=>a.setOption("mode",a.getOption("mode"))))}async onunload(){console.log("Obsidian Admonition unloaded"),this.postprocessors=null,this.turnOffSyntaxHighlighting()}};
|
||
|
|
/*! Bundled license information:
|
||
|
|
|
||
|
|
@fortawesome/fontawesome-svg-core/index.es.js:
|
||
|
|
@fortawesome/free-brands-svg-icons/index.es.js:
|
||
|
|
@fortawesome/free-regular-svg-icons/index.es.js:
|
||
|
|
@fortawesome/free-solid-svg-icons/index.es.js:
|
||
|
|
(*!
|
||
|
|
* Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
|
||
|
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||
|
|
*)
|
||
|
|
*/
|
||
|
|
|
||
|
|
/* nosourcemap */
|