device-60.home 2025-9-9:23:57:54

This commit is contained in:
oskar
2025-09-09 23:57:54 +02:00
parent 9c547c4311
commit e01889f38f
36 changed files with 2208 additions and 1302 deletions

View File

@@ -40,5 +40,6 @@
"obsidian-spaced-repetition",
"obsidian-minimal-settings",
"github-sync",
"obsidian-completr"
"obsidian-completr",
"default-template"
]

View File

@@ -27,7 +27,7 @@
"sync": false,
"canvas": true,
"bookmarks": true,
"properties": true,
"properties": false,
"webviewer": true,
"footnotes": true,
"bases": true

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,8 @@
{
"id": "darlal-switcher-plus",
"name": "Quick Switcher++",
"version": "5.3.0",
"minAppVersion": "1.9.10",
"version": "5.3.1",
"minAppVersion": "1.9.12",
"description": "Enhanced Quick Switcher, search open panels, and symbols.",
"author": "darlal",
"authorUrl": "https://github.com/darlal/obsidian-switcher-plus",

View File

@@ -0,0 +1,3 @@
{
"defaultTemplate": "templates/default new note.md"
}

View File

@@ -0,0 +1,6 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var T=(s,a)=>{for(var t in a)o(s,t,{get:a[t],enumerable:!0})},w=(s,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of f(a))!h.call(s,l)&&l!==t&&o(s,l,{get:()=>a[l],enumerable:!(n=d(a,l))||n.enumerable});return s};var D=s=>w(o({},"__esModule",{value:!0}),s);var v={};T(v,{default:()=>p});module.exports=D(v);var e=require("obsidian"),y={defaultTemplate:""},p=class extends e.Plugin{async onload(){await this.loadSettings(),this.registerEvent(this.app.vault.on("create",async t=>{if(!(t instanceof e.TFile)||t.extension!=="md")return;if(!this.settings.defaultTemplate){new e.Notice("Default Template: No template configured. Go to Settings \u2192 Default Template to select one.");return}if((await this.app.vault.read(t)).trim().length!==0)return;let l=this.app.vault.getAbstractFileByPath(this.settings.defaultTemplate);if(!(l instanceof e.TFile)){new e.Notice(`Default Template: Template file "${this.settings.defaultTemplate}" not found. Please select a new template.`);return}try{let c=(await this.app.vault.read(l)).replace(/\{\{date(?::([^}]+))?\}\}/g,(g,i)=>i?(0,e.moment)().format(i):(0,e.moment)().format("YYYY-MM-DD")).replace(/\{\{time(?::([^}]+))?\}\}/g,(g,i)=>i?(0,e.moment)().format(i):(0,e.moment)().format("HH:mm")).replace(/\{\{title\}\}/g,t.basename);await this.app.vault.modify(t,c)}catch(m){new e.Notice(`Default Template: Template file "${this.settings.defaultTemplate}" not found or cannot be read.`)}})),this.addSettingTab(new r(this.app,this))}onunload(){}async loadSettings(){this.settings=Object.assign({},y,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}},u=class extends e.FuzzySuggestModal{constructor(t,n){super(t);this.plugin=n}getItems(){return this.app.vault.getMarkdownFiles()}getItemText(t){return t.path}onChooseItem(t){this.plugin.settings.defaultTemplate=t.path,this.plugin.saveSettings(),new e.Notice(`Default template set to: ${t.path}`)}},r=class extends e.PluginSettingTab{constructor(t,n){super(t,n);this.plugin=n}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"Default Template"}),new e.Setting(t).setName("Default template file").setDesc("Select a template file to automatically apply to new empty notes").addButton(n=>n.setButtonText("Select template").onClick(()=>{new u(this.app,this.plugin).open()})),this.plugin.settings.defaultTemplate?t.createEl("div",{text:`\u2713 Active template: ${this.plugin.settings.defaultTemplate}`,cls:"mod-success"}):t.createEl("p",{text:"No template selected. Plugin will not apply any template to new files.",cls:"setting-item-description"})}};

View File

@@ -0,0 +1 @@
{"id":"default-template","name":"Default Template","version":"1.0.1","minAppVersion":"0.15.0","description":"Automatically apply templates to new notes with user-configurable template selection.","author":"raeperd","authorUrl":"https://github.com/raeperd","fundingUrl":"","isDesktopOnly":false}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "extended-graph",
"name": "Extended Graph",
"version": "2.7.5",
"version": "2.7.6",
"minAppVersion": "1.7.0",
"description": "Extends the features of the core Graph view, display images, manage states, remove links, change node shapes, and more.",
"author": "Kapirklaa",

View File

@@ -644,178 +644,9 @@ var F = class {
}
};
// node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
function dedent(templ) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
var indentLengths = strings.reduce(function(arr, str) {
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
if (matches) {
return arr.concat(matches.map(function(match) {
var _a, _b;
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
}));
}
return arr;
}, []);
if (indentLengths.length) {
var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
strings = strings.map(function(str) {
return str.replace(pattern_1, "\n");
});
}
strings[0] = strings[0].replace(/^\r?\n/, "");
var string = strings[0];
values.forEach(function(value, i) {
var endentations = string.match(/(?:^|\n)( *)$/);
var endentation = endentations ? endentations[1] : "";
var indentedValue = value;
if (typeof value === "string" && value.includes("\n")) {
indentedValue = String(value).split("\n").map(function(str, i2) {
return i2 === 0 ? str : "" + endentation + str;
}).join("\n");
}
string += indentedValue + strings[i + 1];
});
return string;
}
var esm_default = dedent;
// src/confirm-modal.ts
var import_obsidian = require("obsidian");
var ConfirmModal = class extends import_obsidian.Modal {
constructor(app) {
super(app);
}
setMessage(message) {
this.message = message;
return this;
}
onConfirm(f2) {
this.confirmHandler = f2;
return this;
}
onOpen() {
const { contentEl, titleEl } = this;
titleEl.setText("Are you sure?");
new import_obsidian.Setting(contentEl).setDesc(this.message);
new import_obsidian.Setting(contentEl).addButton((btn) => btn.setButtonText("Cancel").onClick(() => {
this.close();
})).addButton((btn) => btn.setButtonText("Continue").setCta().onClick(() => {
this.close();
this.confirmHandler();
}));
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
};
// src/inline.ts
var import_language = require("@codemirror/language");
var import_view = require("@codemirror/view");
var import_obsidian2 = require("obsidian");
// src/utils.ts
function normalizeEscape(escape_) {
return escape_.replace(/([$^\\.()[\]{}*?|])/g, "\\$1");
}
function isLatexCode(code) {
const latexRegex = /\\([A-Za-z0-9]){2,}/gm;
const texEmbedRegex = /tex".*"/;
return latexRegex.test(code) && !texEmbedRegex.test(code);
}
// src/inline.ts
var AM = new F();
function selectionAndRangeOverlap(selection, rangeFrom, rangeTo) {
for (const range of selection.ranges) {
if (range.from <= rangeTo && range.to >= rangeFrom)
return true;
}
return false;
}
function inlineRender(view, plugin) {
const currentFile = plugin.app.workspace.getActiveFile();
if (!currentFile)
return;
const widgets = [];
const selection = view.state.selection;
const regex = /.*?_?inline-code_?.*/;
for (const { from, to } of view.visibleRanges) {
(0, import_language.syntaxTree)(view.state).iterate({
from,
to,
enter: (node) => {
const type = node.type;
if (type.name.includes("formatting"))
return;
if (!regex.test(type.name))
return;
const start = node.from;
const end = node.to;
const { open, close } = plugin.settings.inline;
if (selectionAndRangeOverlap(selection, start - open.length + 1, end + close.length - 1))
return;
const original = view.state.doc.sliceString(start - open.length + 1, end + close.length - 1).trim();
const regex2 = new RegExp(`^${normalizeEscape(open)}(.*?)${normalizeEscape(close)}$`);
const matches = original.match(regex2);
if (!matches)
return;
widgets.push(import_view.Decoration.replace({
widget: new InlineWidget(matches[1], view),
inclusive: false,
block: false
}).range(start - 1, end + 1));
}
});
}
return import_view.Decoration.set(widgets, true);
}
var InlineWidget = class extends import_view.WidgetType {
constructor(rawQuery, view) {
super();
this.rawQuery = rawQuery;
this.view = view;
}
eq(other) {
if (other.rawQuery === this.rawQuery)
return true;
return false;
}
toDOM(_view) {
const tex = AM.toTex(this.rawQuery);
const mathEl = (0, import_obsidian2.renderMath)(tex, false);
(0, import_obsidian2.finishRenderMath)();
return mathEl;
}
};
function inlinePlugin(plugin) {
return import_view.ViewPlugin.fromClass(class {
constructor(view) {
var _a;
this.decorations = (_a = inlineRender(view, plugin)) != null ? _a : import_view.Decoration.none;
}
update(update) {
var _a;
if (!update.state.field(import_obsidian2.editorLivePreviewField)) {
this.decorations = import_view.Decoration.none;
return;
}
if (update.docChanged || update.viewportChanged || update.selectionSet)
this.decorations = (_a = inlineRender(update.view, plugin)) != null ? _a : import_view.Decoration.none;
}
}, { decorations: (v2) => v2.decorations });
}
// src/settings.ts
var import_obsidian3 = require("obsidian");
var AsciiMathSettingTab = class extends import_obsidian3.PluginSettingTab {
var import_obsidian = require("obsidian");
var AsciiMathSettingTab = class extends import_obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
@@ -824,37 +655,25 @@ var AsciiMathSettingTab = class extends import_obsidian3.PluginSettingTab {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Settings for asciimath" });
new import_obsidian3.Setting(containerEl).setName("Code block prefix aliases").setDesc("Seperate different aliases with comma.").addText((text) => text.setPlaceholder("asciimath, am").setValue(this.plugin.settings.blockPrefix.join(", ")).onChange((0, import_obsidian3.debounce)((value) => {
new import_obsidian.Setting(containerEl).setName("Code block prefix aliases").setDesc("Seperate different aliases with comma.").addText((text) => text.setPlaceholder("asciimath, am").setValue(this.plugin.settings.blockPrefix.join(", ")).onChange((0, import_obsidian.debounce)((value) => {
this.plugin.settings.blockPrefix = value.split(",").map((s) => s.trim()).filter(Boolean);
}, 1e3)));
new import_obsidian3.Setting(containerEl).setName("Replace math blocks").setDesc("Enable this if you want to use AsciiMath but keep using default math blocks (dollar-sign blocks). This will not affect your previous notes that are written in LaTeX because the plugin will check which syntax to use before drawing the math.").addToggle((toggle) => {
new import_obsidian.Setting(containerEl).setName("Replace math blocks").setDesc("Enable this if you want to use AsciiMath but keep using default math blocks (dollar-sign blocks). This will not affect your previous notes that are written in LaTeX because the plugin will check which syntax to use before drawing the math.").addToggle((toggle) => {
toggle.setValue(this.plugin.settings.replaceMathBlock).onChange((v2) => {
this.plugin.settings.replaceMathBlock = v2;
this.plugin.setupMathBlockRendering();
});
});
new import_obsidian3.Setting(containerEl).setName("Custom symbols").setDesc("Transforms custom symbols into LaTeX symbols. One row for each rule.").addTextArea((text) => {
const el = text.setPlaceholder("symbol1, \\LaTeXSymbol1\nsymbol2, \\LaTeXSymbol2\n...").setValue(this.plugin.settings.customSymbols.map((r) => r.join(", ")).join("\n")).onChange((0, import_obsidian3.debounce)((value) => {
new import_obsidian.Setting(containerEl).setName("Custom symbols").setDesc("Transforms custom symbols into LaTeX symbols. One row for each rule.").addTextArea((text) => {
const el = text.setPlaceholder("symbol1, \\LaTeXSymbol1\nsymbol2, \\LaTeXSymbol2\n...").setValue(this.plugin.settings.customSymbols.map((r) => r.join(", ")).join("\n")).onChange((0, import_obsidian.debounce)((value) => {
this.plugin.settings.customSymbols = value.split("\n").map((r) => r.split(",").map((s) => s.trim()).filter(Boolean)).filter((l) => l.length);
}, 1e3));
el.inputEl.addClass("__asciimath_settings_custom-symbols");
});
new import_obsidian3.Setting(containerEl).setHeading().setName("Inline code math (deprecated)").setDesc("These settings will be removed in the next version of the plugin");
new import_obsidian3.Setting(containerEl).setName("Disable deprecation warning").setDesc("Note: ignoring deprecation issues may make the plugin unusable with existing notes in the future.").addToggle((toggle) => {
toggle.setValue(this.plugin.settings.disableDeprecationWarning).onChange((v2) => {
this.plugin.settings.disableDeprecationWarning = v2;
});
});
new import_obsidian3.Setting(containerEl).setName("Inline asciimath start").setDesc("The leading escape of the inline asciimath formula. It should starts with **only one backtick**.").addText((text) => text.setPlaceholder("`$").setValue(this.plugin.settings.inline.open).onChange((0, import_obsidian3.debounce)((value) => {
this.plugin.settings.inline.open = value;
}, 1e3)));
new import_obsidian3.Setting(containerEl).setName("Inline asciimath end").setDesc("The trailing escape of the inline asciimath formula. It should ends with **only one backtick**.").addText((text) => text.setPlaceholder("$`").setValue(this.plugin.settings.inline.close).onChange((0, import_obsidian3.debounce)((value) => {
this.plugin.settings.inline.close = value;
}, 1e3)));
new import_obsidian3.Setting(containerEl).setName("Don't forget to save and reload settings \u2192").addButton((btn) => btn.setButtonText("Save").onClick(async () => {
new import_obsidian.Setting(containerEl).setName("Don't forget to save and reload settings \u2192").addButton((btn) => btn.setButtonText("Save").onClick(async () => {
const valid = validateSettings(this.plugin.settings);
if (!valid.isValid) {
new import_obsidian3.Notice(valid.message);
new import_obsidian.Notice(valid.message);
return;
}
await this.plugin.saveSettings();
@@ -866,7 +685,7 @@ var AsciiMathSettingTab = class extends import_obsidian3.PluginSettingTab {
this.plugin.AM = new F({
symbols: this.plugin.calcSymbols()
});
new import_obsidian3.Notice("Asciimath settings reloaded successfully!");
new import_obsidian.Notice("Asciimath settings reloaded successfully!");
}));
}
};
@@ -877,19 +696,6 @@ function validateSettings(settings) {
message: "You should add at least 1 block prefix!"
};
}
const { open, close } = settings.inline;
if (!open.startsWith("`") || open.length <= 1 || open.startsWith("``")) {
return {
isValid: false,
message: "Invalid inline leading escape!"
};
}
if (!close.endsWith("`") || close.length <= 1 || close.endsWith("``")) {
return {
isValid: false,
message: "Invalid inline trailing escape!"
};
}
const { customSymbols } = settings;
if (customSymbols.find((pair) => pair.length !== 2)) {
return {
@@ -903,8 +709,23 @@ function validateSettings(settings) {
};
}
// src/utils.ts
function isLatexCode(code) {
const latexRegex = /\\([A-Za-z0-9]){2,}/gm;
const simpleLatexSupSubRegex = /[\^_]\{\s*[a-zA-Z0-9 ]+\s*\}/g;
const texEmbedRegex = /tex".*"/;
const hasTrueLatex = latexRegex.test(code);
const hasSimpleLatexSupSub = simpleLatexSupSubRegex.test(code);
const hasTexEmbed = texEmbedRegex.test(code);
return (hasTrueLatex || hasSimpleLatexSupSub && !hasTrueLatex) && !hasTexEmbed;
}
function toTex(am, content, displayMode) {
const tex = am.toTex(content, { display: displayMode });
return tex.replace(/(\{|\})(\1+)/g, (...args) => Array(args[2].length + 1).fill(args[1]).join(" "));
}
// src/symbol-search/modal.ts
var import_obsidian4 = require("obsidian");
var import_obsidian2 = require("obsidian");
// src/symbol-search/symbols.json
var symbols_default = [
@@ -1429,7 +1250,7 @@ var symbols_default = [
];
// src/symbol-search/modal.ts
var SymbolSearchModal = class extends import_obsidian4.SuggestModal {
var SymbolSearchModal = class extends import_obsidian2.SuggestModal {
constructor(app, sel, am) {
super(app);
this.sel = sel;
@@ -1477,11 +1298,11 @@ var SymbolSearchModal = class extends import_obsidian4.SuggestModal {
toBeRendered = `tex"${toBeRendered}"`;
el2.innerHTML = `
<mjx-container class="MathJax" jax="CHTML">
${(0, import_obsidian4.renderMath)(toBeRendered, true).innerHTML}
${(0, import_obsidian2.renderMath)(toBeRendered, true).innerHTML}
</mjx-container>
`;
if (this.renderCount >= this.renderMax)
(0, import_obsidian4.finishRenderMath)();
(0, import_obsidian2.finishRenderMath)();
});
}
onSelected(cb) {
@@ -1492,21 +1313,388 @@ var SymbolSearchModal = class extends import_obsidian4.SuggestModal {
}
};
// src/symbol-search/modal-instance.ts
function createModalInstance(editor) {
const sel = editor.getSelection();
const modal = new SymbolSearchModal(this.app, sel, this.AM);
modal.setPlaceholder("Start typing AsciiMath or LaTeX symbol name");
modal.onSelected((sym) => {
var _a;
const { am } = sym;
if ("placeholder" in sym) {
const { placeholder, fill } = sym;
let tempExceptFirst = placeholder;
for (let i = 2; i <= fill.length; i++)
tempExceptFirst = tempExceptFirst.replace(`$${i}`, "");
const temp = tempExceptFirst.replace("$1", "");
if (!sel) {
const cur = editor.getCursor();
const placeholder_a_pos = placeholder.indexOf("$1");
const spacesBefore$1 = ((_a = placeholder.substring(0, placeholder_a_pos).match(/(\$\d+?)/g)) == null ? void 0 : _a.join("").length) || 0;
editor.replaceSelection(am + temp);
editor.setCursor({
line: cur.line,
ch: cur.ch + am.length + placeholder_a_pos - spacesBefore$1
});
} else {
const placeholder_b_pos = placeholder.indexOf("$2");
const cur = editor.getCursor("to");
editor.replaceSelection(am + tempExceptFirst.replace("$1", sel));
if (placeholder_b_pos !== -1) {
const $before$2 = placeholder.substring(0, placeholder_b_pos).match(/(\$\d+?)/g);
const $spacesBefore$2 = ($before$2 == null ? void 0 : $before$2.join("").length) || 0;
const $2before$1 = !$before$2 || !$before$2.includes("$1") ? sel.length : 0;
editor.setCursor({
line: cur.line,
ch: cur.ch + am.length + placeholder_b_pos - $spacesBefore$2 - $2before$1
});
} else {
editor.setCursor({
line: cur.line,
ch: cur.ch + am.length + placeholder.length - 2
});
}
}
} else {
editor.replaceSelection(am);
}
});
modal.open();
}
// src/confirm-modal.ts
var import_obsidian3 = require("obsidian");
var ConfirmModal = class extends import_obsidian3.Modal {
constructor(app) {
super(app);
}
setMessage(message) {
this.message = message;
return this;
}
setEnableDisplayMode(enableDisplayMode) {
this.enableDisplayMode = enableDisplayMode;
return this;
}
onConfirm(f2) {
this.confirmHandler = () => f2(this.enableDisplayMode);
return this;
}
onOpen() {
const { contentEl, titleEl } = this;
titleEl.setText("Are you sure?");
new import_obsidian3.Setting(contentEl).setDesc(this.message);
new import_obsidian3.Setting(contentEl).setName("Enable display mode for each formula").setDesc("This option will insert \\display{ ... } for each formula.").addToggle((toggle) => toggle.setValue(this.enableDisplayMode).onChange((value) => {
this.enableDisplayMode = value;
}));
new import_obsidian3.Setting(contentEl).addButton((btn) => btn.setButtonText("Cancel").onClick(() => {
this.close();
})).addButton((btn) => btn.setButtonText("Continue").setCta().onClick(() => {
this.close();
this.confirmHandler();
}));
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
};
// node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
function dedent(templ) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
var indentLengths = strings.reduce(function(arr, str) {
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
if (matches) {
return arr.concat(matches.map(function(match) {
var _a, _b;
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
}));
}
return arr;
}, []);
if (indentLengths.length) {
var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
strings = strings.map(function(str) {
return str.replace(pattern_1, "\n");
});
}
strings[0] = strings[0].replace(/^\r?\n/, "");
var string = strings[0];
values.forEach(function(value, i) {
var endentations = string.match(/(?:^|\n)( *)$/);
var endentation = endentations ? endentations[1] : "";
var indentedValue = value;
if (typeof value === "string" && value.includes("\n")) {
indentedValue = String(value).split("\n").map(function(str, i2) {
return i2 === 0 ? str : "" + endentation + str;
}).join("\n");
}
string += indentedValue + strings[i + 1];
});
return string;
}
var esm_default = dedent;
// src/convertion.ts
var import_obsidian4 = require("obsidian");
async function convertAsciiMathInFile(plugin, file, display) {
const view = plugin.app.workspace.getActiveViewOfType(import_obsidian4.MarkdownView);
if (!view)
return { block: 0, inline: 0 };
const { editor } = view;
const cache = plugin.app.metadataCache.getFileCache(file);
if (!cache || !cache.sections)
return { block: 0, inline: 0 };
const formulaBlocks = [];
if (cache.sections) {
for (const section of cache.sections) {
const { start, end } = section.position;
if (section.type === "math" || section.type === "code") {
let content = editor.getRange({ line: start.line, ch: start.col }, { line: end.line, ch: end.col });
if (section.type === "math") {
content = content.replace(/^\$\$\s*/, "").replace(/\s*\$\$$/, "");
}
if (section.type === "code") {
const blockReg = new RegExp(`((\`|~){3,})(${plugin.settings.blockPrefix.join("|")})([\\s\\S]*?)\\n\\1`, "m");
const match = content.match(blockReg);
if (match)
content = match[4].trim();
else
continue;
}
formulaBlocks.push({
content,
position: section.position,
isBlock: true
});
} else {
let content = editor.getRange({ line: start.line, ch: start.col }, { line: end.line, ch: end.col });
const inlineMathRegex = /(?<!\$)\$([^$]+?)\$(?!\$)/g;
let inlineMatch;
while ((inlineMatch = inlineMathRegex.exec(content)) !== null) {
const relativeStart = inlineMatch.index;
const relativeEnd = relativeStart + inlineMatch[0].length;
const absoluteStart = section.position.start.offset + relativeStart;
const absoluteEnd = section.position.start.offset + relativeEnd;
const startPos = editor.offsetToPos(absoluteStart);
const endPos = editor.offsetToPos(absoluteEnd);
const amCode = inlineMatch[1].trim();
if (isLatexCode(amCode))
continue;
formulaBlocks.push({
position: {
start: { line: startPos.line, col: startPos.ch, offset: absoluteStart },
end: { line: endPos.line, col: endPos.ch, offset: absoluteEnd }
},
content: amCode,
isBlock: false
});
}
}
}
const changes = [];
formulaBlocks.forEach((block) => {
const { start, end } = block.position;
const res = toTex(plugin.AM, block.content, display);
const replacement = block.isBlock ? `$$
${res}
$$` : `$${res}$`;
changes.push({
from: { line: start.line, ch: start.col },
to: { line: end.line, ch: end.col },
text: replacement
});
});
editor.transaction({ changes });
new import_obsidian4.Notice(`Conversion completed: ${formulaBlocks.length} formulas processed`);
}
return {
block: formulaBlocks.filter((x) => x.isBlock).length,
inline: formulaBlocks.filter((x) => !x.isBlock).length
};
}
async function extractFormulasInFile(plugin, file) {
const content = await plugin.app.vault.read(file);
const formulas = [];
const codeRanges = [];
const codeBlockRegex = /(^|\n)(```|~~~)[\s\S]*?\2/g;
const amCodeBlockRegex = new RegExp(`([\`~]{3,})(${plugin.settings.blockPrefix.join("|")})([\\s\\S]*?)\\n\\1`, "m");
const inlineCodeRegex = /`[^`\n]*`/g;
for (const match of content.matchAll(codeBlockRegex)) {
const am = match[0].match(amCodeBlockRegex);
codeRanges.push({
start: match.index,
end: match.index + match[0].length,
isAm: am !== null
});
if (am) {
const amCode = am[3];
let start = match.index;
if (match[1] === "\n") {
start += 1;
}
formulas.push({
type: "block",
start,
end: match.index + match[0].length,
content: amCode
});
}
}
for (const match of content.matchAll(inlineCodeRegex)) {
codeRanges.push({
start: match.index,
end: match.index + match[0].length,
isAm: false
});
}
const inlineRegex = /(?<![\\\$])\$([^$]+?)\$/g;
const blockRegex = /(?<!\\)\$\$([\s\S]+?)\$\$/g;
for (const match of content.matchAll(inlineRegex)) {
if (!isLatexCode(match[1])) {
formulas.push({
type: "inline",
start: match.index,
end: match.index + match[0].length,
content: match[1].trim()
});
}
}
for (const match of content.matchAll(blockRegex)) {
if (!isLatexCode(match[1])) {
formulas.push({
type: "block",
start: match.index,
end: match.index + match[0].length,
content: match[1].trim()
});
}
}
return formulas.filter((formula) => {
return !codeRanges.some((range) => formula.start >= range.start && formula.end <= range.end && !range.isAm);
});
}
async function replaceFormulasInFile(plugin, file, enableDisplayMode) {
const content = await plugin.app.vault.read(file);
const formulas = await extractFormulasInFile(plugin, file);
console.log({ formulas });
formulas.sort((a, b2) => b2.start - a.start);
let newContent = content;
const convertedCnt = { block: 0, inline: 0 };
for (const formula of formulas) {
if (isLatexCode(formula.content)) {
continue;
}
const converted = toTex(plugin.AM, formula.content.trim(), enableDisplayMode);
const replacement = formula.type === "inline" ? `$${converted}$` : `$$${converted}$$`;
newContent = newContent.substring(0, formula.start) + replacement + newContent.substring(formula.end);
convertedCnt[formula.type] += 1;
}
await plugin.app.vault.modify(file, newContent);
return convertedCnt;
}
function actionConvertActiveFile(plugin, message) {
return async () => new ConfirmModal(plugin.app).setMessage(message).setEnableDisplayMode(false).onConfirm(async (displayMode) => {
const file = plugin.app.workspace.getActiveFile();
if (!file) {
new import_obsidian4.Notice("No active file found.");
return;
}
await convertAsciiMathInFile(plugin, file, displayMode);
}).open();
}
function actionConvertEntireVault(plugin, message) {
return async () => new ConfirmModal(plugin.app).setMessage(message).setEnableDisplayMode(false).onConfirm(async (displayMode) => {
const allConvertionRes = await Promise.all(plugin.app.vault.getMarkdownFiles().map(async (f2) => {
const convertionRes = await replaceFormulasInFile(plugin, f2, displayMode);
return {
...convertionRes,
hasAsciimath: convertionRes.block || convertionRes.inline
};
}));
const lo = { block: 0, inline: 0, fileNum: 0 };
allConvertionRes.forEach((res) => {
if (res.hasAsciimath) {
lo.block += res.block;
lo.inline += res.inline;
lo.fileNum += 1;
}
});
new import_obsidian4.Notice(`Converted ${lo.block} blocks and ${lo.inline} inline formulas in ${lo.fileNum} file${lo.fileNum > 1 ? "s" : ""}.`);
}).open();
}
// src/commands.ts
function initCommands(plugin) {
const commands = [
{
id: "asciimath-insert-symbol",
icon: "sigma",
name: "View AsciiMath symbols",
editorCallback: (editor) => {
createModalInstance(editor);
}
},
{
id: "insert-asciimath-block",
name: "Insert asciimath block",
editorCallback: (editor, _view) => {
editor.replaceSelection(`\`\`\`${plugin.settings.blockPrefix[0] || "asciimath"}
${editor.getDoc().getSelection()}
\`\`\``);
const cursor = editor.getCursor();
editor.setCursor(cursor.line - 1);
}
},
{
id: "convert-selected-to-latex",
name: "Convert exact selection into LaTeX",
editorCallback: (editor, _view) => {
const cursorStart = editor.getCursor("from");
const cursorEnd = editor.getCursor("to");
const amCode = editor.getSelection();
const doConvert = () => editor.replaceRange(plugin.AM.toTex(amCode), cursorStart, cursorEnd);
if (amCode.length > 1e3) {
new ConfirmModal(plugin.app).setMessage(esm_default`The selection is over 1000 chars.
Please confirm that you have selected the exact AsciiMath expression.
Click the Continue button to convert though.`).onConfirm(doConvert).open();
} else if (isLatexCode(amCode)) {
new ConfirmModal(plugin.app).setMessage(esm_default`The selection may be already LaTeX.
Click the Continue buttom to convert though.`).onConfirm(doConvert).open();
} else {
doConvert();
}
}
},
{
id: "convert-am-block-into-mathjax-in-current-file",
name: "Convert AsciiMath to LaTeX (active file)",
callback: actionConvertActiveFile(plugin, "This will replace all AsciiMath blocks with LaTeX math blocks in the active file. THIS ACTION CANNOT BE UNDONE.")
},
{
id: "convert-am-block-into-mathjax-in-vault",
name: "Convert AsciiMath to LaTeX (entire vault)",
callback: actionConvertEntireVault(plugin, "This will replace all AsciiMath formulas with LaTeX math blocks in the entire vault. THIS ACTION CANNOT BE UNDONE.")
}
];
commands.forEach((command) => {
plugin.addCommand(command);
});
}
// src/main.ts
var DEFAULT_SETTINGS = {
blockPrefix: ["asciimath", "am"],
disableDeprecationWarning: false,
replaceMathBlock: true,
inline: {
open: "`$",
close: "$`"
},
customSymbols: []
};
function toTex(am, content) {
const tex = am.toTex(content);
return tex.replace(/(\{|\})(\1+)/g, (...args) => Array(args[2].length + 1).fill(args[1]).join(" "));
}
var AsciiMathPlugin = class extends import_obsidian5.Plugin {
constructor() {
super(...arguments);
@@ -1566,86 +1754,7 @@ var AsciiMathPlugin = class extends import_obsidian5.Plugin {
new import_obsidian5.Notice("Error: MathJax was not defined despite loading it!");
return;
}
this.app.workspace.on("file-open", async (file) => {
if (!file || this.settings.disableDeprecationWarning)
return;
const content = await this.app.vault.read(file);
const [open, close] = Object.values(this.settings.inline).map(normalizeEscape);
const inlineReg = new RegExp(`${open}(.*?)${close}`, "g");
if (inlineReg.test(content)) {
new import_obsidian5.Notice(esm_default`
Obsidian AsciiMath:
Inline math with single backticks is deprecated. Refer to the plugin description to fix this issue.
You also can disable this warning in the plugin settings.
Click here to dismiss this message.
`, 0);
}
});
this.addCommand({
id: "asciimath-insert-symbol",
icon: "sigma",
name: "View AsciiMath symbols",
editorCallback: this.modalCallback()
});
this.addCommand({
id: "insert-asciimath-block",
name: "Insert asciimath block",
editorCallback: (editor, _view) => {
editor.replaceSelection(`\`\`\`${this.settings.blockPrefix[0] || "asciimath"}
${editor.getDoc().getSelection()}
\`\`\``);
const cursor = editor.getCursor();
editor.setCursor(cursor.line - 1);
}
});
this.addCommand({
id: "convert-selected-to-latex",
name: "Convert exact selection into LaTeX",
editorCallback: (editor, _view) => {
const cursorStart = editor.getCursor("from");
const cursorEnd = editor.getCursor("to");
const amCode = editor.getSelection();
const doConvert = () => editor.replaceRange(this.AM.toTex(amCode), cursorStart, cursorEnd);
if (amCode.length > 500) {
new ConfirmModal(this.app).setMessage(esm_default`The selection is over 500 chars.
Please confirm that you have selected the exact AsciiMath expression.
Click the Continue button to convert though.`).onConfirm(doConvert).open();
} else if (isLatexCode(amCode)) {
new ConfirmModal(this.app).setMessage(esm_default`The selection may be already LaTeX.
Click the Continue buttom to convert though.`).onConfirm(doConvert).open();
} else {
doConvert();
}
}
});
this.addCommand({
id: "convert-am-block-into-mathjax-in-current-file",
name: "Convert AsciiMath to LaTeX (active file)",
callback: this.actionConvertActiveFile("Tex" /* Tex */, "This will replace all AsciiMath blocks with LaTeX math blocks in the active file. THIS ACTION CANNOT BE UNDONE.")
});
this.addCommand({
id: "convert-am-inline-into-new-syntax-in-current-file",
name: "Update old AsciiMath (active file)",
callback: this.actionConvertActiveFile("Asciimath" /* Asciimath */, esm_default`
This will replace all Asciimath formulas of old syntax (like \`\$ and \$\`) with new syntax (wrapped with dollar signs),
which is more convenient to use.
THIS ACTION CANNOT BE UNDONE.`)
});
this.addCommand({
id: "convert-am-block-into-mathjax-in-vault",
name: "Convert AsciiMath to LaTeX (entire vault)",
callback: this.actionConvertEntireVault("Tex" /* Tex */, "This will replace all AsciiMath formulas with LaTeX math blocks in the entire vault. THIS ACTION CANNOT BE UNDONE.")
});
this.addCommand({
id: "convert-am-inline-into-new-syntax-in-vault",
name: "Update old AsciiMath (entire vault)",
callback: this.actionConvertEntireVault("Asciimath" /* Asciimath */, esm_default`
This will replace all Asciimath formulas of old syntax (like \`\$ and \$\`) with new syntax (wrapped with dollar signs),
which is more convenient to use.
THIS ACTION CANNOT BE UNDONE.`)
});
initCommands(this);
this.postProcessors = /* @__PURE__ */ new Map();
this.app.workspace.onLayoutReady(async () => {
this.settings.blockPrefix.forEach((prefix) => {
@@ -1653,139 +1762,10 @@ ${editor.getDoc().getSelection()}
this.existPrefixes.push(prefix);
});
});
this.registerEditorExtension([inlinePlugin(this)]);
this.registerMarkdownPostProcessor(this.postProcessorInline.bind(this));
this.setupMathBlockRendering();
this.addSettingTab(new AsciiMathSettingTab(this.app, this));
console.log("Obsidian asciimath loaded");
}
modalCallback() {
return (editor) => {
const sel = editor.getSelection();
const modal = new SymbolSearchModal(this.app, sel, this.AM);
modal.setPlaceholder("Start typing AsciiMath or LaTeX symbol name");
modal.onSelected((sym) => {
var _a;
const { am } = sym;
if ("placeholder" in sym) {
const { placeholder, fill } = sym;
let tempExceptFirst = placeholder;
for (let i = 2; i <= fill.length; i++)
tempExceptFirst = tempExceptFirst.replace(`$${i}`, "");
const temp = tempExceptFirst.replace("$1", "");
if (!sel) {
const cur = editor.getCursor();
const placeholder_a_pos = placeholder.indexOf("$1");
const spacesBefore$1 = ((_a = placeholder.substring(0, placeholder_a_pos).match(/(\$\d+?)/g)) == null ? void 0 : _a.join("").length) || 0;
editor.replaceSelection(am + temp);
editor.setCursor({
line: cur.line,
ch: cur.ch + am.length + placeholder_a_pos - spacesBefore$1
});
} else {
const placeholder_b_pos = placeholder.indexOf("$2");
const cur = editor.getCursor("to");
editor.replaceSelection(am + tempExceptFirst.replace("$1", sel));
if (placeholder_b_pos !== -1) {
const $before$2 = placeholder.substring(0, placeholder_b_pos).match(/(\$\d+?)/g);
const $spacesBefore$2 = ($before$2 == null ? void 0 : $before$2.join("").length) || 0;
const $2before$1 = !$before$2 || !$before$2.includes("$1") ? sel.length : 0;
editor.setCursor({
line: cur.line,
ch: cur.ch + am.length + placeholder_b_pos - $spacesBefore$2 - $2before$1
});
} else {
editor.setCursor({
line: cur.line,
ch: cur.ch + am.length + placeholder.length - 2
});
}
}
} else {
editor.replaceSelection(am);
}
});
modal.open();
};
}
actionConvertActiveFile(target, message) {
return async () => new ConfirmModal(this.app).setMessage(message).onConfirm(async () => {
const file = this.app.workspace.getActiveFile();
const { block, inline } = await this.convertAsciiMathInFile(file, target);
new import_obsidian5.Notice(`Converted ${block} blocks and ${inline} inline formulas.`);
}).open();
}
actionConvertEntireVault(target, message) {
return async () => new ConfirmModal(this.app).setMessage(message).onConfirm(async () => {
const allConvertionRes = await Promise.all(this.app.vault.getMarkdownFiles().map(async (f2) => {
const convertionRes = await this.convertAsciiMathInFile(f2, target);
return {
...convertionRes,
hasAsciimath: convertionRes.block || convertionRes.inline
};
}));
const { block, inline, fileNum } = allConvertionRes.reduce((x, y) => {
return {
block: x.block + y.block,
inline: x.inline + y.inline,
fileNum: x.fileNum + y.hasAsciimath
};
}, { block: 0, inline: 0, fileNum: 0 });
new import_obsidian5.Notice(`Converted ${block} blocks and ${inline} inline formulas in ${fileNum} file${fileNum > 1 ? "s" : ""}.`);
}).open();
}
async convertAsciiMathInFile(file, target) {
const convertionRes = { block: 0, inline: 0 };
let content = await this.app.vault.read(file);
const blockReg = new RegExp(`((\`|~){3,})(${this.settings.blockPrefix.join("|")})([\\s\\S]*?)\\n\\1`, "gm");
const [open, close] = Object.values(this.settings.inline).map(normalizeEscape);
const inlineReg = new RegExp(`${open}(.*?)${close}`, "g");
try {
const blockIterator = content.matchAll(blockReg);
let match;
while (!(match = blockIterator.next()).done) {
const block = match.value[0];
const blockContent = match.value[4];
const innerContent = target === "Tex" /* Tex */ ? toTex(this.AM, blockContent) : blockContent.trim();
content = content.replace(block, `$$$$
${innerContent}
$$$$`);
convertionRes.block++;
}
const inlineBlockIterator = content.matchAll(inlineReg);
while (!(match = inlineBlockIterator.next()).done) {
const block = match.value[0];
const blockContent = match.value[1];
const innerContent = target === "Tex" /* Tex */ ? toTex(this.AM, blockContent) : blockContent;
content = content.replace(block, `$$${innerContent.trim()}$$`);
convertionRes.inline++;
}
await this.app.vault.modify(file, content);
} catch (e) {
new import_obsidian5.Notice(String(e));
}
return convertionRes;
}
async postProcessorInline(el, _ctx) {
const nodeList = el.querySelectorAll("code");
if (!nodeList.length)
return;
for (let i = 0; i < nodeList.length; i++) {
const node = nodeList.item(i);
if (node.className.trim())
continue;
let { open, close } = this.settings.inline;
open = open.slice(1);
close = close.substring(0, close.length - 1);
const regex = new RegExp(`^${normalizeEscape(open)}(.*?)${normalizeEscape(close)}$`);
const matches = node.innerText.match(regex);
if (!matches)
continue;
const mathEl = (0, import_obsidian5.renderMath)(matches[1], false);
(0, import_obsidian5.finishRenderMath)();
node.replaceWith(mathEl);
}
}
};
/* nosourcemap */

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-asciimath",
"name": "asciimath",
"version": "0.7.8",
"version": "0.8.0",
"minAppVersion": "0.15.0",
"description": "Add asciimath support for Obsidian.",
"author": "widcardw",

View File

@@ -119,7 +119,7 @@
"mdCSS": "",
"scriptEngineSettings": {},
"defaultTrayMode": true,
"previousRelease": "2.15.1",
"previousRelease": "2.15.2",
"showReleaseNotes": true,
"showNewVersionNotification": true,
"latexBoilerplate": "\\color{blue}",

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.15.1",
"version": "2.15.2",
"minAppVersion": "1.5.7",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-markmind",
"name": "Markmind",
"version": "3.2.6",
"version": "3.2.7",
"minAppVersion": "0.9.12",
"description": "This is a mindmap , outline tool for obsidian.",
"author": "Mark",

View File

@@ -1406,6 +1406,25 @@ th {
background-color: transparent;
}
.theme-dark .mm-node .mm-node-content table tr,
.theme-dark .mm-node-note-container table tr {
background-color: #222;
border-top: 1px solid hsl(210deg 16.85% 50.93%);
}
.theme-dark .mm-node .mm-node-content table tr:nth-child(2n),
.theme-dark .mm-node-note-container table tr:nth-child(2n) {
background-color: #222;
border-top: 1px solid hsl(210deg 16.85% 50.93%);
}
.theme-dark .mm-node .mm-node-content table th,
.theme-dark .mm-node .mm-node-content table td,
.theme-dark .mm-node-note-container table th,
.theme-dark .mm-node-note-container table td {
border: 1px solid #3f3f3f;
}
/* .mm-node .mm-node-content img[align=right] {
padding-left: 20px;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-meta-bind-plugin",
"name": "Meta Bind",
"version": "1.4.5",
"version": "1.4.6",
"minAppVersion": "1.4.0",
"description": "Make your notes interactive with inline input fields, metadata displays, and buttons.",
"author": "Moritz Jung",

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-task-progress-bar",
"name": "Task Genius",
"version": "9.7.6",
"version": "9.8.7",
"minAppVersion": "0.15.2",
"description": "Comprehensive task management that includes progress bars, task status cycling, and advanced task tracking features.",
"author": "Boninall",

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,6 @@
{
"pluginList": [
"raeperd/obsidian-default-template",
"SkepticMystic/breadcrumbs",
"bhagyas/obsidian-postfix-plugin",
"AlexW00/obsidian-3d-graph",
@@ -7,7 +8,12 @@
"Stardusten/ob-table-enhancer/",
"SkepticMystic/nlp"
],
"pluginSubListFrozenVersion": [],
"pluginSubListFrozenVersion": [
{
"repo": "raeperd/obsidian-default-template",
"version": "latest"
}
],
"themesList": [
{
"repo": "Bluemoondragon07/Wikipedia-Theme",
@@ -27,5 +33,6 @@
"debuggingMode": true,
"notificationsEnabled": true,
"personalAccessToken": "",
"selectLatestPluginVersionByDefault": false,
"ribbonIconEnabled": true
}

View File

@@ -4622,6 +4622,7 @@ function NoteTemplateEngine(template, episode) {
return (0, import_obsidian9.htmlToMarkdown)(episode.content);
});
addTag("safetitle", replaceIllegalFileNameCharactersInString(episode.title));
addTag("stream", episode.streamUrl);
addTag("url", episode.url);
addTag("date", (format2) => episode.episodeDate ? window.moment(episode.episodeDate).format(format2 ?? "YYYY-MM-DD") : "");
addTag("podcast", replaceIllegalFileNameCharactersInString(episode.podcastName));

View File

@@ -1,7 +1,7 @@
{
"id": "podnotes",
"name": "PodNotes",
"version": "2.13.4",
"version": "2.14.0",
"minAppVersion": "0.15.9",
"description": "Helps you write notes on podcasts.",
"author": "Christian B. B. Houmann",

View File

@@ -549,7 +549,9 @@
"devMode": false,
"templateFolderPath": "templates",
"announceUpdates": true,
"version": "2.1.0",
"version": "2.3.0",
"globalVariables": {},
"onePageInputEnabled": false,
"disableOnlineFeatures": true,
"enableRibbonIcon": false,
"showCaptureNotification": true,

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "quickadd",
"name": "QuickAdd",
"version": "2.1.0",
"version": "2.3.0",
"minAppVersion": "1.6.0",
"description": "Quickly add new pages or content to your vault.",
"author": "Christian B. B. Houmann",

File diff suppressed because one or more lines are too long

View File

@@ -111,7 +111,7 @@ function displayText(link, settings) {
if (!link.value) {
return "<b>Please choose an attribute value.</b>";
}
return `<span class="data-link-icon data-link-text data-link-icon-after" data-link-${link.name}="${link.value}">Note</span> has attribute <b>${link.name}</b> ${matchPreview[link.match]} <b>${link.value}</b>.`;
return `<span class="data-link-icon data-link-text data-link-icon-after" data-link-${link.name}="${link.value}">Note</span> has attribute <b>${link.name.replace(/-/g, ' ')}</b> ${matchPreview[link.match]} <b>${link.value}</b>.`;
}
if (!link.value) {
return "<b>Please choose a path.</b>";
@@ -191,9 +191,10 @@ class CSSBuilderModal extends obsidian.Modal {
.setDesc("What attribute to target? Make sure to first add target attributes to the settings at the top!")
.addDropdown(dc => {
plugin.settings.targetAttributes.forEach((attribute) => {
dc.addOption(attribute, attribute);
if (attribute === cssLink.name) {
dc.setValue(attribute);
const dom_attribute = attribute.replace(/ /g, '-');
dc.addOption(dom_attribute, attribute);
if (dom_attribute === cssLink.name) {
dc.setValue(dom_attribute);
}
});
dc.onChange(name => {
@@ -612,6 +613,13 @@ function fetchTargetAttributesSync(app, settings, dest, addDataHref) {
else
this.plugin.registerEvent(this.app.metadataCache.on("dataview:api-ready", (api) => getResults(api)));
}
// Replace spaces with hyphens in the keys of new_props
const hyphenated_props = {};
for (const key in new_props) {
const hyphenatedKey = key.replace(/ /g, '-');
hyphenated_props[hyphenatedKey] = new_props[key];
}
new_props = hyphenated_props;
return new_props;
}
function setLinkNewProps(link, new_props) {
@@ -622,18 +630,19 @@ function setLinkNewProps(link, new_props) {
}
}
Object.keys(new_props).forEach(key => {
var _a;
const name = "data-link-" + key;
// Replace spaces with hyphens (v0.13.4+)
const dom_key = key.replace(/ /g, '-');
const name = "data-link-" + dom_key;
const newValue = new_props[key];
const curValue = link.getAttribute(name);
// Only update if value is different
if (!newValue || curValue != newValue) {
link.setAttribute("data-link-" + key, new_props[key]);
if (((_a = new_props[key]) === null || _a === void 0 ? void 0 : _a.startsWith) && (new_props[key].startsWith('http') || new_props[key].startsWith('data:'))) {
link.style.setProperty(`--data-link-${key}`, `url(${new_props[key]})`);
link.setAttribute(name, newValue);
if ((newValue === null || newValue === void 0 ? void 0 : newValue.startsWith) && (newValue.startsWith('http') || newValue.startsWith('data:'))) {
link.style.setProperty(`--data-link-${dom_key}`, `url(${newValue})`);
}
else {
link.style.setProperty(`--data-link-${key}`, new_props[key]);
link.style.setProperty(`--data-link-${dom_key}`, newValue);
}
}
});
@@ -658,8 +667,8 @@ function updateLinkExtraAttributes(app, settings, link, destName) {
}
}
}
function updateDivExtraAttributes(app, settings, link, destName, linkName) {
if (link.parentElement.getAttribute("class").contains('mod-collapsible'))
function updateDivExtraAttributes(app, settings, link, destName, linkName, filter_collapsible = false) {
if (filter_collapsible && link.parentElement.getAttribute("class").contains('mod-collapsible'))
return; // Bookmarks Folder
if (!linkName) {
linkName = link.textContent;
@@ -804,7 +813,7 @@ class SuperchargedLinksSettingTab extends obsidian.PluginSettingTab {
.setPlaceholder('Enter attributes as string, comma separated')
.setValue(this.plugin.settings.targetAttributes.join(', '))
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.targetAttributes = value.replace(/\s/g, '').split(',');
this.plugin.settings.targetAttributes = value.split(',').map(attr => attr.trim());
if (this.plugin.settings.targetAttributes.length === 1 && !this.plugin.settings.targetAttributes[0]) {
this.plugin.settings.targetAttributes = [];
}
@@ -1254,35 +1263,54 @@ class SuperchargedLinks extends obsidian.Plugin {
// TODO: This is an expensive operation that seems like it is called fairly frequently. Maybe we can do this more efficiently?
this.registerEvent(this.app.workspace.on("layout-change", () => this.initViewObservers(this)));
// DEBUG: When adding a new view, to get the proper id of that view, uncomment this and reload the plugin
this.app.workspace.iterateAllLeaves(leaf => {
console.log(leaf.view.getViewType());
});
// this.app.workspace.iterateAllLeaves(leaf => {
// console.log(leaf.view.getViewType());
// });
});
}
initViewObservers(plugin) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
// Reset observers
plugin.observers.forEach(([observer, type]) => {
observer.disconnect();
});
plugin.observers = [];
// Register new observers
// Register new observers for particular file panes
plugin.registerViewType('backlink', plugin, ".tree-item-inner", true);
plugin.registerViewType('outgoing-link', plugin, ".tree-item-inner", true);
plugin.registerViewType('search', plugin, ".tree-item-inner");
if ((_c = (_b = (_a = plugin.app) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.breadcrumbs) {
// console.log('Supercharged links: Enabling breadcrumbs support');
plugin.registerViewType('bc-matrix-view', plugin, 'span.internal-link');
plugin.registerViewType('BC-ducks', plugin, '.internal-link');
plugin.registerViewType('bc-tree-view', plugin, 'span.internal-link');
// Breadcrumbs codeblock support as suggested by https://github.com/mdelobelle/obsidian_supercharged_links/issues/248#issuecomment-3231706063
plugin.registerViewType('markdown', plugin, '.BC-page-views span.internal-link, .BC-codeblock-tree span.internal-link, .nodes a.internal-link');
}
plugin.registerViewType('graph-analysis', plugin, '.internal-link');
plugin.registerViewType('starred', plugin, '.nav-file-title-content');
plugin.registerViewType('file-explorer', plugin, '.nav-file-title-content');
if ((_f = (_e = (_d = plugin.app) === null || _d === void 0 ? void 0 : _d.plugins) === null || _e === void 0 ? void 0 : _e.plugins) === null || _f === void 0 ? void 0 : _f['folder-notes']) {
// console.log('Supercharged links: Enabling folder notes support');
plugin.registerViewType('file-explorer', plugin, '.has-folder-note .tree-item-inner');
}
plugin.registerViewType('recent-files', plugin, '.nav-file-title-content');
plugin.registerViewType('bookmarks', plugin, '.tree-item-inner');
plugin.registerViewType('bookmarks', plugin, '.tree-item-inner', false, true);
// @ts-ignore
if ((_k = (_j = (_h = (_g = plugin.app) === null || _g === void 0 ? void 0 : _g.internalPlugins) === null || _h === void 0 ? void 0 : _h.plugins) === null || _j === void 0 ? void 0 : _j.bases) === null || _k === void 0 ? void 0 : _k.enabled) {
// console.log('Supercharged links: Enabling bases support');
plugin.registerViewType('bases', plugin, '.internal-link');
// For embedded bases
plugin.registerViewType('markdown', plugin, 'div.bases-table-cell .internal-link');
}
if ((_o = (_m = (_l = plugin.app) === null || _l === void 0 ? void 0 : _l.plugins) === null || _m === void 0 ? void 0 : _m.plugins) === null || _o === void 0 ? void 0 : _o['similar-notes']) {
plugin.registerViewType('markdown', plugin, '.similar-notes-pane .tree-item-inner', true);
}
// If backlinks in editor is on
// @ts-ignore
if ((_f = (_e = (_d = (_c = (_b = (_a = plugin.app) === null || _a === void 0 ? void 0 : _a.internalPlugins) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.backlink) === null || _d === void 0 ? void 0 : _d.instance) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.backlinkInDocument) {
plugin.registerViewType('markdown', plugin, '.tree-item-inner', true);
if (((_s = (_r = (_q = (_p = plugin.app) === null || _p === void 0 ? void 0 : _p.internalPlugins) === null || _q === void 0 ? void 0 : _q.plugins) === null || _r === void 0 ? void 0 : _r.backlink) === null || _s === void 0 ? void 0 : _s.enabled) && ((_y = (_x = (_w = (_v = (_u = (_t = plugin.app) === null || _t === void 0 ? void 0 : _t.internalPlugins) === null || _u === void 0 ? void 0 : _u.plugins) === null || _v === void 0 ? void 0 : _v.backlink) === null || _w === void 0 ? void 0 : _w.instance) === null || _x === void 0 ? void 0 : _x.options) === null || _y === void 0 ? void 0 : _y.backlinkInDocument)) {
// console.log("Supercharged links: Enabling backlinks in document support");
plugin.registerViewType('markdown', plugin, '.embedded-backlinks .tree-item-inner', true);
}
const propertyLeaves = this.app.workspace.getLeavesOfType("file-properties");
for (let i = 0; i < propertyLeaves.length; i++) {
@@ -1314,7 +1342,7 @@ class SuperchargedLinks extends obsidian.Plugin {
(n.className.includes('modal-container') && plugin.settings.enableQuickSwitcher
// @ts-ignore
|| n.className.includes('suggestion-container') && plugin.settings.enableSuggestor)) {
let selector = ".suggestion-title, .suggestion-note, .another-quick-switcher__item__title, .omnisearch-result__title";
let selector = ".suggestion-title, .suggestion-note, .another-quick-switcher__item__title, .omnisearch-result__title > span";
// @ts-ignore
if (n.className.includes('suggestion-container')) {
selector = ".suggestion-title, .suggestion-note";
@@ -1328,7 +1356,7 @@ class SuperchargedLinks extends obsidian.Plugin {
}));
this.modalObservers.last().observe(doc.body, config);
}
registerViewType(viewTypeName, plugin, selector, updateDynamic = false) {
registerViewType(viewTypeName, plugin, selector, updateDynamic = false, filter_collapsible = false) {
const leaves = this.app.workspace.getLeavesOfType(viewTypeName);
// if (leaves.length > 1) {
for (let i = 0; i < leaves.length; i++) {
@@ -1337,7 +1365,7 @@ class SuperchargedLinks extends obsidian.Plugin {
plugin._watchContainerDynamic(viewTypeName + i, container, plugin, selector);
}
else {
plugin._watchContainer(viewTypeName + i, container, plugin, selector);
plugin._watchContainer(viewTypeName + i, container, plugin, selector, filter_collapsible);
}
}
// }
@@ -1353,7 +1381,7 @@ class SuperchargedLinks extends obsidian.Plugin {
// }
// }
}
updateContainer(container, plugin, selector) {
updateContainer(container, plugin, selector, filter_collapsible = false) {
if (!plugin.settings.enableBacklinks && container.getAttribute("data-type") !== "file-explorer")
return;
if (!plugin.settings.enableFileList && container.getAttribute("data-type") === "file-explorer")
@@ -1361,7 +1389,7 @@ class SuperchargedLinks extends obsidian.Plugin {
const nodes = container.findAll(selector);
for (let i = 0; i < nodes.length; ++i) {
const el = nodes[i];
updateDivExtraAttributes(plugin.app, plugin.settings, el, "");
updateDivExtraAttributes(plugin.app, plugin.settings, el, "", undefined, filter_collapsible);
}
}
removeFromContainer(container, selector) {
@@ -1371,16 +1399,16 @@ class SuperchargedLinks extends obsidian.Plugin {
clearExtraAttributes(el);
}
}
_watchContainer(viewType, container, plugin, selector) {
_watchContainer(viewType, container, plugin, selector, filter_collapsible = false) {
let observer = new MutationObserver((records, _) => {
plugin.updateContainer(container, plugin, selector);
plugin.updateContainer(container, plugin, selector, filter_collapsible);
});
observer.observe(container, { subtree: true, childList: true, attributes: false });
if (viewType) {
plugin.observers.push([observer, viewType, selector]);
}
}
_watchContainerDynamic(viewType, container, plugin, selector, own_class = 'tree-item-inner', parent_class = 'tree-item') {
_watchContainerDynamic(viewType, container, plugin, selector, parent_class = 'tree-item') {
// Used for efficient updating of the backlinks panel
// Only loops through newly added DOM nodes instead of changing all of them
if (!plugin.settings.enableBacklinks)
@@ -1392,7 +1420,7 @@ class SuperchargedLinks extends obsidian.Plugin {
if ('className' in n) {
// @ts-ignore
if (n.className.includes && typeof n.className.includes === 'function' && n.className.includes(parent_class)) {
const fileDivs = n.getElementsByClassName(own_class);
const fileDivs = n.findAll(selector);
for (let i = 0; i < fileDivs.length; ++i) {
const link = fileDivs[i];
updateDivExtraAttributes(plugin.app, plugin.settings, link, "");

View File

@@ -1,7 +1,7 @@
{
"id": "supercharged-links-obsidian",
"name": "Supercharged Links",
"version": "0.13.0",
"version": "0.13.5",
"minAppVersion": "1.9.10",
"description": "Add properties and menu options to links and style them!",
"author": "mdelobelle & Emile",

File diff suppressed because one or more lines are too long

View File

@@ -4,5 +4,5 @@
"description": "Paste URL \"into\" selected text to create markdown links.",
"isDesktopOnly": false,
"js": "main.js",
"version": "1.11.3"
"version": "1.11.4"
}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "various-complements",
"name": "Various Complements",
"version": "10.7.2",
"version": "10.8.0",
"minAppVersion": "0.16.0",
"description": "This plugin enables you to complete words like the auto-completion of IDE",
"author": "tadashi-aikawa",

View File

@@ -1,5 +1,5 @@
---
aliases:
tags:
up:
tags:
aliases:
---