You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

789 lines
1.3 MiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
3 years ago
var a6=Object.create;var q1=Object.defineProperty;var e6=Object.getOwnPropertyDescriptor;var i6=Object.getOwnPropertyNames;var n6=Object.getPrototypeOf,o6=Object.prototype.hasOwnProperty;var z4=a=>q1(a,"__esModule",{value:!0});var t6=(a,c)=>{z4(a);for(var e in c)q1(a,e,{get:c[e],enumerable:!0})},r6=(a,c,e)=>{if(c&&typeof c=="object"||typeof c=="function")for(let i of i6(c))!o6.call(a,i)&&i!=="default"&&q1(a,i,{get:()=>c[i],enumerable:!(e=e6(c,i))||e.enumerable});return a},j=a=>r6(z4(q1(a!=null?a6(n6(a)):{},"default",a&&a.__esModule&&"default"in a?{get:()=>a.default,enumerable:!0}:{value:a,enumerable:!0})),a);t6(exports,{default:()=>t4});var L=j(require("obsidian")),_3=j(require("@codemirror/language")),_=j(require("@codemirror/view")),K3=j(require("@codemirror/stream-parser")),d2=j(require("@codemirror/state"));var p4=j(require("obsidian")),p1=j(require("obsidian"));function l6(a,c){for(let e=0;e<c.length;e++)if(a.startsWith(c[e]))return e;return!1}function d4(a,c,e){let i=e.title??a[0].toUpperCase()+a.slice(1).toLowerCase(),n=["title:","collapse:","icon:","color:"],o=["title","collapse","icon","color"],r=c.split(`
3 years ago
`),t=0,l={};for(let v=0;v<r.length;v++){let u=l6(r[v],n);if(u===!1)break;let p=o[u];if(l[p]!==void 0)break;l[p]=r[v].slice(n[u].length).trim(),++t}let{title:f,collapse:s,icon:m,color:h}=l,z=r.slice(t).join(`
`);return s!==void 0&&s!=="none"&&s!=="open"&&s!=="closed"&&(s="closed"),"title"in l||e.noTitle||(f=i),f&&f.trim()===""&&s!==void 0&&s!=="none"&&(f=i,new p4.Notice("An admonition must have a title if it is collapsible.")),{title:f,collapse:s,content:z,icon:m,color:h}}var u4=(a,c,e)=>{for(let i of a){let{from:n,to:o}=i;if(n>=c&&n<=e||o>=c&&o<=e||n<c&&o>e)return!0}return!1},H2=a=>{if(p1.requireApiVersion&&(0,p1.requireApiVersion)("0.13.23"))return a.field(p1.editorLivePreviewField);{let c=a.field(p1.editorViewField),{state:e}=c.leaf.getViewState()??{};return e&&e.mode=="source"&&e.source==!1}};var C4='<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>',Y1="admonition-add-command",M4='<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>',_1="admonition-remove-command",g4='<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg>',x2="admonition-copy-content",H4='<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-4
3 years ago
`),(this.plugin.data.autoCollapse&&this.collapse!=this.plugin.data.defaultCollapseType||!this.plugin.data.autoCollapse&&this.collapse!="none")&&(f=`collapse: ${this.collapse}
`),this.editor.getDoc().replaceSelection(`\`\`\`ad-${this.type}
${l}${f}
${this.editor.getDoc().getSelection()}
\`\`\`
`);let s=this.editor.getCursor();this.editor.setCursor(s.line-3)}catch{new Z.Notice("There was an issue inserting the admonition.")}this.close()})).addExtraButton(t=>{t.setIcon("cross").setTooltip("Cancel").onClick(()=>this.close()),t.extraSettingsEl.setAttr("tabindex",0),t.extraSettingsEl.onkeydown=l=>{l.key=="Enter"&&this.close()}})}buildAdmonition(){if(this.admonitionEl.empty(),this.type&&this.plugin.admonitions[this.type]){let c=this.plugin.admonitions[this.type];this.element=this.plugin.getAdmonitionElement(this.type,this.title,c.icon,c.injectColor??this.plugin.data.injectColor?c.color:null,this.collapse),this.element.createDiv({cls:"admonition-content",text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla."}),this.admonitionEl.appendChild(this.element)}}};var O4=`(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(self, function() {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
function createEl(tag, t, e) {
const i = document.createElement(tag);
"string" == typeof t &&
(t = {
cls: t
});
const r = t || {}, o = r.cls, s = r.text, a = r.attr, l = r.title, c = r.value, u = r.type, h = e ? e : r.parent, p = r.prepend, d = r.href;
return (o &&
(Array.isArray(o)
? (i.className = o.join(" "))
: (i.className = o)),
s && (i.textContent = s),
a &&
Object.keys(a).forEach((t) => {
const n = a[t];
null !== n && i.setAttribute(t, String(n));
}),
l && (i.title = l),
c &&
(i instanceof HTMLInputElement ||
i instanceof HTMLSelectElement ||
i instanceof HTMLOptionElement) &&
(i.value = c),
/* u && i instanceof HTMLInputElement && (i.type = u), */
u && i instanceof HTMLStyleElement && i.setAttribute("type", u),
d &&
(i instanceof HTMLAnchorElement || i instanceof HTMLLinkElement) &&
(i.href = d),
h && (p ? h.insertBefore(i, h.firstChild) : h.appendChild(i)),
i);
}
//@ts-ignore-line
const createDiv = function (o, e) {
return createEl("div", o, e);
};
Node.prototype.createDiv = function (o, cb) {
return createDiv(o, this);
};
Node.prototype.createEl = function (tag, o, cb) {
return createEl(tag, o, this);
};
Element.prototype.addClass = function (...args) {
const e = [];
for (let t = 0; t < args.length; t++)
e[t] = args[t];
this.addClasses(e);
};
Element.prototype.addClasses = function (e) {
for (let t = 0; t < e.length; t++)
this.classList.add(e[t]);
};
function getAdmonitionElement(type, title, icon, color, collapse, id) {
var _a;
let admonition, titleEl, attrs = {
style: \`--admonition-color: \${color};\`
};
if (collapse && collapse != "none") {
if (collapse === "open") {
attrs.open = "open";
}
admonition = createEl("details", {
cls: \`admonition admonition-\${type} admonition-plugin\`,
attr: attrs
});
titleEl = admonition.createEl("summary", {
cls: \`admonition-title \${!(title === null || title === void 0 ? void 0 : title.trim().length) ? "no-title" : ""}\`
});
}
else {
admonition = createDiv({
cls: \`admonition admonition-\${type} admonition-plugin\`,
attr: attrs
});
titleEl = admonition.createDiv({
cls: \`admonition-title \${!(title === null || title === void 0 ? void 0 : title.trim().length) ? "no-title" : ""}\`
});
}
if (id) {
admonition.id = id;
}
if (title && title.trim().length) {
/**
* Title structure
* <div|summary>.admonition-title
* <element>.admonition-title-content - Rendered Markdown top-level element (e.g. H1/2/3 etc, p)
* div.admonition-title-icon
* svg
* div.admonition-title-markdown - Container of rendered markdown
* ...rendered markdown children...
*/
//get markdown
const markdownHolder = createDiv();
//MarkdownRenderer.renderMarkdown(title, markdownHolder, "", null);
//admonition-title-content is first child of rendered markdown
const admonitionTitleContent =
/* markdownHolder?.children[0]?.tagName === "P"
? createDiv()
: markdownHolder.children[0] ?? */ createDiv();
//get children of markdown element, then remove them
const markdownElements = Array.from(((_a = markdownHolder.children[0]) === null || _a === void 0 ? void 0 : _a.childNodes) || []);
admonitionTitleContent.innerHTML = "";
admonitionTitleContent.addClass("admonition-title-content");
//build icon element
const iconEl = admonitionTitleContent.createDiv("admonition-title-icon");
if (icon) {
iconEl.innerHTML = icon;
}
//add markdown children back
const admonitionTitleMarkdown = admonitionTitleContent.createDiv("admonition-title-markdown");
admonitionTitleMarkdown.innerText = title;
/* for (let i = 0; i < markdownElements.length; i++) {
admonitionTitleMarkdown.appendChild(markdownElements[i]);
} */
titleEl.appendChild(admonitionTitleContent || createDiv());
}
//add them to title element
if (collapse) {
titleEl.createDiv("collapser").createDiv("handle");
}
return admonition;
}
function startsWithAny(str, needles) {
for (let i = 0; i < needles.length; i++) {
if (str.startsWith(needles[i])) {
return i;
}
}
return false;
}
function getParametersFromSource(type, src) {
const keywordTokens = ["title:", "collapse:", "icon:", "color:"];
const keywords = ["title", "collapse", "icon", "color"];
let lines = src.split("\\n");
let skipLines = 0;
let params = {};
for (let i = 0; i < lines.length; i++) {
let keywordIndex = startsWithAny(lines[i], keywordTokens);
if (keywordIndex === false) {
break;
}
let foundKeyword = keywords[keywordIndex];
if (params[foundKeyword] !== undefined) {
break;
}
params[foundKeyword] = lines[i]
.substr(keywordTokens[keywordIndex].length)
.trim();
++skipLines;
}
let { title = type[0].toUpperCase() + type.slice(1).toLowerCase(), collapse, icon, color } = params;
let content = lines.slice(skipLines).join("\\n");
/**
* If the admonition should collapse, but something other than open or closed was provided, set to closed.
*/
if (collapse !== undefined &&
collapse !== "none" &&
collapse !== "open" &&
collapse !== "closed") {
collapse = "closed";
}
/**
* If the admonition should collapse, but title was blanked, set the default title.
*/
if (title.trim() === "" && collapse !== undefined && collapse !== "none") {
title = type[0].toUpperCase() + type.slice(1).toLowerCase();
return;
}
return { title, collapse, content, icon, color };
}
const blockSet = new Set();
const ADMONITION_ICON_MAP = {};
if (document.readyState === "complete") {
postprocess();
registerToProcess();
}
else {
window.onload = () => {
postprocess();
registerToProcess();
};
}
function registerToProcess() {
const sizer = document.querySelector(".markdown-preview-sizer");
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type == "childList" && mutation.addedNodes.length) {
mutation.addedNodes.forEach((node) => {
var _a;
if (node &&
node instanceof Element &&
node.children.length &&
((_a = node.firstElementChild) === null || _a === void 0 ? void 0 : _a.tagName) === "PRE") {
//postprocess(node);
preObserver.observe(node.firstChild, {
attributes: true,
childList: false,
characterData: false,
subtree: false
});
}
});
}
});
});
observer.observe(sizer, {
attributes: false,
childList: true,
subtree: false
});
const preObserver = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.target instanceof HTMLPreElement &&
!blockSet.has(mutation.target) &&
mutation.type === "attributes" &&
mutation.attributeName === "class" &&
Array.from(mutation.target.classList).some((cls) => /language-ad-(\\w+)/.test(cls))) {
blockSet.add(mutation.target);
processAdmonitionBlock(mutation.target);
}
});
});
}
function processAdmonitionBlock(admonitionBlock) {
const [, type] = admonitionBlock.classList
.toString()
.match(/language-ad-(\\w+)/);
if (!type)
return;
if (!(type in ADMONITION_ICON_MAP))
return;
let { title = type[0].toUpperCase() + type.slice(1).toLowerCase(), collapse, content, icon = ADMONITION_ICON_MAP[type].icon, color = ADMONITION_ICON_MAP[type].color } = getParametersFromSource(type, admonitionBlock.innerText);
let admonition = getAdmonitionElement(type, title, icon, color, collapse);
const contentHolder = admonition.createDiv("admonition-content-holder");
const admonitionContent = contentHolder.createDiv("admonition-content");
admonitionContent.innerText = content;
admonitionBlock.replaceWith(admonition);
}
function postprocess() {
//do work
const admonitions = document.querySelectorAll("pre[class*='language-ad']");
if (!admonitions.length)
return;
for (let admonitionBlock of Array.from(admonitions)) {
blockSet.add(admonitionBlock);
const [, type] = admonitionBlock.classList
.toString()
.match(/language-ad-(\\w+)/);
if (!type)
continue;
if (!(type in ADMONITION_ICON_MAP))
continue;
let { title = type[0].toUpperCase() + type.slice(1).toLowerCase(), collapse, content, icon = ADMONITION_ICON_MAP[type].icon, color = ADMONITION_ICON_MAP[type].color } = getParametersFromSource(type, admonitionBlock.innerText);
let admonition = getAdmonitionElement(type, title, icon, color, collapse);
const contentHolder = admonition.createDiv("admonition-content-holder");
const admonitionContent = contentHolder.createDiv("admonition-content");
admonitionContent.innerText = content;
admonitionBlock.replaceWith(admonition);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGlzaC5hZG1vbml0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsicHVibGlzaC5hZG1vbml0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sb0JBQW9CLENBQUM7QUFFNUIsU0FBUyxRQUFRLENBQ2IsR0FBTSxFQUNOLENBQTJCLEVBQzNCLENBQWU7SUFFZixNQUFNLENBQUMsR0FBRyxRQUFRLENBQUMsYUFBYSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQ3RDLFFBQVEsSUFBSSxPQUFPLENBQUM7UUFDaEIsQ0FBQyxDQUFDLEdBQUc7WUFDRCxHQUFHLEVBQUUsQ0FBQztTQUNULENBQUMsQ0FBQztJQUNQLE1BQU0sQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLEVBQ2IsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLEVBQ1QsQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLEVBQ1YsQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLEVBQ1YsQ0FBQyxHQUFHLENBQUMsQ0FBQyxLQUFLLEVBQ1gsQ0FBQyxHQUFHLENBQUMsQ0FBQyxLQUFLLEVBQ1gsQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLEVBQ1YsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxFQUNwQixDQUFDLEdBQUcsQ0FBQyxDQUFDLE9BQU8sRUFDYixDQUFDLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FBQztJQUNmLE9BQU8sQ0FDSCxDQUFDO1FBQ0csQ0FBQyxLQUFLLENBQU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idian"));var W4={};var X4={};var j4={};var J4={};var T2={"Admonition Settings":"Admonition Settings","Use Obsidian's markdown syntax highlighter in admonition code blocks. This setting is experimental and could cause errors.":"Use Obsidian's markdown syntax highlighter in admonition code blocks. This setting is experimental and could cause errors.","Markdown Syntax Highlighting":"Markdown Syntax Highlighting","Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk.":"Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk."," Sync Links to Metadata Cache":" Sync Links to Metadata Cache","Allows admonitions to be created using ":"Allows admonitions to be created using "," or ":" or ",", instead of using a code block.":", instead of using a code block."," Enable Non-codeblock Admonitions":" Enable Non-codeblock Admonitions","Collapsible by Default":"Collapsible by Default","All admonitions will be collapsible by default. Use ":"All admonitions will be collapsible by default. Use "," to prevent.":" to prevent.","Default Collapse Type":"Default Collapse Type","Collapsible admonitions will be either opened or closed.":"Collapsible admonitions will be either opened or closed.","Add Copy Button":"Add Copy Button","Add a 'copy content' button to admonitions.":"Add a 'copy content' button to admonitions.","Add New":"Add New","Add a new Admonition type.":"Add a new Admonition type.","Add Additional":"Add Additional","Register Commands":"Register Commands","Unregister Commands":"Unregister Commands",Edit:"Edit",Delete:"Delete","Admonition Type":"Admonition Type","Admonition Title":"Admonition Title","This will be the default title for this admonition type.":"This will be the default title for this admonition type.","Admonition type cannot be empty.":"Admonition type cannot be empty.","Admonition type cannot include spaces.":"Admonition type cannot include spaces.","Types must be a valid CSS selector.":"Types must be a valid CSS selector.","Invalid icon name.":"Invalid icon name.","Icon cannot be empty.":"Icon cannot be empty.","Upload Image":"Upload Image","There was an error parsing the image.":"There was an error parsing the image.","Admonition Icon":"Admonition Icon",Color:"Color",Save:"Save","No Admonition Title by Default":"No Admonition Title by Default","The admonition will have no title unless ":"The admonition will have no title unless "," is explicitly provided.":" is explicitly provided.","Show Copy Button":"Show Copy Button","A copy button will be added to the admonition.":"A copy button will be added to the admonition.","Parse Titles as Markdown":"Parse Titles as Markdown","Admonition Titles will be rendered as markdown.":"Admonition Titles will be rendered as markdown."};var q4={};var Y4={};var _4={};var K4={};var $4={};var c3={};var a3={};var e3={};var i3={};var n3={};var o3={};var t3={};var r3={};var l3={};var s3={};var f3={};var m3={"Admonition Settings":"Admonition \u8BBE\u7F6E","Use Obsidian's markdown syntax highlighter in admonition code blocks. This setting is experimental and could cause errors.":"\u5728 admonition \u4EE3\u7801\u5757\u4E2D\u4F7F\u7528 Obsidian \u7684 markdown \u7CFB\u7EDF\u7EA7\u9AD8\u4EAE\u3002\u8BE5\u8BBE\u7F6E\u4E3A\u5B9E\u9A8C\u6027\uFF0C\u53EF\u80FD\u4F1A\u5F15\u53D1\u9519\u8BEF"," Markdown Syntax Highlighting":" Markdown \u7CFB\u7EDF\u9AD8\u4EAE","Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk.":"Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk."," Sync Links to Metadata Cache":" Sync Links to Metadata Cache","Allows admonitions to be created using ":"\u5141\u8BB8 admonitions \u521B\u5EFA\u4F7F\u7528"," or ":"\u6216",", instead of using a code block.":"\uFF0C\u800C\u975E\u4EE3\u7801\u5757"," En
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;
}
3 years ago
.fa-10x {
font-size: 10em;
}
3 years ago
.fa-fw {
text-align: center;
width: 1.25em;
}
3 years ago
.fa-ul {
list-style-type: none;
margin-left: 2.5em;
padding-left: 0;
}
.fa-ul > li {
position: relative;
}
3 years ago
.fa-li {
left: -2em;
position: absolute;
3 years ago
text-align: center;
width: 2em;
line-height: inherit;
}
3 years ago
.fa-border {
border: solid 0.08em #eee;
border-radius: 0.1em;
padding: 0.2em 0.25em 0.15em;
}
3 years ago
.fa-pull-left {
float: left;
}
3 years ago
.fa-pull-right {
float: right;
}
3 years ago
.fa.fa-pull-left,
.fas.fa-pull-left,
.far.fa-pull-left,
.fal.fa-pull-left,
.fab.fa-pull-left {
margin-right: 0.3em;
}
3 years ago
.fa.fa-pull-right,
.fas.fa-pull-right,
.far.fa-pull-right,
.fal.fa-pull-right,
.fab.fa-pull-right {
margin-left: 0.3em;
}
3 years ago
.fa-spin {
-webkit-animation: fa-spin 2s infinite linear;
animation: fa-spin 2s infinite linear;
}
3 years ago
.fa-pulse {
-webkit-animation: fa-spin 1s infinite steps(8);
animation: fa-spin 1s infinite steps(8);
}
3 years ago
@-webkit-keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
3 years ago
@keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
3 years ago
.fa-rotate-90 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
3 years ago
.fa-rotate-180 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
}
3 years ago
.fa-rotate-270 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform: rotate(270deg);
transform: rotate(270deg);
}
3 years ago
.fa-flip-horizontal {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform: scale(-1, 1);
transform: scale(-1, 1);
}
3 years ago
.fa-flip-vertical {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
-webkit-transform: scale(1, -1);
transform: scale(1, -1);
}
3 years ago
.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);
}
3 years ago
: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;
}
3 years ago
3 years ago
.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;
3 years ago
}`;function Hb(){var a=b3,c=N3,e=X.familyPrefix,i=X.replacementClass,n=gb;if(e!==a||i!==c){var o=new RegExp("\\.".concat(a,"\\-"),"g"),r=new RegExp("\\--".concat(a,"\\-"),"g"),t=new RegExp("\\.".concat(c),"g");n=n.replace(o,".".concat(e,"-")).replace(r,"--".concat(e,"-")).replace(t,".".concat(i))}return n}var xb=function(){function a(){DL(this,a),this.definitions={}}return RL(a,[{key:"add",value:function(){for(var e=this,i=arguments.length,n=new Array(i),o=0;o<i;o++)n[o]=arguments[o];var r=n.reduce(this._pullDefinitions,{});Object.keys(r).forEach(function(t){e.definitions[t]=b({},e.definitions[t]||{},r[t]),G3(t,r[t]),O3()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(e,i){var n=i.prefix&&i.iconName&&i.icon?{0:i}:i;return Object.keys(n).map(function(o){var r=n[o],t=r.prefix,l=r.iconName,f=r.icon;e[t]||(e[t]={}),e[t][l]=f}),e}}]),a}();function Vb(){X.autoAddCss&&!q3&&(tb(Hb()),q3=!0)}function Lb(a,c){return Object.defineProperty(a,"abstract",{get:c}),Object.defineProperty(a,"html",{get:function(){return a.abstract.map(function(i){return X3(i)})}}),Object.defineProperty(a,"node",{get:function(){if(!!j2){var i=O.createElement("div");return i.innerHTML=a.html,i.children}}}),a}function L1(a){var c=a.prefix,e=c===void 0?"fa":c,i=a.iconName;if(!!i)return W3(i4.definitions,e,i)||W3(e1.styles,e,i)}function bb(a){return function(c){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=(c||{}).icon?c:L1(c||{}),n=e.mask;return n&&(n=(n||{}).icon?n:L1(n||{})),a(i,b({},e,{mask:n}))}}var i4=new xb;var q3=!1;var Y3=bb(function(a){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=c.transform,i=e===void 0?U1:e,n=c.symbol,o=n===void 0?!1:n,r=c.mask,t=r===void 0?null:r,l=c.maskId,f=l===void 0?null:l,s=c.title,m=s===void 0?null:s,h=c.titleId,z=h===void 0?null:h,v=c.classes,u=v===void 0?[]:v,p=c.attributes,H=p===void 0?{}:p,M=c.styles,x=M===void 0?{}:M;if(!!a){var d=a.prefix,A=a.iconName,V=a.icon;return Lb(b({type:"icon"},a),function(){return Vb(),X.autoA11y&&(m?H["aria-labelledby"]="".concat(X.replacementClass,"-title-").concat(z||z2()):(H["aria-hidden"]="true",H.focusable="false")),zb({icons:{main:J3(V),mask:t?J3(t.icon):{found:!1,width:null,height:null,icon:{}}},prefix:d,iconName:A,transform:b({},U1,i),symbol:o,title:m,maskId:f,titleId:z,extra:{attributes:H,styles:x,classes:u}})})}});var n4=j(require("obsidian"));i4.add(O2,P2,W2,G2);var o4=class{constructor(c){this.plugin=c;this.DOWNLOADED={};this.FONT_AWESOME_MAP=new Map([Object.values(O2),Object.values(P2),Object.values(W2)].flat().map(c=>[c.iconName,{name:c.iconName,type:"font-awesome"}]));this.iconDefinitions=[]}async load(){for(let c of this.plugin.data.icons)await this.plugin.app.vault.adapter.exists(this.localIconPath(c))?this.DOWNLOADED[c]=JSON.parse(await this.plugin.app.vault.adapter.read(`${this.plugin.app.plugins.getPluginFolder()}/obsidian-admonition/${c}.json`)):await this.downloadIcon(c);this.setIconDefinitions()}setIconDefinitions(){let c=[];for(let e of this.plugin.data.icons){if(!(e in this.DOWNLOADED))continue;let i=this.DOWNLOADED[e];c.push(...Object.keys(i).map(n=>({type:e,name:n})))}this.iconDefinitions=[...this.plugin.data.useFontAwesome?this.FONT_AWESOME_MAP.values():[],...c]}iconPath(c){return`https://raw.githubusercontent.com/valentine195/obsidian-admonition/master/icons/${c}/icons.json`}localIconPath(c){return`${this.plugin.app.plugins.getPluginFolder()}/obsidian-admonition/${c}.json`}async downloadIcon(c){try{let e=await(await fetch(this.iconPath(c))).json();this.plugin.data.icons.push(c),this.plugin.data.icons=[...new Set(this.plugin.data.icons)],await this.plugin.app.vault.adapter.write(this.localIconPath(c),JSON.stringify(e)),this.DOWNLOADED[c]=e,await this.plugin.saveSettings(),this.setIconDefinitions(),new n4.Notice(`${x1[c]} successfully downloaded.`)}catch(e){console.error(e),new n4.Notice("Could not download icon pack")}}async removeIcon(c){await this.plugin.app.vault.adapter.remove(this.localIconPath(c)),delete this.DOWNLOADED[c],this.plugin.data.icons.remove(c),this.plugin.dat
3 years ago
`+e}),i.replaceWith(r)}}getMSParametersFromLine(c){let[,e,i,n]=c.match(K1)??[];if(!e||!this.admonitions[e]&&!Object.keys(this.admonitions).map(r=>r.toLowerCase()).includes(e.toLowerCase())||(e in this.admonitions||(e=Object.keys(this.admonitions).find(r=>r.toLowerCase()==e.toLowerCase())),!e))return;i==null&&!c.match(/^> \[!(\w+):[ ]?/)&&(i=this.admonitions[e].title??`${e[0].toUpperCase()}${e.slice(1).toLowerCase()}`);let o;switch(n){case"+":{o="open";break}case"-":{o="closed";break}case"x":break;default:o=this.data.autoCollapse?this.data.defaultCollapseType:null}return(o=="closed"||o=="open")&&!i&&(i=this.admonitions[e].title??`${e[0].toUpperCase()}${e.slice(1).toLowerCase()}`),{type:e,title:i,collapse:o}}enableMSSyntax(){this.registerMarkdownPostProcessor((c,e)=>{if(!this.data.allowMSSyntax||!c.hasChildNodes())return;let i=c.querySelectorAll("blockquote, pre");for(let n of Array.from(i)){if(n instanceof HTMLPreElement&&!this.data.msSyntaxIndented)continue;let o=e.getSectionInfo(n),r;o?r=o.text.split(`
`).slice(o.lineStart,o.lineEnd+1):r=n.innerText.trim().split(`
3 years ago
`).map(v=>`> ${v}`);let t=r.shift();if(!K1.test(t))continue;let l=this.getMSParametersFromLine(t);if(!l?.type)continue;let{type:f,title:s,collapse:m}=l,h=this.getAdmonitionElement(f,s,this.admonitions[f].icon,this.admonitions[f].color,m),z=r.join(`
`).replace(/^(>[ ]|\t|\s{4})/gm,"");this.renderAdmonitionContent(h,f,z,e,e.sourcePath,r.join(`
`)),n.replaceWith(h)}})}registerMSDocLivePreview(){let c=d2.StateEffect.define();class e extends _.WidgetType{constructor(l,f,s,m){super();this.type=l;this.title=f;this.collapse=s;this.content=m}eq(l){return this.type==l.type&&this.title==l.title&&this.collapse==l.collapse&&this.content==l.content}toDOM(l){let f=n.getAdmonitionElement(this.type,this.title,n.admonitions[this.type].icon,n.admonitions[this.type].color,this.collapse),s=createDiv(`cm-embed-block admonition-parent admonition-${this.type}-parent`);s.appendChild(f);let m=s.createDiv({cls:"edit-block-button",attr:{"aria-label":"Edit this block"}});(0,L.setIcon)(m,"code-glyph"),m.onclick=()=>{let v=l.posAtDOM(f);l.dispatch({selection:{head:v,anchor:v}})};let h=this.content.replace(/^> /gm,""),z=n.getAdmonitionContentElement(this.type,f,h);return L.MarkdownRenderer.renderMarkdown(h,z,"",null),(!h.length||z.textContent.trim()=="")&&n.data.hideEmpty&&f.addClass("no-content"),s}}class i{constructor(l){this.cache=Object.create(null);this.editor=l}hash(l){return`from${l.from}to${l.to}`}async compute(l){let f=[];for(let s of l){let m=this.cache[this.hash(s)];m||(m=this.cache[this.hash(s)]=_.Decoration.replace({inclusive:!0,widget:new e(s.type,s.title,s.collapse,s.value),block:!0,from:s.from,to:s.to})),f.push(m.range(s.from,s.to))}return _.Decoration.set(f,!0)}async updateDecos(l){let f=await this.compute(l);(f||this.editor.state.field(r).size)&&this.editor.dispatch({effects:[c.of(f??_.Decoration.none)]})}clearDecos(){this.editor.dispatch({effects:[c.of(_.Decoration.none)]})}}let n=this,o=_.ViewPlugin.fromClass(class{constructor(t){this.source=!1;this.manager=new i(t),this.build(t)}update(t){if(!t.heightChanged&&!!n.data.livePreviewMS){if(!H2(t.view.state)){this.source==!1&&(this.source=!0,this.manager.updateDecos([]));return}(t.docChanged||t.viewportChanged||t.selectionSet||this.source==!0)&&(this.source=!1,this.build(t.view))}}destroy(){}build(t){if(!n.data.allowMSSyntax||!n.data.livePreviewMS)return;let l=[];if(!!H2(t.state)){for(let{from:f,to:s}of t.visibleRanges)(0,_3.syntaxTree)(t.state).iterate({from:f,to:s,enter:(h,z,v)=>{let u=h.prop(K3.tokenClassNodeProp);if(!new Set(u?.split(" ")).has("quote"))return;let M=t.state.doc.sliceString(z).split(`
`),x=M[0];if(!K1.test(x))return;let d=n.getMSParametersFromLine(x);if(!d?.type)return;let{type:A,title:V,collapse:y}=d,N=M.findIndex(D=>!/^>/.test(D)),F=M.slice(1,N>-1?N:void 0).join(`
`),S=z+x.length+F.length+1;l.push({from:z,to:S,value:F?.trim(),title:V?.trim(),type:A?.trim(),collapse:y})}});this.manager.updateDecos(l)}}}),r=d2.StateField.define({create(){return _.Decoration.none},update(t,l){return l.effects.reduce((f,s)=>s.is(c)?s.value.update({filter:(m,h,z)=>!u4(l.newSelection.ranges,z.spec.from,z.spec.to)}):f,t.map(l.changes))},provide:t=>_.EditorView.decorations.from(t)});this.registerEditorExtension([o,r])}addLinksToCache(c,e){if(!!this.data.syncLinks)for(let i=0;i<c.length;i++){let n=c[i];if(n.dataset.href){let o=this.app.metadataCache.getFirstLinkpathDest(n.dataset.href,""),r,t;o&&o instanceof L.TFile?(r=this.app.metadataCache.resolvedLinks,t=o.path):(r=this.app.metadataCache.unresolvedLinks,t=n.dataset.href),r[e]||(r[e]={[t]:0});let l=r[e];l[t]||(l[t]=0),l[t]+=1,r[e]=l}}}getAdmonitionElement(c,e,i,n,o){let r,t,l=n?{style:`--admonition-color: ${n};`}:{};if(o&&o!="none"?(o==="open"&&(l.open="open"),r=createEl("details",{cls:`admonition admonition-${c} admonition-plugin ${e?.trim().length?"":"no-title"}`,attr:l}),t=r.createEl("summary",{cls:`admonition-title ${e?.trim().length?"":"no-title"}`})):(r=createDiv({cls:`admonition admonition-${c} admonition-plugin ${e?.trim().length?"":"no-title"}`,attr:l}),t=r.createDiv({cls:`admonition-title ${e?.trim().length?"":"no-title"}`})),e&&e.trim().length){let f=createDiv();L.MarkdownRenderer.renderMarkdown(e,f,"",null);let s=f.children[0]?.tagName==="P"?createDiv():f.children[0],m=Array.from(f.children[0]?.childNodes||[]);s.innerHTML="",s.addClass("admonition-title-content");let h=s.createDiv("admonition-title-icon");i&&i.name&&i.type&&h.appendChild(this.iconManager.getIconNode(i)??createDiv());let z=s.createDiv("admonition-title-markdown");for(let v=0;v<m.length;v++)z.appendChild(m[v]);t.appendChild(s||createDiv())}return o&&t.createDiv("collapser").createDiv("handle"),this.data.dropShadow||r.addClass("no-drop"),r}renderAdmonitionContent(c,e,i,n,o,r){let t=new L.MarkdownRenderChild(c);if(t.containerEl=c,n&&typeof n!="string"&&n.addChild(t),i&&i?.trim().length){let l=this.getAdmonitionContentElement(e,c,i);if(/^`{3,}mermaid/m.test(i)){let m=!c.hasAttribute("open");c instanceof HTMLDetailsElement&&c.setAttribute("open","open"),setImmediate(()=>{L.MarkdownRenderer.renderMarkdown(i,l,o,t),c instanceof HTMLDetailsElement&&m&&c.removeAttribute("open")})}else L.MarkdownRenderer.renderMarkdown(i,l,o,t);(!i.length||l.textContent.trim()=="")&&this.data.hideEmpty&&c.addClass("no-content");let f=l.querySelectorAll(".task-list-item-checkbox");if(f?.length){let m=r.split(`
`),h=0;f.forEach(z=>{let v=m.slice(h).findIndex(u=>/^[ \t>]*\- \[.\]/.test(u));v!=-1&&(z.dataset.line=`${v+h+1}`,h=v+h+1)})}let s=l.querySelectorAll("a.internal-link");this.addLinksToCache(s,o)}}getAdmonitionContentElement(c,e,i){let n=e.createDiv("admonition-content-holder"),o=n.createDiv("admonition-content");if(this.admonitions[c].copy??this.data.copyButton){let r=n.createDiv("admonition-content-copy");(0,L.setIcon)(r,x2),r.addEventListener("click",()=>{navigator.clipboard.writeText(i.trim()).then(async()=>{new L.Notice("Admonition content copied to clipboard.")})})}return o}async addAdmonition(c){this.data.userAdmonitions={...this.data.userAdmonitions,[c.type]:c},this.admonitions={...$1,...this.data.userAdmonitions},this.data.syntaxHighlight&&this.turnOnSyntaxHighlighting([c.type]),await this.saveSettings();let e=this.registerMarkdownCodeBlockProcessor(`ad-${c.type}`,(i,n,o)=>this.postprocessor(c.type,i,n,o));this.postprocessors.set(c.type,e)}registerCommandsFor(c){c.command=!0,this.addCommand({id:`insert-${c.type}`,name:`Insert ${c.type}`,editorCheckCallback:(e,i,n)=>{if(e)return c.command;if(c.command)try{i.getDoc().replaceSelection(`\`\`\`ad-${c.type}
3 years ago
${i.getDoc().getSelection()}
\`\`\`
3 years ago
`);let o=i.getCursor();i.setCursor(o.line-2)}catch{new L.Notice("There was an issue inserting the admonition.")}}}),this.addCommand({id:`insert-${c.type}-with-title`,name:`Insert ${c.type} With Title`,editorCheckCallback:(e,i,n)=>{if(e)return c.command;if(c.command)try{let o=c.title??"";i.getDoc().replaceSelection(`\`\`\`ad-${c.type}
title: ${o}
3 years ago
${i.getDoc().getSelection()}
\`\`\`
3 years ago
`);let r=i.getCursor();i.setCursor(r.line-3)}catch{new L.Notice("There was an issue inserting the admonition.")}}})}async removeAdmonition(c){this.data.userAdmonitions[c.type]&&delete this.data.userAdmonitions[c.type],this.admonitions={...$1,...this.data.userAdmonitions},this.data.syntaxHighlight&&this.turnOffSyntaxHighlighting([c.type]),c.command&&this.unregisterCommandsFor(c),this.postprocessors.has(c.type)&&(L.MarkdownPreviewRenderer.unregisterPostProcessor(this.postprocessors.get(c.type)),L.MarkdownPreviewRenderer.unregisterCodeBlockPostProcessor(`ad-${c.type}`),this.postprocessors.delete(c.type)),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({},Nb,c),this.data.userAdmonitions&&(!this.data.version||Number(this.data.version.split(".")[0])<5))for(let e in this.data.userAdmonitions)Object.prototype.hasOwnProperty.call(this.data.userAdmonitions[e],"type")||(this.data.userAdmonitions[e]={...this.data.userAdmonitions[e],icon:{type:"font-awesome",name:this.data.userAdmonitions[e].icon}});if(!this.data.rpgDownloadedOnce&&this.data.userAdmonitions&&Object.values(this.data.userAdmonitions).some(e=>{if(e.icon.type=="rpg")return!0})&&!this.data.icons.includes("rpg"))try{await this.downloadIcon("rpg"),this.data.rpgDownloadedOnce=!0}catch{}this.admonitions={...$1,...this.data.userAdmonitions},await this.saveSettings()}turnOnSyntaxHighlighting(c=Object.keys(this.admonitions)){!this.data.syntaxHighlight||(c.forEach(e=>{if(this.data.syntaxHighlight){let[,i]=`${e}`.match(/^([\w+#-]*)[^\n`]*$/);window.CodeMirror.defineMode(`ad-${i}`,(n,o)=>window.CodeMirror.getMode({},"hypermd"))}}),this.app.workspace.onLayoutReady(()=>this.app.workspace.iterateCodeMirrors(e=>e.setOption("mode",e.getOption("mode")))))}turnOffSyntaxHighlighting(c=Object.keys(this.admonitions)){c.forEach(e=>{window.CodeMirror.modes.hasOwnProperty(`ad-${e}`)&&delete window.CodeMirror.modes[`ad-${e}`]}),this.app.workspace.onLayoutReady(()=>this.app.workspace.iterateCodeMirrors(e=>e.setOption("mode",e.getOption("mode"))))}async onunload(){console.log("Obsidian Admonition unloaded"),this.turnOffSyntaxHighlighting()}};
/*!
* Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
/*!
* 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)
*/