update
This commit is contained in:
parent
a56210eacb
commit
5393bda45b
3
.obsidian/appearance.json
vendored
3
.obsidian/appearance.json
vendored
@ -16,7 +16,8 @@
|
||||
"checkboxes",
|
||||
"dataview",
|
||||
"tabs_on_multiple_rown",
|
||||
"compact_tabs"
|
||||
"compact_tabs",
|
||||
"popup_preview_size"
|
||||
],
|
||||
"interfaceFontFamily": "CMU Sans Serif,FiraCode Nerd Font",
|
||||
"textFontFamily": "CMU Sans Serif,FiraCode Nerd Font",
|
||||
|
6
.obsidian/community-plugins.json
vendored
6
.obsidian/community-plugins.json
vendored
@ -39,5 +39,9 @@
|
||||
"obsidian-zoom",
|
||||
"zotlit",
|
||||
"obsidian-style-settings",
|
||||
"obsidian-hider"
|
||||
"obsidian-hider",
|
||||
"inline-math",
|
||||
"quick-preview",
|
||||
"obsidian42-brat",
|
||||
"obsidian-vault-statistics-plugin"
|
||||
]
|
10
.obsidian/graph.json
vendored
10
.obsidian/graph.json
vendored
@ -120,16 +120,16 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"collapse-display": true,
|
||||
"collapse-display": false,
|
||||
"showArrow": false,
|
||||
"textFadeMultiplier": 0,
|
||||
"nodeSizeMultiplier": 1.33716227213542,
|
||||
"lineSizeMultiplier": 1.19619954427083,
|
||||
"nodeSizeMultiplier": 0.827272727272727,
|
||||
"lineSizeMultiplier": 1.108,
|
||||
"collapse-forces": true,
|
||||
"centerStrength": 0.1812744140625,
|
||||
"repelStrength": 6.39485677083333,
|
||||
"linkStrength": 1,
|
||||
"linkDistance": 30,
|
||||
"scale": 0.07115186299616377,
|
||||
"close": true
|
||||
"scale": 0.05607792726105202,
|
||||
"close": false
|
||||
}
|
5
.obsidian/plugins/inline-math/data.json
vendored
Normal file
5
.obsidian/plugins/inline-math/data.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"disableInTable": false,
|
||||
"disableDecorations": false,
|
||||
"disableAtomicRanges": false
|
||||
}
|
451
.obsidian/plugins/inline-math/main.js
vendored
Normal file
451
.obsidian/plugins/inline-math/main.js
vendored
Normal file
@ -0,0 +1,451 @@
|
||||
/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/main.ts
|
||||
var main_exports = {};
|
||||
__export(main_exports, {
|
||||
default: () => NoMoreFlicker
|
||||
});
|
||||
module.exports = __toCommonJS(main_exports);
|
||||
var import_obsidian2 = require("obsidian");
|
||||
|
||||
// src/settings.ts
|
||||
var import_obsidian = require("obsidian");
|
||||
var DEFAULT_SETTINGS = {
|
||||
disableInTable: false,
|
||||
disableDecorations: false,
|
||||
disableAtomicRanges: false
|
||||
};
|
||||
var NoMoreFlickerSettingTab = class extends import_obsidian.PluginSettingTab {
|
||||
constructor(app, plugin) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
display() {
|
||||
const { containerEl } = this;
|
||||
containerEl.empty();
|
||||
new import_obsidian.Setting(containerEl).setName("Disable in tables").setDesc("If turned on, braces won't be inserted in tables. Decorations & atomic ranges are enabled regardless of this setting.").addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings.disableInTable).onChange(async (disable) => {
|
||||
this.plugin.settings.disableInTable = disable;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
containerEl.createEl("h4", { text: "Debug mode" });
|
||||
new import_obsidian.Setting(containerEl).setName("Disable decorations").setDesc("If turned on, decorations to hide braces adjacent to dollar signs are disabled.").addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings.disableDecorations).onChange(async (disable) => {
|
||||
this.plugin.settings.disableDecorations = disable;
|
||||
this.plugin.remakeViewPlugin();
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian.Setting(containerEl).setName("Disable atomic ranges").setDesc(createFragment((el) => {
|
||||
el.createSpan({ text: 'If turned on, atomic ranges to treat each of "' });
|
||||
el.createEl("code", { text: "${} " });
|
||||
el.createSpan({ text: '" or "' });
|
||||
el.createEl("code", { text: " {}$" });
|
||||
el.createSpan({ text: '" as one character are disabled.' });
|
||||
})).addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings.disableAtomicRanges).onChange(async (disable) => {
|
||||
this.plugin.settings.disableAtomicRanges = disable;
|
||||
this.plugin.remakeViewPlugin();
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian.Setting(containerEl).addButton((button) => {
|
||||
button.setButtonText("Restore defaults").onClick(async () => {
|
||||
this.plugin.settings = Object.assign({}, DEFAULT_SETTINGS);
|
||||
await this.plugin.saveSettings();
|
||||
this.display();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// src/cleaner.ts
|
||||
var import_language2 = require("@codemirror/language");
|
||||
|
||||
// src/utils.ts
|
||||
var import_language = require("@codemirror/language");
|
||||
var INLINE_MATH_BEGIN = "formatting_formatting-math_formatting-math-begin_keyword_math";
|
||||
var MATH_END = "formatting_formatting-math_formatting-math-end_keyword_math_math-";
|
||||
function nodeText(node, state) {
|
||||
return state.sliceDoc(node.from, node.to);
|
||||
}
|
||||
function isInlineMathBegin(node, state) {
|
||||
return node.name == INLINE_MATH_BEGIN && nodeText(node, state) == "$";
|
||||
}
|
||||
function isInlineMathEnd(node, state) {
|
||||
return node.name == MATH_END && nodeText(node, state) == "$";
|
||||
}
|
||||
function selectionSatisfies(state, predicate) {
|
||||
let ret = false;
|
||||
const tree = (0, import_language.syntaxTree)(state);
|
||||
for (const { from, to } of state.selection.ranges) {
|
||||
const line = state.doc.lineAt(from);
|
||||
tree.iterate({
|
||||
from: line.from,
|
||||
to: line.to,
|
||||
enter: (node) => {
|
||||
if (predicate(node)) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// src/cleaner.ts
|
||||
function cleaner(view) {
|
||||
const changes = [];
|
||||
(0, import_language2.syntaxTree)(view.state).iterate({
|
||||
enter(node) {
|
||||
if (isInlineMathBegin(node, view.state)) {
|
||||
if (view.state.sliceDoc(node.to, node.to + 3) == "{} ") {
|
||||
changes.push({ from: node.to, to: node.to + 3 });
|
||||
}
|
||||
} else if (isInlineMathEnd(node, view.state)) {
|
||||
if (view.state.sliceDoc(node.from - 3, node.from) == " {}") {
|
||||
changes.push({ from: node.from - 3, to: node.from });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
view.dispatch({ changes });
|
||||
}
|
||||
function cleanerCallback(editor) {
|
||||
const view = editor.cm;
|
||||
if (view) {
|
||||
cleaner(view);
|
||||
}
|
||||
}
|
||||
|
||||
// src/decoration-and-atomic-range.ts
|
||||
var import_state = require("@codemirror/state");
|
||||
var import_view = require("@codemirror/view");
|
||||
var import_language3 = require("@codemirror/language");
|
||||
var DummyRangeValue = class extends import_state.RangeValue {
|
||||
};
|
||||
var createViewPlugin = (plugin) => import_view.ViewPlugin.fromClass(
|
||||
class {
|
||||
constructor(view) {
|
||||
this.impl(view);
|
||||
}
|
||||
update(update) {
|
||||
this.impl(update.view);
|
||||
}
|
||||
impl(view) {
|
||||
const decorationBulder = new import_state.RangeSetBuilder();
|
||||
const atomicRangeBulder = new import_state.RangeSetBuilder();
|
||||
const tree = (0, import_language3.syntaxTree)(view.state);
|
||||
for (const { from, to } of view.visibleRanges) {
|
||||
tree.iterate({
|
||||
from,
|
||||
to,
|
||||
enter(node) {
|
||||
if (isInlineMathBegin(node, view.state)) {
|
||||
if (view.state.sliceDoc(node.to, node.to + 3) == "{} ") {
|
||||
decorationBulder.add(
|
||||
node.to,
|
||||
node.to + 3,
|
||||
import_view.Decoration.replace({})
|
||||
);
|
||||
atomicRangeBulder.add(
|
||||
node.from,
|
||||
node.to + 3,
|
||||
new DummyRangeValue()
|
||||
);
|
||||
}
|
||||
} else if (isInlineMathEnd(node, view.state)) {
|
||||
if (view.state.sliceDoc(node.from - 3, node.from) == " {}") {
|
||||
decorationBulder.add(
|
||||
node.from - 3,
|
||||
node.from,
|
||||
import_view.Decoration.replace({})
|
||||
);
|
||||
atomicRangeBulder.add(
|
||||
node.from - 3,
|
||||
node.to,
|
||||
new DummyRangeValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
this.decorations = decorationBulder.finish();
|
||||
this.atomicRanges = atomicRangeBulder.finish();
|
||||
}
|
||||
},
|
||||
{
|
||||
decorations: (instance) => plugin.settings.disableDecorations ? import_view.Decoration.none : instance.decorations,
|
||||
provide: (viewPlugin) => import_view.EditorView.atomicRanges.of((view) => {
|
||||
var _a, _b;
|
||||
return plugin.settings.disableAtomicRanges ? import_state.RangeSet.empty : (_b = (_a = view.plugin(viewPlugin)) == null ? void 0 : _a.atomicRanges) != null ? _b : import_state.RangeSet.empty;
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
// src/transaction-filter.ts
|
||||
var import_state3 = require("@codemirror/state");
|
||||
var import_language5 = require("@codemirror/language");
|
||||
|
||||
// src/latex-suite.ts
|
||||
var import_state2 = require("@codemirror/state");
|
||||
var import_language4 = require("@codemirror/language");
|
||||
function handleLatexSuite(tr, plugin) {
|
||||
if (tr.docChanged && !tr.selection) {
|
||||
const changes = handleLatexSuiteBoxing(tr.startState, tr.changes);
|
||||
if (changes) {
|
||||
plugin._latexSuiteBoxing = true;
|
||||
return { changes };
|
||||
}
|
||||
} else if (!tr.docChanged && tr.selection) {
|
||||
if (plugin._latexSuiteBoxing) {
|
||||
plugin._latexSuiteBoxing = false;
|
||||
return { selection: { anchor: tr.selection.main.anchor - 3 } };
|
||||
} else {
|
||||
const selection = handleLatexSuiteTabout(tr.startState, tr.selection);
|
||||
return [tr, { selection }];
|
||||
}
|
||||
}
|
||||
}
|
||||
function handleLatexSuiteTabout(state, newSelection) {
|
||||
const tree = (0, import_language4.syntaxTree)(state);
|
||||
const doc = state.doc.toString();
|
||||
const newRanges = [];
|
||||
for (let i = 0; i < newSelection.ranges.length; i++) {
|
||||
const range = newSelection.ranges[i];
|
||||
const indexNextDollar = doc.indexOf("$", range.to);
|
||||
if (indexNextDollar >= 0) {
|
||||
const node = tree.cursorAt(indexNextDollar, 1).node;
|
||||
if (range.from === range.to && range.to === indexNextDollar && isInlineMathEnd(node, state) && state.sliceDoc(node.from - 3, node.from) === " {}") {
|
||||
newRanges.push(import_state2.EditorSelection.cursor(node.to));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
newRanges.push(range);
|
||||
}
|
||||
return import_state2.EditorSelection.create(newRanges, newSelection.mainIndex);
|
||||
}
|
||||
function handleLatexSuiteBoxing(state, changes) {
|
||||
const tree = (0, import_language4.syntaxTree)(state);
|
||||
let changeToReplace;
|
||||
changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
|
||||
if (inserted.toString() === "\\boxed{" + state.sliceDoc(fromA, toA) + "}") {
|
||||
const nodeFrom = tree.cursorAt(fromA, -1).node;
|
||||
const nodeTo = tree.cursorAt(toA, 1).node;
|
||||
if (isInlineMathBegin(nodeFrom, state) && isInlineMathEnd(nodeTo, state)) {
|
||||
if (state.sliceDoc(fromA, fromA + 3) === "{} " && state.sliceDoc(toA - 3, toA) === " {}") {
|
||||
changeToReplace = { from: fromA, to: toA, insert: "\\boxed{" + state.sliceDoc(fromA + 3, toA - 3) + "}" };
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return changeToReplace;
|
||||
}
|
||||
|
||||
// src/transaction-filter.ts
|
||||
var makeTransactionFilter = (plugin) => {
|
||||
return import_state3.EditorState.transactionFilter.of((tr) => {
|
||||
var _a;
|
||||
if (plugin.shouldIgnore(tr.startState))
|
||||
return tr;
|
||||
const userEvent = (_a = tr.annotation(import_state3.Transaction.userEvent)) == null ? void 0 : _a.split(".")[0];
|
||||
if (userEvent === "input") {
|
||||
const changes = getChangesForInsertion(tr.startState, tr.changes);
|
||||
return [tr, { changes }];
|
||||
} else if (userEvent === "select" && tr.selection) {
|
||||
const changes = getChangesForSelection(tr.startState, tr.selection);
|
||||
return [tr, { changes }];
|
||||
} else if (userEvent === "delete") {
|
||||
const changes = getChangesForDeletion(tr.startState);
|
||||
return [tr, { changes }];
|
||||
} else if (userEvent === void 0) {
|
||||
const spec = handleLatexSuite(tr, plugin);
|
||||
if (spec)
|
||||
return spec;
|
||||
}
|
||||
return tr;
|
||||
});
|
||||
};
|
||||
function getChangesForDeletion(state) {
|
||||
const tree = (0, import_language5.syntaxTree)(state);
|
||||
const doc = state.doc.toString();
|
||||
const changes = [];
|
||||
for (const range of state.selection.ranges) {
|
||||
const from = range.empty ? range.from - 4 : range.from;
|
||||
const to = range.to;
|
||||
const text = state.sliceDoc(from, to);
|
||||
const index = text.lastIndexOf("$");
|
||||
if (index == -1) {
|
||||
continue;
|
||||
}
|
||||
const indexNextDollar = doc.indexOf("$", from + index + 1);
|
||||
const indexPrevDollar = doc.lastIndexOf("$", from);
|
||||
tree.iterate({
|
||||
from: indexPrevDollar,
|
||||
to: indexNextDollar >= 0 ? indexNextDollar : to,
|
||||
enter(node) {
|
||||
if (isInlineMathBegin(node, state) && state.sliceDoc(node.to, node.to + 3) == "{} ") {
|
||||
changes.push({ from: node.to, to: node.to + 3 });
|
||||
} else if (isInlineMathEnd(node, state) && state.sliceDoc(node.from - 3, node.from) == " {}") {
|
||||
changes.push({ from: node.from - 3, to: node.from });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
function getChangesForInsertion(state, changes) {
|
||||
const tree = (0, import_language5.syntaxTree)(state);
|
||||
const doc = state.doc.toString();
|
||||
const changesToAdd = [];
|
||||
const beginningOfChanges = /* @__PURE__ */ new Map();
|
||||
changes.iterChangedRanges((fromA, toA, fromB, toB) => {
|
||||
beginningOfChanges.set(fromA, true);
|
||||
});
|
||||
for (const range of state.selection.ranges) {
|
||||
if (range.from >= 1) {
|
||||
const indexPrevDollar = doc.lastIndexOf("$", range.from - 1);
|
||||
if (indexPrevDollar >= 0) {
|
||||
const node = tree.cursorAt(indexPrevDollar, 1).node;
|
||||
if (isInlineMathBegin(node, state)) {
|
||||
if (indexPrevDollar === range.from - 1 && beginningOfChanges.has(range.from)) {
|
||||
changesToAdd.push({ from: indexPrevDollar, to: range.from, insert: "${} " });
|
||||
continue;
|
||||
}
|
||||
if (state.sliceDoc(node.to, node.to + 3) !== "{} ") {
|
||||
changesToAdd.push({ from: node.to, insert: "{} " });
|
||||
}
|
||||
} else if (isInlineMathEnd(node, state) && state.sliceDoc(node.from - 3, node.from) === " {}") {
|
||||
const openIndex = doc.lastIndexOf("${} ", node.from - 3);
|
||||
changesToAdd.push({ from: openIndex + 1, to: node.from, insert: doc.slice(openIndex + 4, node.from - 3).trim() });
|
||||
}
|
||||
}
|
||||
}
|
||||
const indexNextDollar = doc.indexOf("$", range.to);
|
||||
if (indexNextDollar >= 0) {
|
||||
const node = tree.cursorAt(indexNextDollar, 1).node;
|
||||
if (isInlineMathEnd(node, state)) {
|
||||
if (state.sliceDoc(node.from - 3, node.from) !== " {}") {
|
||||
changesToAdd.push({ from: node.from, insert: " {}" });
|
||||
}
|
||||
} else if (isInlineMathBegin(node, state) && state.sliceDoc(node.to, node.to + 3) === "{} ") {
|
||||
const closeIndex = doc.indexOf(" {}$", node.to + 3);
|
||||
if (closeIndex >= 0) {
|
||||
changesToAdd.push({ from: node.to, to: closeIndex + 3, insert: doc.slice(node.to + 3, closeIndex).trim() });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return changesToAdd;
|
||||
}
|
||||
function getChangesForSelection(state, newSelection) {
|
||||
const tree = (0, import_language5.syntaxTree)(state);
|
||||
const doc = state.doc.toString();
|
||||
const changes = [];
|
||||
for (let i = 0; i < newSelection.ranges.length; i++) {
|
||||
const range = newSelection.ranges[i];
|
||||
const indexNextDollar = doc.indexOf("$", range.to);
|
||||
const indexPrevDollar = doc.lastIndexOf("$", range.from - 1);
|
||||
if (indexPrevDollar >= 0) {
|
||||
const node = tree.cursorAt(indexPrevDollar, 1).node;
|
||||
if (isInlineMathEnd(node, state) && state.sliceDoc(node.from - 3, node.from) === " {}") {
|
||||
const openIndex = doc.lastIndexOf("${} ", node.from - 3);
|
||||
changes.push({ from: openIndex + 1, to: node.from, insert: doc.slice(openIndex + 4, node.from - 3).trim() });
|
||||
}
|
||||
}
|
||||
if (indexNextDollar >= 0) {
|
||||
const node = tree.cursorAt(indexNextDollar, 1).node;
|
||||
if (isInlineMathBegin(node, state) && state.sliceDoc(node.to, node.to + 3) === "{} ") {
|
||||
const closeIndex = doc.indexOf(" {}$", node.to + 3);
|
||||
if (closeIndex >= 0) {
|
||||
changes.push({ from: node.to, to: closeIndex + 3, insert: doc.slice(node.to + 3, closeIndex).trim() });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
|
||||
// src/main.ts
|
||||
var NoMoreFlicker = class extends import_obsidian2.Plugin {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
/**
|
||||
* a view plugin that provides
|
||||
* - decorations to hide braces adjacent to "$"s
|
||||
* - & atomic ranges to treat each of "${} " and " {}$" as one character
|
||||
*/
|
||||
this.viewPlugin = [];
|
||||
/**
|
||||
* Indicates whether the previous transaction was the first of the two transactions
|
||||
* (1. text replacement & 2. cursor position change) that Latex Suite's "box current equation"
|
||||
* command produces or not. See the commend in the makeTransactionFilter() method for details.
|
||||
*/
|
||||
this._latexSuiteBoxing = false;
|
||||
}
|
||||
async onload() {
|
||||
await this.loadSettings();
|
||||
await this.saveSettings();
|
||||
this.addSettingTab(new NoMoreFlickerSettingTab(this.app, this));
|
||||
this.registerEditorExtension(this.viewPlugin);
|
||||
this.remakeViewPlugin();
|
||||
this.registerEditorExtension(makeTransactionFilter(this));
|
||||
this.addCommand({
|
||||
id: "clean",
|
||||
name: "Clean up braces in this note",
|
||||
editorCallback: cleanerCallback
|
||||
});
|
||||
this.addCommand({
|
||||
id: "clean-all",
|
||||
name: "Clean up braces in all the opened notes",
|
||||
editorCallback: this.cleanAllMarkdownViews.bind(this)
|
||||
});
|
||||
}
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
shouldIgnore(state) {
|
||||
return this.settings.disableInTable && selectionSatisfies(
|
||||
state,
|
||||
(node) => node.name.includes("HyperMD-table") || node.name.includes("hmd-table")
|
||||
);
|
||||
}
|
||||
cleanAllMarkdownViews() {
|
||||
this.app.workspace.iterateAllLeaves((leaf) => {
|
||||
if (leaf.view instanceof import_obsidian2.MarkdownView) {
|
||||
cleanerCallback(leaf.view.editor);
|
||||
}
|
||||
});
|
||||
}
|
||||
remakeViewPlugin() {
|
||||
this.viewPlugin.length = 0;
|
||||
this.viewPlugin.push(createViewPlugin(this));
|
||||
this.app.workspace.updateOptions();
|
||||
}
|
||||
};
|
11
.obsidian/plugins/inline-math/manifest.json
vendored
Normal file
11
.obsidian/plugins/inline-math/manifest.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "inline-math",
|
||||
"name": "No more flickering inline math",
|
||||
"version": "0.3.4",
|
||||
"minAppVersion": "1.3.0",
|
||||
"description": "No longer disturbed by flickering inline math in Obsidian.",
|
||||
"author": "Ryota Ushio",
|
||||
"authorUrl": "https://github.com/RyotaUshio",
|
||||
"fundingUrl": "https://www.buymeacoffee.com/ryotaushio",
|
||||
"isDesktopOnly": false
|
||||
}
|
467
.obsidian/plugins/math-in-callout/main.js
vendored
Normal file
467
.obsidian/plugins/math-in-callout/main.js
vendored
Normal file
@ -0,0 +1,467 @@
|
||||
/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/main.ts
|
||||
var main_exports = {};
|
||||
__export(main_exports, {
|
||||
default: () => MathInCalloutPlugin
|
||||
});
|
||||
module.exports = __toCommonJS(main_exports);
|
||||
var import_obsidian3 = require("obsidian");
|
||||
|
||||
// src/decorations.ts
|
||||
var import_state2 = require("@codemirror/state");
|
||||
var import_language2 = require("@codemirror/language");
|
||||
var import_view = require("@codemirror/view");
|
||||
var import_obsidian = require("obsidian");
|
||||
|
||||
// src/quote-field.ts
|
||||
var import_language = require("@codemirror/language");
|
||||
var import_state = require("@codemirror/state");
|
||||
var QuoteInfo = class extends import_state.RangeValue {
|
||||
/**
|
||||
* @param level The level of the blockquote/callout (i.e. the number of ">"s).
|
||||
* @param isBaseCallout True if this is a callout or this is nested inside a callout of level 1.
|
||||
*/
|
||||
constructor(level, isBaseCallout) {
|
||||
super();
|
||||
this.level = level;
|
||||
this.isBaseCallout = isBaseCallout;
|
||||
this.pattern = this.level > 0 ? new RegExp(`^( {0,3}>){${this.level}}`) : null;
|
||||
}
|
||||
eq(other) {
|
||||
return this.level === other.level && this.isBaseCallout === other.isBaseCallout;
|
||||
}
|
||||
/** Remove ">"s that is misrecognized as inequality signs. */
|
||||
correctMath(math) {
|
||||
if (!this.pattern)
|
||||
return math;
|
||||
const lines = math.split("\n");
|
||||
return lines.map((line) => {
|
||||
const match = line.match(this.pattern);
|
||||
return match ? line.slice(match[0].length) : line;
|
||||
}).join("\n");
|
||||
}
|
||||
getBlockquoteBorderPositions(state, from, to) {
|
||||
const positions = [];
|
||||
const lineBegin = state.doc.lineAt(from);
|
||||
const lineEnd = state.doc.lineAt(to);
|
||||
for (let i = lineBegin.number; i <= lineEnd.number; i++) {
|
||||
const line = state.doc.line(i);
|
||||
let start = 0;
|
||||
for (let i2 = 0; i2 < this.level; i2++) {
|
||||
const index = line.text.indexOf(">", start);
|
||||
if (index === -1)
|
||||
continue;
|
||||
positions.push({ pos: index + line.from, first: i2 === 0 });
|
||||
start = index + 1;
|
||||
}
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
};
|
||||
var quoteInfoField = import_state.StateField.define({
|
||||
create(state) {
|
||||
return parseBlockquotes(state);
|
||||
},
|
||||
update(prev, tr) {
|
||||
return tr.docChanged ? parseBlockquotes(tr.state) : prev;
|
||||
}
|
||||
});
|
||||
function parseBlockquotes(state) {
|
||||
const tree = (0, import_language.syntaxTree)(state);
|
||||
const builder = new import_state.RangeSetBuilder();
|
||||
let level = 0;
|
||||
let from = -1;
|
||||
let isBaseCallout = false;
|
||||
for (let i = 1; i <= state.doc.lines; i++) {
|
||||
const line = state.doc.line(i);
|
||||
const match = line.text.match(/^( {0,3}>)+/);
|
||||
const newLevel = match ? match[0].split(">").length - 1 : 0;
|
||||
if (newLevel !== level) {
|
||||
if (level === 0 && newLevel === 1) {
|
||||
isBaseCallout = tree.cursorAt(line.from, 1).node.name.contains("-callout");
|
||||
}
|
||||
if (level > 0 && from >= 0) {
|
||||
builder.add(from, line.from, new QuoteInfo(level, isBaseCallout));
|
||||
}
|
||||
level = newLevel;
|
||||
from = line.from;
|
||||
}
|
||||
}
|
||||
if (level > 0 && from >= 0) {
|
||||
builder.add(from, state.doc.length, new QuoteInfo(level, isBaseCallout));
|
||||
}
|
||||
return builder.finish();
|
||||
}
|
||||
|
||||
// src/utils.ts
|
||||
function getQuoteInfo(state, pos) {
|
||||
const field = state.field(quoteInfoField, false);
|
||||
if (!field)
|
||||
return null;
|
||||
const { from, to, value } = field.iter(pos);
|
||||
if (from <= pos && pos <= to)
|
||||
return value;
|
||||
return null;
|
||||
}
|
||||
function hasOverlap(range, start, to) {
|
||||
return range.from <= to && range.to >= start;
|
||||
}
|
||||
function rangesHaveOverlap(ranges, start, to) {
|
||||
for (const range of ranges) {
|
||||
if (hasOverlap(range, start, to))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// src/decorations.ts
|
||||
var createCalloutDecorator = (BuiltInMathWidget) => import_state2.StateField.define({
|
||||
create() {
|
||||
return import_view.Decoration.none;
|
||||
},
|
||||
update(prev, tr) {
|
||||
const { state } = tr;
|
||||
const view = state.field(import_obsidian.editorEditorField);
|
||||
if (view.composing)
|
||||
return prev.map(tr.changes);
|
||||
const isSourceMode = !state.field(import_obsidian.editorLivePreviewField);
|
||||
const doc = state.doc;
|
||||
const ranges = view.hasFocus ? state.selection.ranges : [];
|
||||
const tree = (0, import_language2.syntaxTree)(state);
|
||||
const decorations = [];
|
||||
const makeDeco = (decorationSpec, from, to) => {
|
||||
if (decorationSpec.block && to === doc.length)
|
||||
decorationSpec.inclusiveEnd = false;
|
||||
return import_view.Decoration.replace(decorationSpec);
|
||||
};
|
||||
let mathBegin = -1;
|
||||
let mathContentBegin = -1;
|
||||
let block = false;
|
||||
tree.iterate({
|
||||
enter(node) {
|
||||
if (node.name.contains("formatting-math-begin")) {
|
||||
mathBegin = node.from;
|
||||
mathContentBegin = node.to;
|
||||
block = node.name.contains("math-block");
|
||||
} else if (mathBegin !== -1) {
|
||||
if (node.name.contains("formatting-math-end")) {
|
||||
const mathContentEnd = node.from;
|
||||
const mathEnd = node.to;
|
||||
let math = doc.sliceString(mathContentBegin, mathContentEnd);
|
||||
const quote = getQuoteInfo(state, mathContentBegin);
|
||||
if (quote)
|
||||
math = quote.correctMath(math);
|
||||
const widget = new BuiltInMathWidget(math, block);
|
||||
if (quote)
|
||||
widget.markAsCorrected();
|
||||
widget.setPos(
|
||||
block && math.startsWith("\n") ? mathContentBegin + 1 : mathContentBegin,
|
||||
block && math.endsWith("\n") ? mathContentEnd - 1 : mathContentEnd
|
||||
);
|
||||
const overlap = rangesHaveOverlap(ranges, mathBegin, mathEnd);
|
||||
if (block && quote && quote.level > 0) {
|
||||
if (isSourceMode || quote.isBaseCallout || overlap) {
|
||||
const lineBegin = state.doc.lineAt(mathBegin);
|
||||
const lineEnd = state.doc.lineAt(mathEnd);
|
||||
for (let i = lineBegin.number; i <= lineEnd.number; i++) {
|
||||
const line = state.doc.line(i);
|
||||
decorations.push(
|
||||
import_view.Decoration.line({ class: "HyperMD-quote" }).range(line.from, line.from)
|
||||
);
|
||||
const transparent = !isSourceMode && !rangesHaveOverlap(ranges, line.from, line.to);
|
||||
let start = 0;
|
||||
for (let i2 = 0; i2 < quote.level; i2++) {
|
||||
const index = line.text.indexOf(">", start);
|
||||
if (index === -1)
|
||||
continue;
|
||||
const pos = index + line.from;
|
||||
if (i2 === 0) {
|
||||
decorations.push(
|
||||
import_view.Decoration.mark({ class: transparent ? "cm-transparent" : "cm-quote cm-formatting-quote" }).range(pos, pos + 1)
|
||||
);
|
||||
} else {
|
||||
decorations.push(
|
||||
import_view.Decoration.mark({ class: transparent ? "cm-blockquote-border cm-transparent" : "cm-quote cm-formatting-quote" }).range(pos, pos + 1)
|
||||
);
|
||||
}
|
||||
start = index + 1;
|
||||
}
|
||||
}
|
||||
if (lineEnd.from < mathContentEnd && lineEnd.text.slice(0, mathContentEnd - lineEnd.from).split(">").every((s) => !s.trim())) {
|
||||
decorations.push(
|
||||
import_view.Decoration.mark({ class: "cancel-cm-math" }).range(lineEnd.from, mathContentEnd)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSourceMode && (quote == null ? void 0 : quote.isBaseCallout)) {
|
||||
if (overlap) {
|
||||
if (block) {
|
||||
decorations.push(
|
||||
import_view.Decoration.widget({
|
||||
widget,
|
||||
block: false,
|
||||
side: 1
|
||||
}).range(mathEnd, mathEnd)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
decorations.push(
|
||||
makeDeco({
|
||||
widget,
|
||||
block: false
|
||||
}, mathBegin, mathEnd).range(mathBegin, mathEnd)
|
||||
);
|
||||
}
|
||||
}
|
||||
mathBegin = -1;
|
||||
mathContentBegin = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return import_view.Decoration.set(decorations, true);
|
||||
},
|
||||
provide(field) {
|
||||
return import_view.EditorView.decorations.from(field);
|
||||
}
|
||||
});
|
||||
|
||||
// src/patch-widget-type.ts
|
||||
var import_view2 = require("@codemirror/view");
|
||||
var import_view3 = require("@codemirror/view");
|
||||
|
||||
// node_modules/monkey-around/mjs/index.js
|
||||
function around(obj, factories) {
|
||||
const removers = Object.keys(factories).map((key) => around1(obj, key, factories[key]));
|
||||
return removers.length === 1 ? removers[0] : function() {
|
||||
removers.forEach((r) => r());
|
||||
};
|
||||
}
|
||||
function around1(obj, method, createWrapper) {
|
||||
const original = obj[method], hadOwn = obj.hasOwnProperty(method);
|
||||
let current = createWrapper(original);
|
||||
if (original)
|
||||
Object.setPrototypeOf(current, original);
|
||||
Object.setPrototypeOf(wrapper, current);
|
||||
obj[method] = wrapper;
|
||||
return remove;
|
||||
function wrapper(...args) {
|
||||
if (current === original && obj[method] === wrapper)
|
||||
remove();
|
||||
return current.apply(this, args);
|
||||
}
|
||||
function remove() {
|
||||
if (obj[method] === wrapper) {
|
||||
if (hadOwn)
|
||||
obj[method] = original;
|
||||
else
|
||||
delete obj[method];
|
||||
}
|
||||
if (current === original)
|
||||
return;
|
||||
current = original;
|
||||
Object.setPrototypeOf(wrapper, original || Function);
|
||||
}
|
||||
}
|
||||
|
||||
// src/patch-widget-type.ts
|
||||
var patchDecoration = (plugin, onPatched) => {
|
||||
const uninstaller = around(import_view2.Decoration, {
|
||||
replace(old) {
|
||||
return function(spec) {
|
||||
if (!plugin.patchSucceeded && spec.widget) {
|
||||
plugin.patchSucceeded = patchMathWidget(plugin, spec.widget);
|
||||
if (plugin.patchSucceeded) {
|
||||
onPatched(spec.widget.constructor);
|
||||
uninstaller();
|
||||
}
|
||||
}
|
||||
return old.call(this, spec);
|
||||
};
|
||||
},
|
||||
widget(old) {
|
||||
return function(spec) {
|
||||
if (!plugin.patchSucceeded && spec.widget) {
|
||||
plugin.patchSucceeded = patchMathWidget(plugin, spec.widget);
|
||||
if (plugin.patchSucceeded) {
|
||||
onPatched(spec.widget.constructor);
|
||||
uninstaller();
|
||||
}
|
||||
}
|
||||
return old.call(this, spec);
|
||||
};
|
||||
}
|
||||
});
|
||||
plugin.register(uninstaller);
|
||||
};
|
||||
function patchMathWidget(plugin, widget) {
|
||||
const proto = widget.constructor.prototype;
|
||||
const superProto = Object.getPrototypeOf(proto);
|
||||
const superSuperProto = Object.getPrototypeOf(superProto);
|
||||
const isObsidianBuiltinMathWidget = Object.hasOwn(widget, "math") && Object.hasOwn(widget, "block") && Object.hasOwn(proto, "eq") && Object.hasOwn(proto, "initDOM") && Object.hasOwn(proto, "patchDOM") && Object.hasOwn(proto, "render") && !Object.hasOwn(proto, "toDOM") && !Object.hasOwn(proto, "updateDOM") && Object.hasOwn(superProto, "become") && Object.hasOwn(superProto, "updateDOM") && Object.hasOwn(superSuperProto, "addEditButton") && Object.hasOwn(superSuperProto, "hookClickHandler") && Object.hasOwn(superSuperProto, "resizeWidget") && Object.hasOwn(superSuperProto, "setOwner") && Object.hasOwn(superSuperProto, "setPos") && Object.hasOwn(superSuperProto, "toDOM") && Object.getPrototypeOf(superSuperProto) === import_view3.WidgetType.prototype;
|
||||
if (isObsidianBuiltinMathWidget) {
|
||||
plugin.register(around(proto, {
|
||||
/** Newly added by this plugin: Get a quote info for the position of this math widget. */
|
||||
getQuoteInfo() {
|
||||
return function() {
|
||||
return this.view ? getQuoteInfo(this.view.state, this.start - 1) : null;
|
||||
};
|
||||
},
|
||||
/** Newly added by this plugin */
|
||||
markAsCorrected() {
|
||||
return function() {
|
||||
this.corrected = true;
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Newly added by this plugin: Correct the LaTeX source code (this.math)
|
||||
* based on the quote info, i.e. remove an appropreate number of ">"s
|
||||
* at the head of each line.
|
||||
*/
|
||||
correctIfNecessary() {
|
||||
return function() {
|
||||
if (this.block && !this.corrected) {
|
||||
const quote = this.getQuoteInfo();
|
||||
if (quote) {
|
||||
this.math = quote.correctMath(this.math);
|
||||
this.markAsCorrected();
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
eq(old) {
|
||||
return function(other) {
|
||||
if (this.block && other.block) {
|
||||
if (this.view && !other.view)
|
||||
other.view = this.view;
|
||||
if (other.view && !this.view)
|
||||
this.view = other.view;
|
||||
if (!this.corrected)
|
||||
this.correctIfNecessary();
|
||||
if (!other.corrected)
|
||||
other.correctIfNecessary();
|
||||
}
|
||||
return old.call(this, other);
|
||||
};
|
||||
},
|
||||
initDOM(old) {
|
||||
return function(view) {
|
||||
if (!this.view)
|
||||
this.view = view;
|
||||
return old.call(this, view);
|
||||
};
|
||||
},
|
||||
patchDOM(old) {
|
||||
return function(dom, view) {
|
||||
if (!this.view)
|
||||
this.view = view;
|
||||
return old.call(this, dom, view);
|
||||
};
|
||||
},
|
||||
render(old) {
|
||||
return function(dom) {
|
||||
this.correctIfNecessary();
|
||||
old.call(this, dom);
|
||||
};
|
||||
}
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// src/settings.ts
|
||||
var import_obsidian2 = require("obsidian");
|
||||
var DEFAULT_SETTINGS = {
|
||||
notification: true
|
||||
};
|
||||
var MathInCalloutSettingTab = class extends import_obsidian2.PluginSettingTab {
|
||||
constructor(plugin) {
|
||||
super(plugin.app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
display() {
|
||||
this.containerEl.empty();
|
||||
new import_obsidian2.Setting(this.containerEl).setDesc("If something is not working, type some math expression outside callouts in Live Preview.");
|
||||
new import_obsidian2.Setting(this.containerEl).setName("Show setup guidance notifications").addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings.notification).onChange(async (value) => {
|
||||
this.plugin.settings.notification = value;
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.showNotReadyNotice();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// src/main.ts
|
||||
var MathInCalloutPlugin = class extends import_obsidian3.Plugin {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.notReadyNotice = null;
|
||||
}
|
||||
async onload() {
|
||||
await this.loadSettings();
|
||||
await this.saveSettings();
|
||||
this.addSettingTab(new MathInCalloutSettingTab(this));
|
||||
this.patchSucceeded = false;
|
||||
this.registerEditorExtension(quoteInfoField);
|
||||
this.app.workspace.onLayoutReady(() => setTimeout(() => this.showNotReadyNotice(), 1e3));
|
||||
patchDecoration(this, (builtInMathWidget) => {
|
||||
setTimeout(() => {
|
||||
if (this.notReadyNotice) {
|
||||
this.notReadyNotice.hide();
|
||||
this.notReadyNotice = null;
|
||||
if (this.settings.notification) {
|
||||
new import_obsidian3.Notice(`${this.manifest.name}: You're ready! (Note: this notifiction can be turned off in the plugin setting.)`, 1500);
|
||||
}
|
||||
}
|
||||
this.registerEditorExtension(createCalloutDecorator(builtInMathWidget));
|
||||
this.rerender();
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
rerender() {
|
||||
this.app.workspace.iterateAllLeaves((leaf) => {
|
||||
if (leaf.view instanceof import_obsidian3.MarkdownView) {
|
||||
const eState = leaf.view.getEphemeralState();
|
||||
const editor = leaf.view.editor;
|
||||
editor.setValue(editor.getValue());
|
||||
leaf.view.setEphemeralState(eState);
|
||||
}
|
||||
});
|
||||
}
|
||||
showNotReadyNotice() {
|
||||
if (!this.patchSucceeded && this.settings.notification) {
|
||||
this.notReadyNotice = new import_obsidian3.Notice(`${this.manifest.name}: You're not ready yet. In Live Preview, type some math expression outside callouts.`, 0);
|
||||
}
|
||||
}
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
};
|
11
.obsidian/plugins/math-in-callout/manifest.json
vendored
Normal file
11
.obsidian/plugins/math-in-callout/manifest.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "math-in-callout",
|
||||
"name": "Better Math in Callouts & Blockquotes",
|
||||
"version": "0.3.7",
|
||||
"minAppVersion": "1.3.15",
|
||||
"description": "Add better Live Preview support for math rendering inside callouts & blockquotes.",
|
||||
"author": "Ryota Ushio",
|
||||
"authorUrl": "https://github.com/RyotaUshio",
|
||||
"fundingUrl": "https://www.buymeacoffee.com/ryotaushio",
|
||||
"isDesktopOnly": false
|
||||
}
|
9
.obsidian/plugins/math-in-callout/styles.css
vendored
Normal file
9
.obsidian/plugins/math-in-callout/styles.css
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/* .cm-math:has(.cm-quote.cm-formatting-quote) */
|
||||
/* .cm-math:has(.cm-blockquote-border) */
|
||||
/* { */
|
||||
/* all: unset; */
|
||||
/* } */
|
||||
|
||||
.cm-math:has( .cancel-cm-math) {
|
||||
all: unset;
|
||||
}
|
@ -43,7 +43,7 @@
|
||||
"singlelineCardSeparator": "::",
|
||||
"singlelineReversedCardSeparator": ":::"
|
||||
},
|
||||
"buryDate": "2024-03-30",
|
||||
"buryDate": "2024-04-01",
|
||||
"buryList": [],
|
||||
"historyDeck": ""
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"displayIndividualItems": false,
|
||||
"displayIndividualItems": true,
|
||||
"showNotes": true,
|
||||
"showAttachments": true,
|
||||
"showFiles": true,
|
||||
|
9
.obsidian/plugins/obsidian42-brat/data.json
vendored
9
.obsidian/plugins/obsidian42-brat/data.json
vendored
@ -8,6 +8,10 @@
|
||||
],
|
||||
"pluginSubListFrozenVersion": [],
|
||||
"themesList": [
|
||||
{
|
||||
"repo": "Bluemoondragon07/Wikipedia-Theme",
|
||||
"lastUpdate": "90496471"
|
||||
},
|
||||
{
|
||||
"repo": "AnubisNekhet/AnuPpuccin",
|
||||
"lastUpdate": "2022-11-24T13:06:17Z"
|
||||
@ -15,10 +19,11 @@
|
||||
],
|
||||
"updateAtStartup": false,
|
||||
"updateThemesAtStartup": false,
|
||||
"ribbonIconEnabled": true,
|
||||
"enableAfterInstall": true,
|
||||
"loggingEnabled": false,
|
||||
"loggingPath": "BRAT-log",
|
||||
"loggingVerboseEnabled": false,
|
||||
"debuggingMode": true,
|
||||
"notificationsEnabled": true
|
||||
"notificationsEnabled": true,
|
||||
"ribbonIconEnabled": true
|
||||
}
|
10
.obsidian/plugins/quick-preview/data.json
vendored
Normal file
10
.obsidian/plugins/quick-preview/data.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"modifier": "Alt",
|
||||
"lazyHide": true,
|
||||
"position": "Auto",
|
||||
"customPositionX": 0,
|
||||
"customPositionY": 0,
|
||||
"stickToMouse": true,
|
||||
"log": false,
|
||||
"disableCloseSuggest": false
|
||||
}
|
513
.obsidian/plugins/quick-preview/main.js
vendored
Normal file
513
.obsidian/plugins/quick-preview/main.js
vendored
Normal file
@ -0,0 +1,513 @@
|
||||
/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var __accessCheck = (obj, member, msg) => {
|
||||
if (!member.has(obj))
|
||||
throw TypeError("Cannot " + msg);
|
||||
};
|
||||
var __privateGet = (obj, member, getter) => {
|
||||
__accessCheck(obj, member, "read from private field");
|
||||
return getter ? getter.call(obj) : member.get(obj);
|
||||
};
|
||||
var __privateAdd = (obj, member, value) => {
|
||||
if (member.has(obj))
|
||||
throw TypeError("Cannot add the same private member more than once");
|
||||
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
||||
};
|
||||
var __privateSet = (obj, member, value, setter) => {
|
||||
__accessCheck(obj, member, "write to private field");
|
||||
setter ? setter.call(obj, value) : member.set(obj, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
// src/main.ts
|
||||
var main_exports = {};
|
||||
__export(main_exports, {
|
||||
default: () => QuickPreviewPlugin
|
||||
});
|
||||
module.exports = __toCommonJS(main_exports);
|
||||
var import_obsidian5 = require("obsidian");
|
||||
var import_obsidian6 = require("obsidian");
|
||||
|
||||
// node_modules/monkey-around/mjs/index.js
|
||||
function around(obj, factories) {
|
||||
const removers = Object.keys(factories).map((key) => around1(obj, key, factories[key]));
|
||||
return removers.length === 1 ? removers[0] : function() {
|
||||
removers.forEach((r) => r());
|
||||
};
|
||||
}
|
||||
function around1(obj, method, createWrapper) {
|
||||
const original = obj[method], hadOwn = obj.hasOwnProperty(method);
|
||||
let current = createWrapper(original);
|
||||
if (original)
|
||||
Object.setPrototypeOf(current, original);
|
||||
Object.setPrototypeOf(wrapper, current);
|
||||
obj[method] = wrapper;
|
||||
return remove;
|
||||
function wrapper(...args) {
|
||||
if (current === original && obj[method] === wrapper)
|
||||
remove();
|
||||
return current.apply(this, args);
|
||||
}
|
||||
function remove() {
|
||||
if (obj[method] === wrapper) {
|
||||
if (hadOwn)
|
||||
obj[method] = original;
|
||||
else
|
||||
delete obj[method];
|
||||
}
|
||||
if (current === original)
|
||||
return;
|
||||
current = original;
|
||||
Object.setPrototypeOf(wrapper, original || Function);
|
||||
}
|
||||
}
|
||||
|
||||
// src/settings.ts
|
||||
var import_obsidian2 = require("obsidian");
|
||||
|
||||
// src/utils.ts
|
||||
var import_obsidian = require("obsidian");
|
||||
function getModifierNameInPlatform(mod) {
|
||||
if (mod === "Mod") {
|
||||
return import_obsidian.Platform.isMacOS || import_obsidian.Platform.isIosApp ? "Command" : "Ctrl";
|
||||
}
|
||||
if (mod === "Shift") {
|
||||
return "Shift";
|
||||
}
|
||||
if (mod === "Alt") {
|
||||
return import_obsidian.Platform.isMacOS || import_obsidian.Platform.isIosApp ? "Option" : "Alt";
|
||||
}
|
||||
if (mod === "Meta") {
|
||||
return import_obsidian.Platform.isMacOS || import_obsidian.Platform.isIosApp ? "Command" : import_obsidian.Platform.isWin ? "Win" : "Meta";
|
||||
}
|
||||
return "Ctrl";
|
||||
}
|
||||
function getSelectedItem(suggestions) {
|
||||
return suggestions.values[suggestions.selectedItem];
|
||||
}
|
||||
|
||||
// src/settings.ts
|
||||
var POSITIONS = ["Auto", "Top left", "Top right", "Bottom left", "Bottom right", "Custom"];
|
||||
var DEFAULT_SETTINGS = {
|
||||
modifier: "Alt",
|
||||
lazyHide: true,
|
||||
position: "Auto",
|
||||
customPositionX: 0,
|
||||
customPositionY: 0,
|
||||
stickToMouse: true,
|
||||
log: false,
|
||||
disableCloseSuggest: false
|
||||
};
|
||||
var QuickPreviewSettingTab = class extends import_obsidian2.PluginSettingTab {
|
||||
constructor(plugin) {
|
||||
super(plugin.app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
addTextSetting(settingName) {
|
||||
return new import_obsidian2.Setting(this.containerEl).addText((text) => {
|
||||
text.setValue(this.plugin.settings[settingName]).setPlaceholder(DEFAULT_SETTINGS[settingName]).onChange(async (value) => {
|
||||
this.plugin.settings[settingName] = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
}
|
||||
addNumberSetting(settingName) {
|
||||
return new import_obsidian2.Setting(this.containerEl).addText((text) => {
|
||||
text.setValue("" + this.plugin.settings[settingName]).setPlaceholder("" + DEFAULT_SETTINGS[settingName]).then((text2) => text2.inputEl.type = "number").onChange(async (value) => {
|
||||
this.plugin.settings[settingName] = value === "" ? DEFAULT_SETTINGS[settingName] : +value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
}
|
||||
addToggleSetting(settingName, extraOnChange) {
|
||||
return new import_obsidian2.Setting(this.containerEl).addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings[settingName]).onChange(async (value) => {
|
||||
this.plugin.settings[settingName] = value;
|
||||
await this.plugin.saveSettings();
|
||||
extraOnChange == null ? void 0 : extraOnChange(value);
|
||||
});
|
||||
});
|
||||
}
|
||||
addDropdowenSetting(settingName, options, display, extraOnChange) {
|
||||
return new import_obsidian2.Setting(this.containerEl).addDropdown((dropdown) => {
|
||||
var _a;
|
||||
const displayNames = /* @__PURE__ */ new Set();
|
||||
for (const option of options) {
|
||||
const displayName = (_a = display == null ? void 0 : display(option)) != null ? _a : option;
|
||||
if (!displayNames.has(displayName)) {
|
||||
dropdown.addOption(option, displayName);
|
||||
displayNames.add(displayName);
|
||||
}
|
||||
}
|
||||
dropdown.setValue(this.plugin.settings[settingName]).onChange(async (value) => {
|
||||
this.plugin.settings[settingName] = value;
|
||||
await this.plugin.saveSettings();
|
||||
extraOnChange == null ? void 0 : extraOnChange(value);
|
||||
});
|
||||
});
|
||||
}
|
||||
addSliderSetting(settingName, min, max, step) {
|
||||
return new import_obsidian2.Setting(this.containerEl).addSlider((slider) => {
|
||||
slider.setLimits(min, max, step).setValue(this.plugin.settings[settingName]).setDynamicTooltip().onChange(async (value) => {
|
||||
this.plugin.settings[settingName] = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
}
|
||||
display() {
|
||||
this.containerEl.empty();
|
||||
this.addDropdowenSetting("modifier", ["Mod", "Ctrl", "Meta", "Shift", "Alt"], getModifierNameInPlatform).setName("Modifier key to toggle quick preview").setDesc("Hold down this key to preview a suggestion before selecting it.");
|
||||
this.addDropdowenSetting("position", POSITIONS, void 0, () => this.display()).setName("Quick preview position").setDesc("Where to show the quick preview.");
|
||||
if (this.plugin.settings.position === "Custom") {
|
||||
this.addNumberSetting("customPositionX").setName("Custom x coordinate").setDesc("Offset relative to the left edge of the window.");
|
||||
this.addNumberSetting("customPositionY").setName("Custom y coordinate").setDesc("Offset relative to the top edge of the window.");
|
||||
}
|
||||
this.addToggleSetting("stickToMouse").setName("Stick to mouse position").setDesc("If turned on, the preview popover will follow the mouse pointer.");
|
||||
this.addToggleSetting("lazyHide").setName("Don't close the current preview until the next preview is ready").setDesc("If turned on, pressing arrow keys or hovering the mouse pointer over a suggestion while holding the modifier key will not immediately close the preview, but instead wait for the preview for the newly selected suggestion to load.");
|
||||
new import_obsidian2.Setting(this.containerEl).setName("Debug mode (advanced)").setHeading();
|
||||
this.addToggleSetting("log").setName("Show selected suggestion in console");
|
||||
this.addToggleSetting("disableCloseSuggest", (disable) => {
|
||||
const suggest = this.plugin.getBuiltInSuggest();
|
||||
if (!disable && suggest.isOpen)
|
||||
suggest.close();
|
||||
}).setName("Prevent the suggestion box from closing").setDesc("Useful for inspecting the suggestion box DOM.");
|
||||
}
|
||||
};
|
||||
|
||||
// src/popoverManager.ts
|
||||
var import_obsidian3 = require("obsidian");
|
||||
|
||||
// src/hoverParent.ts
|
||||
var _hoverPopover;
|
||||
var QuickPreviewHoverParent = class {
|
||||
constructor(suggest) {
|
||||
this.suggest = suggest;
|
||||
__privateAdd(this, _hoverPopover, null);
|
||||
this.hidden = false;
|
||||
this.manager = this.suggest.popoverManager;
|
||||
}
|
||||
hide() {
|
||||
var _a;
|
||||
(_a = this.hoverPopover) == null ? void 0 : _a.hide();
|
||||
this.hidden = true;
|
||||
if (this.manager.currentOpenHoverParent === this) {
|
||||
this.manager.currentOpenHoverParent = null;
|
||||
}
|
||||
}
|
||||
get hoverPopover() {
|
||||
return __privateGet(this, _hoverPopover);
|
||||
}
|
||||
set hoverPopover(hoverPopover) {
|
||||
var _a;
|
||||
__privateSet(this, _hoverPopover, hoverPopover);
|
||||
if (__privateGet(this, _hoverPopover)) {
|
||||
this.manager.addChild(__privateGet(this, _hoverPopover));
|
||||
(_a = this.manager.currentOpenHoverParent) == null ? void 0 : _a.hide();
|
||||
this.manager.currentOpenHoverParent = this;
|
||||
if (this.hidden) {
|
||||
this.hide();
|
||||
return;
|
||||
}
|
||||
__privateGet(this, _hoverPopover).hoverEl.addClass("quick-preview");
|
||||
__privateGet(this, _hoverPopover).position(__privateGet(this, _hoverPopover).shownPos = this.manager.getShownPos());
|
||||
}
|
||||
}
|
||||
};
|
||||
_hoverPopover = new WeakMap();
|
||||
|
||||
// src/popoverManager.ts
|
||||
var PopoverManager = class extends import_obsidian3.Component {
|
||||
constructor(plugin, suggest, itemNormalizer) {
|
||||
super();
|
||||
this.plugin = plugin;
|
||||
this.suggest = suggest;
|
||||
this.itemNormalizer = itemNormalizer;
|
||||
this.currentHoverParent = null;
|
||||
this.currentOpenHoverParent = null;
|
||||
this.lastEvent = null;
|
||||
this.handlers = [];
|
||||
this.popoverHeight = null;
|
||||
this.popoverWidth = null;
|
||||
if (suggest instanceof import_obsidian3.PopoverSuggest)
|
||||
this.suggestions = suggest.suggestions;
|
||||
else
|
||||
this.suggestions = suggest.chooser;
|
||||
}
|
||||
onload() {
|
||||
this.registerDomEvent(window, "keydown", (event) => {
|
||||
if (this.suggest.isOpen && import_obsidian3.Keymap.isModifier(event, this.plugin.settings.modifier)) {
|
||||
if (this.currentOpenHoverParent)
|
||||
this.hide();
|
||||
else {
|
||||
const item = getSelectedItem(this.suggestions);
|
||||
if (item)
|
||||
this.spawnPreview(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.registerDomEvent(window, "keyup", (event) => {
|
||||
if (event.key === this.plugin.settings.modifier)
|
||||
this.hide();
|
||||
});
|
||||
this.registerDomEvent(window, "mousemove", (event) => {
|
||||
if (!import_obsidian3.Keymap.isModifier(event, this.plugin.settings.modifier))
|
||||
this.hide();
|
||||
});
|
||||
this.handlers.push(
|
||||
this.suggest.scope.register([this.plugin.settings.modifier], "ArrowUp", (event) => {
|
||||
this.suggestions.moveUp(event);
|
||||
return false;
|
||||
}),
|
||||
this.suggest.scope.register([this.plugin.settings.modifier], "ArrowDown", (event) => {
|
||||
this.suggestions.moveDown(event);
|
||||
return false;
|
||||
})
|
||||
);
|
||||
}
|
||||
onunload() {
|
||||
var _a, _b;
|
||||
this.handlers.forEach((handler) => {
|
||||
this.suggest.scope.unregister(handler);
|
||||
});
|
||||
this.handlers.length = 0;
|
||||
(_a = this.currentHoverParent) == null ? void 0 : _a.hide();
|
||||
this.currentHoverParent = null;
|
||||
(_b = this.currentOpenHoverParent) == null ? void 0 : _b.hide();
|
||||
this.currentOpenHoverParent = null;
|
||||
this.lastEvent = null;
|
||||
}
|
||||
hide(lazy = false) {
|
||||
var _a;
|
||||
if (!lazy)
|
||||
(_a = this.currentHoverParent) == null ? void 0 : _a.hide();
|
||||
this.currentHoverParent = null;
|
||||
}
|
||||
spawnPreview(item, lazyHide = false, event = null) {
|
||||
this.hide(lazyHide);
|
||||
if (event instanceof MouseEvent || event instanceof PointerEvent)
|
||||
this.lastEvent = event;
|
||||
this.currentHoverParent = new QuickPreviewHoverParent(this.suggest);
|
||||
const info = this.itemNormalizer(item);
|
||||
if (info)
|
||||
this.plugin.onLinkHover(this.currentHoverParent, null, info.linktext, info.sourcePath, { scroll: info.line });
|
||||
}
|
||||
getShownPos() {
|
||||
if (this.plugin.settings.stickToMouse && this.lastEvent)
|
||||
return { x: this.lastEvent.clientX, y: this.lastEvent.clientY };
|
||||
const position = this.plugin.settings.position;
|
||||
if (position === "Auto") {
|
||||
return this.getShownPosAuto();
|
||||
} else if (position === "Custom") {
|
||||
return { x: this.plugin.settings.customPositionX, y: this.plugin.settings.customPositionY };
|
||||
}
|
||||
return this.getShownPosCorner(position);
|
||||
}
|
||||
getShownPosCorner(position) {
|
||||
if (position === "Top left") {
|
||||
return { x: 0, y: 0 };
|
||||
} else if (position === "Top right") {
|
||||
return { x: window.innerWidth, y: 0 };
|
||||
} else if (position === "Bottom left") {
|
||||
return { x: 0, y: window.innerHeight };
|
||||
}
|
||||
return { x: window.innerWidth, y: window.innerHeight };
|
||||
}
|
||||
getShownPosAuto() {
|
||||
var _a, _b, _c, _d, _e;
|
||||
const el = this.suggestions.containerEl;
|
||||
const { top, bottom, left, right, width, height } = el.getBoundingClientRect();
|
||||
const popover = (_a = this.currentHoverParent) == null ? void 0 : _a.hoverPopover;
|
||||
this.popoverWidth = (_c = (_b = popover == null ? void 0 : popover.hoverEl.offsetWidth) != null ? _b : this.popoverWidth) != null ? _c : null;
|
||||
this.popoverHeight = (_e = (_d = popover == null ? void 0 : popover.hoverEl.offsetHeight) != null ? _d : this.popoverHeight) != null ? _e : null;
|
||||
if (this.popoverWidth && this.popoverHeight) {
|
||||
let offsetX = width * 0.1;
|
||||
let offsetY = height * 0.1;
|
||||
if (right - offsetX + this.popoverWidth < window.innerWidth)
|
||||
return { x: right - offsetX, y: top + offsetY };
|
||||
offsetX = width * 0.03;
|
||||
offsetY = height * 0.05;
|
||||
if (left > this.popoverWidth + offsetX)
|
||||
return { x: left - this.popoverWidth - offsetX, y: top + offsetY };
|
||||
}
|
||||
const x = (left + right) * 0.5;
|
||||
const y = (top + bottom) * 0.5;
|
||||
if (x >= window.innerWidth * 0.6) {
|
||||
if (y >= window.innerHeight * 0.5)
|
||||
return this.getShownPosCorner("Top left");
|
||||
return this.getShownPosCorner("Bottom left");
|
||||
}
|
||||
if (y >= window.innerHeight * 0.5)
|
||||
return this.getShownPosCorner("Top right");
|
||||
return this.getShownPosCorner("Bottom right");
|
||||
}
|
||||
};
|
||||
|
||||
// src/reload.ts
|
||||
var import_obsidian4 = require("obsidian");
|
||||
var ReloadModal = class extends import_obsidian4.Modal {
|
||||
constructor(app) {
|
||||
super(app);
|
||||
}
|
||||
onOpen() {
|
||||
this.titleEl.setText("Quick Preview");
|
||||
this.contentEl.setText("You need to reload the app to be able to use this plugin together with Hover Editor.");
|
||||
new import_obsidian4.Setting(this.contentEl).addButton((button) => {
|
||||
button.setButtonText("Reload").setCta().onClick(() => this.app.commands.executeCommandById("app:reload"));
|
||||
}).addButton((button) => {
|
||||
button.setButtonText("Not now").onClick(() => this.close());
|
||||
});
|
||||
}
|
||||
onClose() {
|
||||
this.contentEl.empty();
|
||||
}
|
||||
};
|
||||
|
||||
// src/main.ts
|
||||
var _originalOnLinkHover;
|
||||
var QuickPreviewPlugin = class extends import_obsidian6.Plugin {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
__privateAdd(this, _originalOnLinkHover, void 0);
|
||||
}
|
||||
async onload() {
|
||||
if (this.app.workspace.layoutReady && this.app.plugins.enabledPlugins.has("obsidian-hover-editor")) {
|
||||
new ReloadModal(this.app).open();
|
||||
}
|
||||
__privateSet(this, _originalOnLinkHover, this.app.internalPlugins.getPluginById("page-preview").instance.onLinkHover);
|
||||
await this.loadSettings();
|
||||
await this.saveSettings();
|
||||
this.addSettingTab(new QuickPreviewSettingTab(this));
|
||||
this.app.workspace.onLayoutReady(() => {
|
||||
this.patchSetSelectedItem();
|
||||
this.patchSuggester(this.getBuiltInSuggest().constructor, (item) => {
|
||||
if (!item.file)
|
||||
return null;
|
||||
const info = { linktext: item.file.path, sourcePath: "" };
|
||||
if (item.type === "heading")
|
||||
info.linktext += "#" + (0, import_obsidian5.stripHeadingForLink)(item.heading);
|
||||
else if (item.type === "block")
|
||||
info.line = item.node.position.start.line;
|
||||
return info;
|
||||
});
|
||||
this.patchSuggester(
|
||||
this.app.internalPlugins.getPluginById("switcher").instance.QuickSwitcherModal,
|
||||
(item) => {
|
||||
var _a;
|
||||
if (!item.file)
|
||||
return null;
|
||||
const info = { linktext: item.file.path, sourcePath: "" };
|
||||
if (item.type === "headingsList")
|
||||
info.linktext += "#" + (0, import_obsidian5.stripHeadingForLink)(item.item.heading);
|
||||
else if (item.type === "symbolList")
|
||||
info.line = item.item.symbol.position.start.line;
|
||||
else if (item.type === "bookmark" && item.item.type === "file")
|
||||
info.linktext = item.item.path + ((_a = item.item.subpath) != null ? _a : "");
|
||||
return info;
|
||||
}
|
||||
);
|
||||
this.patchCanvasSuggest();
|
||||
});
|
||||
}
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
/** Call the core Page Preview plugin's (potentially) original onLinkHover method. */
|
||||
onLinkHover(hoverParent, targetEl, linktext, sourcePath, state) {
|
||||
const self = this.app.internalPlugins.getPluginById("page-preview").instance;
|
||||
return __privateGet(this, _originalOnLinkHover).call(self, hoverParent, targetEl, linktext, sourcePath, state);
|
||||
}
|
||||
getBuiltInSuggest() {
|
||||
return this.app.workspace.editorSuggest.suggests[0];
|
||||
}
|
||||
patchSetSelectedItem() {
|
||||
const plugin = this;
|
||||
const suggest = this.getBuiltInSuggest();
|
||||
this.register(around(suggest.suggestions.constructor.prototype, {
|
||||
setSelectedItem(old) {
|
||||
return function(index, event) {
|
||||
old.call(this, index, event);
|
||||
if (this.chooser.popoverManager instanceof PopoverManager) {
|
||||
const manager = this.chooser.popoverManager;
|
||||
if (plugin.settings.log)
|
||||
console.log(getSelectedItem(this));
|
||||
if (event && import_obsidian6.Keymap.isModifier(event, plugin.settings.modifier)) {
|
||||
const item = getSelectedItem(this);
|
||||
if (item)
|
||||
manager.spawnPreview(item, plugin.settings.lazyHide, event);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}));
|
||||
}
|
||||
patchSuggester(suggestClass, itemNormalizer) {
|
||||
const prototype = suggestClass.prototype;
|
||||
const plugin = this;
|
||||
const uninstaller = around(prototype, {
|
||||
open(old) {
|
||||
return function() {
|
||||
old.call(this);
|
||||
const self = this;
|
||||
if (!self.popoverManager)
|
||||
self.popoverManager = new PopoverManager(plugin, self, itemNormalizer);
|
||||
self.popoverManager.load();
|
||||
};
|
||||
},
|
||||
close(old) {
|
||||
return function() {
|
||||
var _a;
|
||||
if (plugin.settings.disableCloseSuggest)
|
||||
return;
|
||||
old.call(this);
|
||||
(_a = this.popoverManager) == null ? void 0 : _a.unload();
|
||||
};
|
||||
}
|
||||
});
|
||||
this.register(uninstaller);
|
||||
return uninstaller;
|
||||
}
|
||||
patchCanvasSuggest() {
|
||||
const plugin = this;
|
||||
const uninstaller = around(import_obsidian5.SuggestModal.prototype, {
|
||||
setInstructions(old) {
|
||||
return function(...args) {
|
||||
old.call(this, ...args);
|
||||
const proto = Object.getPrototypeOf(this);
|
||||
if (this.hasOwnProperty("canvas") && proto.hasOwnProperty("showMarkdownAndCanvas") && proto.hasOwnProperty("showAttachments")) {
|
||||
plugin.patchSuggester(this.constructor, (item) => {
|
||||
if (!item.file)
|
||||
return null;
|
||||
return { linktext: item.file.path, sourcePath: "" };
|
||||
});
|
||||
uninstaller();
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
this.register(uninstaller);
|
||||
}
|
||||
};
|
||||
_originalOnLinkHover = new WeakMap();
|
11
.obsidian/plugins/quick-preview/manifest.json
vendored
Normal file
11
.obsidian/plugins/quick-preview/manifest.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "quick-preview",
|
||||
"name": "Quick Preview",
|
||||
"version": "0.6.0",
|
||||
"minAppVersion": "1.3.5",
|
||||
"description": "Quickly preview a suggestion before selecting it in link suggestions & quick switcher.",
|
||||
"author": "Ryota Ushio",
|
||||
"authorUrl": "https://github.com/RyotaUshio",
|
||||
"fundingUrl": "https://www.buymeacoffee.com/ryotaushio",
|
||||
"isDesktopOnly": false
|
||||
}
|
20
.obsidian/plugins/quick-preview/styles.css
vendored
Normal file
20
.obsidian/plugins/quick-preview/styles.css
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/* @settings
|
||||
|
||||
name: Quick Preview
|
||||
id: quick-preview
|
||||
settings:
|
||||
-
|
||||
id: quick-preview-font-size
|
||||
title: Font size (%)
|
||||
type: variable-number-slider
|
||||
min: 10
|
||||
max: 200
|
||||
step: 1
|
||||
default: 100
|
||||
format: "%"
|
||||
*/
|
||||
|
||||
.popover.hover-popover.quick-preview {
|
||||
--layer-popover: calc(max(var(--layer-modal), var(--layer-notice)) + 1);
|
||||
--popover-font-size: var(--quick-preview-font-size);
|
||||
}
|
11
.obsidian/plugins/various-complements/data.json
vendored
11
.obsidian/plugins/various-complements/data.json
vendored
@ -6,6 +6,7 @@
|
||||
"minFuzzyMatchScore": 0.5,
|
||||
"matchingWithoutEmoji": true,
|
||||
"treatAccentDiacriticsAsAlphabeticCharacters": true,
|
||||
"treatUnderscoreAsPartOfWord": false,
|
||||
"maxNumberOfSuggestions": 10,
|
||||
"maxNumberOfWordsAsPhrase": 3,
|
||||
"minNumberOfCharactersTriggered": 1,
|
||||
@ -13,6 +14,7 @@
|
||||
"complementAutomatically": true,
|
||||
"delayMilliSeconds": 0,
|
||||
"disableSuggestionsDuringImeOn": false,
|
||||
"disableSuggestionsInMathBlock": true,
|
||||
"insertAfterCompletion": true,
|
||||
"firstCharactersDisableSuggestions": ":/^",
|
||||
"patternsToSuppressTrigger": [
|
||||
@ -33,6 +35,13 @@
|
||||
"hideHotkeyGuide": false
|
||||
}
|
||||
],
|
||||
"select with custom alias": [
|
||||
{
|
||||
"modifiers": [],
|
||||
"key": "ArrowRight",
|
||||
"hideHotkeyGuide": false
|
||||
}
|
||||
],
|
||||
"up": [
|
||||
{
|
||||
"modifiers": [],
|
||||
@ -63,7 +72,7 @@
|
||||
"currentFileMinNumberOfCharacters": 0,
|
||||
"onlyComplementEnglishOnCurrentFileComplement": false,
|
||||
"enableCurrentVaultComplement": false,
|
||||
"currentVaultMinNumberOfCharacters": 0,
|
||||
"currentVaultMinNumberOfCharacters": 2,
|
||||
"includeCurrentVaultPathPrefixPatterns": "",
|
||||
"excludeCurrentVaultPathPrefixPatterns": "",
|
||||
"includeCurrentVaultOnlyFilesUnderCurrentDirectory": false,
|
||||
|
@ -1 +1 @@
|
||||
{"matrice hessienne":{"matrice hessienne":{"internalLink":{"count":2,"lastUpdated":1710324879177}}},"manim Ellipse":{"manim Ellipse":{"internalLink":{"count":1,"lastUpdated":1709296590359}}},"baptême":{"baptême":{"internalLink":{"count":5,"lastUpdated":1709864270370}}},"gradient":{"gradient":{"internalLink":{"count":1,"lastUpdated":1710325461961}}},"obsidian plugin tag and wordcloud":{"obsidian plugin tag and wordcloud":{"internalLink":{"count":1,"lastUpdated":1710345237714}}},"intersection de sous groupes":{"intersection de sous groupes":{"internalLink":{"count":1,"lastUpdated":1710465530327}}},"valeurs":{"valeurs":{"internalLink":{"count":1,"lastUpdated":1711459246780}}},"Learning APL":{"Learning APL":{"internalLink":{"count":1,"lastUpdated":1711584419388}}},"structure de donnés":{"structure de donnés":{"internalLink":{"count":1,"lastUpdated":1711621251914}}},"paramètre":{"paramètre":{"internalLink":{"count":1,"lastUpdated":1711621492446}}},"langage de programmation":{"langage de programmation":{"internalLink":{"count":3,"lastUpdated":1711917360066}}},"argument d'une fonction":{"argument d'une fonction":{"internalLink":{"count":1,"lastUpdated":1711624010397}}},"argument":{"argument":{"internalLink":{"count":2,"lastUpdated":1711624133731}}},"techniques de pkm":{"techniques de pkm":{"internalLink":{"count":1,"lastUpdated":1711627281333}}},"paradigme de programmation":{"paradigme de programmation":{"internalLink":{"count":6,"lastUpdated":1711917618071}}},"état":{"état":{"internalLink":{"count":3,"lastUpdated":1711905774038}}},"structure de données":{"structure de données":{"internalLink":{"count":1,"lastUpdated":1711643699590}}},"structures de données":{"structures de données":{"internalLink":{"count":2,"lastUpdated":1711904665130}}},"enregistrement":{"enregistrement":{"internalLink":{"count":1,"lastUpdated":1711668283936}}},"envoi de messages entre objets":{"envoi de messages entre objets":{"internalLink":{"count":1,"lastUpdated":1711742931869}}},"programmation structurée":{"programmation structurée":{"internalLink":{"count":1,"lastUpdated":1711764089506}}},"effet de bord":{"effet de bord":{"internalLink":{"count":2,"lastUpdated":1711906516742}}},"programmation impérative":{"programmation impérative":{"internalLink":{"count":3,"lastUpdated":1711915570179}}},"composition de fonctions":{"composition de fonctions":{"internalLink":{"count":1,"lastUpdated":1711904385231}}},"fonction":{"fonction":{"internalLink":{"count":2,"lastUpdated":1711904857369}}},"fonction pure":{"fonction pure":{"internalLink":{"count":1,"lastUpdated":1711915488076}}},"effets de bord":{"effets de bord":{"internalLink":{"count":1,"lastUpdated":1711915498637}}},"Alan Perlis":{"Alan Perlis":{"internalLink":{"count":1,"lastUpdated":1711915724379}}},"fonction racine carrée":{"fonction racine carrée":{"internalLink":{"count":1,"lastUpdated":1711916013705}}},"méthode de Newton":{"méthode de Newton":{"internalLink":{"count":1,"lastUpdated":1711916030171}}},"langages formels":{"langages formels":{"internalLink":{"count":1,"lastUpdated":1711916816989}}},"logique":{"logique":{"internalLink":{"count":1,"lastUpdated":1711916822650}}},"sophisme":{"sophisme":{"internalLink":{"count":1,"lastUpdated":1711916957089}}}}
|
||||
{"matrice hessienne":{"matrice hessienne":{"internalLink":{"count":2,"lastUpdated":1710324879177}}},"manim Ellipse":{"manim Ellipse":{"internalLink":{"count":1,"lastUpdated":1709296590359}}},"baptême":{"baptême":{"internalLink":{"count":5,"lastUpdated":1709864270370}}},"gradient":{"gradient":{"internalLink":{"count":1,"lastUpdated":1710325461961}}},"obsidian plugin tag and wordcloud":{"obsidian plugin tag and wordcloud":{"internalLink":{"count":1,"lastUpdated":1710345237714}}},"intersection de sous groupes":{"intersection de sous groupes":{"internalLink":{"count":1,"lastUpdated":1710465530327}}},"valeurs":{"valeurs":{"internalLink":{"count":1,"lastUpdated":1711459246780}}},"Learning APL":{"Learning APL":{"internalLink":{"count":1,"lastUpdated":1711584419388}}},"structure de donnés":{"structure de donnés":{"internalLink":{"count":1,"lastUpdated":1711621251914}}},"paramètre":{"paramètre":{"internalLink":{"count":1,"lastUpdated":1711621492446}}},"langage de programmation":{"langage de programmation":{"internalLink":{"count":4,"lastUpdated":1711920773085}},"langage":{"internalLink":{"count":1,"lastUpdated":1711920903060}}},"argument d'une fonction":{"argument d'une fonction":{"internalLink":{"count":1,"lastUpdated":1711624010397}}},"argument":{"argument":{"internalLink":{"count":2,"lastUpdated":1711624133731}}},"techniques de pkm":{"techniques de pkm":{"internalLink":{"count":1,"lastUpdated":1711627281333}}},"paradigme de programmation":{"paradigme de programmation":{"internalLink":{"count":6,"lastUpdated":1711917618071}}},"état":{"état":{"internalLink":{"count":3,"lastUpdated":1711905774038}}},"structure de données":{"structure de données":{"internalLink":{"count":1,"lastUpdated":1711643699590}}},"structures de données":{"structures de données":{"internalLink":{"count":2,"lastUpdated":1711904665130}}},"enregistrement":{"enregistrement":{"internalLink":{"count":1,"lastUpdated":1711668283936}}},"envoi de messages entre objets":{"envoi de messages entre objets":{"internalLink":{"count":1,"lastUpdated":1711742931869}}},"programmation structurée":{"programmation structurée":{"internalLink":{"count":1,"lastUpdated":1711764089506}}},"effet de bord":{"effet de bord":{"internalLink":{"count":2,"lastUpdated":1711906516742}}},"programmation impérative":{"programmation impérative":{"internalLink":{"count":3,"lastUpdated":1711915570179}}},"composition de fonctions":{"composition de fonctions":{"internalLink":{"count":1,"lastUpdated":1711904385231}}},"fonction":{"fonction":{"internalLink":{"count":2,"lastUpdated":1711904857369}}},"fonction pure":{"fonction pure":{"internalLink":{"count":1,"lastUpdated":1711915488076}}},"effets de bord":{"effets de bord":{"internalLink":{"count":1,"lastUpdated":1711915498637}}},"Alan Perlis":{"Alan Perlis":{"internalLink":{"count":1,"lastUpdated":1711915724379}}},"fonction racine carrée":{"fonction racine carrée":{"internalLink":{"count":1,"lastUpdated":1711916013705}}},"méthode de Newton":{"méthode de Newton":{"internalLink":{"count":1,"lastUpdated":1711916030171}}},"langages formels":{"langages formels":{"internalLink":{"count":1,"lastUpdated":1711916816989}}},"logique":{"logique":{"internalLink":{"count":1,"lastUpdated":1711916822650}}},"sophisme":{"sophisme":{"internalLink":{"count":1,"lastUpdated":1711916957089}}},"définition":{"définition":{"currentVault":{"count":1,"lastUpdated":1711920701861},"currentFile":{"count":1,"lastUpdated":1711920749062}}},"remplissage":{"remplissage":{"currentVault":{"count":1,"lastUpdated":1711920704851}}},"défini":{"défini":{"currentFile":{"count":1,"lastUpdated":1711920747172}}},"SE - organisation des données":{"SE - organisation des données":{"internalLink":{"count":1,"lastUpdated":1711920824428}}},"Frédéric Lordon":{"Frédéric Lordon":{"internalLink":{"count":1,"lastUpdated":1711942941375}}}}
|
5
.obsidian/snippets/popup_preview_size.css
vendored
Normal file
5
.obsidian/snippets/popup_preview_size.css
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
.theme-light, .theme-dark {
|
||||
--popover-width: 650px;
|
||||
--popover-height: 600px;
|
||||
}
|
4537
.obsidian/themes/BRAT-AnubisNekhet----AnuPpuccin.css
vendored
4537
.obsidian/themes/BRAT-AnubisNekhet----AnuPpuccin.css
vendored
File diff suppressed because it is too large
Load Diff
1642
.obsidian/themes/Obsidianite.css
vendored
1642
.obsidian/themes/Obsidianite.css
vendored
File diff suppressed because it is too large
Load Diff
7
.obsidian/themes/Wikipedia/manifest.json
vendored
Normal file
7
.obsidian/themes/Wikipedia/manifest.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "Wikipedia",
|
||||
"version": "2.0.3",
|
||||
"minAppversion": "1.0.0",
|
||||
"author": "Ha'ani Whitlock",
|
||||
"authorUrl": "https://github.com/Bluemoondragon07"
|
||||
}
|
1140
.obsidian/themes/Wikipedia/theme.css
vendored
Normal file
1140
.obsidian/themes/Wikipedia/theme.css
vendored
Normal file
File diff suppressed because one or more lines are too long
0
.trash/Morgan Montigny 2.md
Normal file
0
.trash/Morgan Montigny 2.md
Normal file
0
.trash/Ylan Malherbe 2.md
Normal file
0
.trash/Ylan Malherbe 2.md
Normal file
@ -3,8 +3,6 @@ link::
|
||||
anniv::
|
||||
#personne
|
||||
|
||||
---
|
||||
|
||||
> [!smallquery]+ Sous-notes de `$= dv.el("span", "[[" + dv.current().file.name + "]]")`
|
||||
> ```breadcrumbs
|
||||
> title: false
|
||||
|
@ -1,13 +1,17 @@
|
||||
up:: [[plan du mémoire de L3]]
|
||||
#informatique #fac
|
||||
|
||||
|
||||
# Définition et concepts importants
|
||||
## qu'est-ce qu'un paradigme
|
||||
|
||||
Un paradigme de programmation est une façon d'approcher la programmation et de formuler les problèmes et leurs formalisation dans un langage de programmation. En particulier, un paradigme fournit et détermine comment un développeur doit voir un programme.
|
||||
La notion de paradigme est notamment à dissocier de celles de *méthode* ou bien de *design patterns*, qui décrivent comment traîter des problèmes spécifiques et reconnus, et comment aboutir à une solution conceptuelle.
|
||||
Un paradigme est un concept plus "haut niveau", c'est-à-dire plus abstrait : chaque paradigme supporte un ensemble particulier de concepts (cohérents entre eux), qui peuvent être hérités d'une théorie mathématique, de principes fondamentaux, ou bien d'une vision sur ce que doit être la programmation.
|
||||
|
||||
|
||||
![[paradigme de programmation#^definition|paradigme]]
|
||||
|
||||
> [!cite] [Programming Paradigms for Dummies: What Every Programmer Should Know](zotero://select/groups/5383243/items/673TMQRT) - [Page 10](zotero://open-pdf/groups/5383243/items/P4L4LCJZ?page=2&annotation=2294PTUD)
|
||||
> [!cite]- [Programming Paradigms for Dummies: What Every Programmer Should Know](zotero://select/groups/5383243/items/673TMQRT) - [Page 10](zotero://open-pdf/groups/5383243/items/P4L4LCJZ?page=2&annotation=2294PTUD)
|
||||
> A programming paradigm is an approach to programming a computer based on a mathematical theory or a coherent set of principles.
|
||||
>
|
||||
> > [!note] Notes
|
||||
@ -16,8 +20,21 @@ up:: [[plan du mémoire de L3]]
|
||||
> > - chaque paradigme est défini à partir de principes de base (éventuellement une théorie mathématique)
|
||||
> ^2294PTUDaP4L4LCJZg5383243p2
|
||||
|
||||
> [!cite]- [Paradigme (programmation)](zotero://select/groups/5383243/items/U2XUNF8V) - [Page ](zotero://open-pdf/groups/5383243/items/PYQD2DCX?annotation=FZJDRZRQ)
|
||||
> Le paradigme de programmation est la façon (parmi d'autres) d'approcher la programmation informatique et de formuler les solutions aux problèmes et leur formalisation dans un langage de programmation approprié[1]. Ce n'est pas de la méthodologie contenant une méthode ; cette dernière organise le traitement des problèmes reconnus dans l'écosystème concerné pour aboutir à la solution conceptuelle et programme exécutable.
|
||||
> ^FZJDRZRQaPYQD2DCXg5383243
|
||||
|
||||
> [!cite]- [Programming Paradigms for Dummies: What Every Programmer Should Know](zotero://select/groups/5383243/items/673TMQRT) - [Page 10](zotero://open-pdf/groups/5383243/items/P4L4LCJZ?page=2&annotation=4LQTA3Q8)
|
||||
> Each paradigm supports a set of concepts that makes it the best for a certain kind of problem. For example, object-oriented programming is best for problems with a large number of related data abstractions organized in a hierarchy. Logic programming is best for transforming or navigating complex symbolic structures according to logical rules. Discrete synchronous programming is best for reactive problems, i.e., problems that consist of reactions to sequences of external events.
|
||||
>
|
||||
> > [!note] Notes
|
||||
> > Les concepts supportés par les différents paradigmes les rendent adaptés pour la résolution de différents problèmes.
|
||||
> ^4LQTA3Q8aP4L4LCJZg5383243p2
|
||||
|
||||
## les principaux paradigmes
|
||||
|
||||
|
||||
|
||||
[[taxonomie des paradigmes de programmation]]
|
||||
|
||||
|
||||
@ -133,6 +150,27 @@ On voit donc que les machines de Turing sont un formalisme plus expressif (certa
|
||||
> le problème de l'appartenance d'un mot à un langage algébrique est décidable : il existe un algorithme qui, étant donnés la description d'une grammaire non contextuelle et un mot, répond en temps fini à la question de l'appartenance de ce mot au langage défini par cette grammaire (plus précisément, on peut le tester en un temps $O(n^{3})$ pour un mot de longueur n, grâce à l'algorithme CYK).
|
||||
> ^DMXNL4GEaWAETBZDGg5383243
|
||||
|
||||
## contre la distinction entre les paradigmes
|
||||
|
||||
La dinstinction entre les différents paradigmes n'est pas toujours claire : beaucoup de langages sont [[Remplissage du plan de L3#les langages multi-paradigmes|multi-paradigmes]], et certains paradigmes peuvent être utilisés dans presque tous les langages (par exemple, la programmation structurée *ref*)
|
||||
|
||||
### Les paradigmes sont des courants de pensée
|
||||
Certains auteurs considèrent que les paradigmes ne sont pas fondamentalement différents (voir : [[Remplissage du plan de L3#Au sens formel|puissance d'expression > au sens formel]]), mais plutôt que les paradigmes sont des courants de pensée, des traditions dans la programmation, rattachées à des communautés (souvent autour d'un ou plusieurs languages de programmation, par exemple LISP pour la programmation fonctionnelle, ou APL pour la programmation matricielle).
|
||||
|
||||
### Les paradigmes sont tous équivalents
|
||||
Greg Michaelson critique la distinction des paradigmes, en expliquant que, lorsqu'on les analyse profondément, les paradigmes sont en fait proche entre-eux .
|
||||
|
||||
> [!cite]+ [The paradigms of programming](zotero://select/groups/5383243/items/Y8NDFJ8W) - [Page 2](zotero://open-pdf/groups/5383243/items/WWITR642?page=2&annotation=AK2234X5)
|
||||
> In computer science, one sees several such communities, each speaking its own language and using its own paradigms. In fact, programming languages typically encourage use of some paradigms and discourage others.
|
||||
> ^AK2234X5aWWITR642g5383243p2
|
||||
|
||||
> [!cite]+ [Programming Paradigms, Turing Completeness and Computational Thinking](zotero://select/groups/5383243/items/VJLTFRRX) - [Page 41](zotero://open-pdf/groups/5383243/items/6YJZLPLZ?page=1&annotation=V8VHK9N2)
|
||||
> Furthermore, it is not at all clear how programming paradigms are to be characterised and differentiated. Indeed, on closer inspection, apparently disparate programming paradigms are very strongly connected. Rather, they should be viewed as different traditions of a unitary Computer Science paradigm composed of programming languages which are all Turing Complete, complemented by methodologies which may all be subsumed by Computational Thinking.
|
||||
>
|
||||
> > [!note] Notes
|
||||
> > il n'y a pas de différence claire entre les paradigmes
|
||||
> > les paradigmes devraient plutôt être vus comme différentes traditions, sur un même paradigme : l'informatique, composée de langages tous Turing completes.
|
||||
> ^V8VHK9N2a6YJZLPLZg5383243p1
|
||||
|
||||
# Paradigmes dans l'apprentissages
|
||||
## avantages de la diversité
|
||||
@ -180,9 +218,23 @@ On voit donc que les machines de Turing sont un formalisme plus expressif (certa
|
||||
> ^588UCYYDaSQN4T6Z8g5383243p7
|
||||
|
||||
# Paradigmes pour la résolution de problèmes
|
||||
|
||||
Un paradigme de programmation est principalement décrit par les concepts qu'il implémente ou non.
|
||||
J.Huges, dans son article "Why Functional Programming Matters", fustige notamment le fait que certains paradigmes (notamment la programmation fonctionnelle *ref* et la programmation structurée *ref*) sont trop souvent définies en termes des fonctionnalités qu'il n'implémente pas, ou des contraintes qu'il pose. Cela est problématique car l'absence d'une fonctionnalité ne peut pas expliquer pourquoi un paradigme serait plus intéressant dans certains cas ("It is a logical impossibility to make a language more powerful by ommitting features, no matter how bad they may be"). L'auteur insiste donc sur le fait que les paradigmes devraient être définis en fonction des avantages structurels qu'il apportent pour résolution de certains types de problèmes ()
|
||||
|
||||
> [!cite]- [Why Functional Programming Matters](zotero://select/groups/5383243/items/6RZUZSFR) - [Page 1](zotero://open-pdf/groups/5383243/items/H9SGRTMQ?page=1&annotation=2QS3SA82)
|
||||
> Such a catalogue of 'advantages' is all very#ell, but one must not be surprised if outsiders don't take it too seriously. It says a lot about what functional programming is *not* (it has no assignment, no side-effects, no flow of control) but not much about what it is. The functional programmer sounds rather like a medieval monk, denying himself the pleasures of life in the hope that it will make him virtuous.
|
||||
> ^2QS3SA82aH9SGRTMQg5383243p1
|
||||
|
||||
> [!cite]- [Why Functional Programming Matters](zotero://select/groups/5383243/items/6RZUZSFR) - [Page 1](zotero://open-pdf/groups/5383243/items/H9SGRTMQ?page=1&annotation=INFAECYD)
|
||||
> Functional programmers argue that there *are* great material benefits - that a functional programmer is an order of magnitude more productive than his conventional counterpart, because functional programs are an order of magnitude shorter. Yet why should this be? The only faintly plausible reason one can suggest on the basis of these 'advantages' is that conventional programs consist of 90% assignment statements, and in functional programs these can be omitted! This is plainly ridiculous. If omittin assignment statements brought such enormous benefits then FORTRAN programmers would have been doing it for twenty years. It is a logical impossibility to make a language more powerful by omittion features, no matter how bad they may be.
|
||||
> ^INFAECYDaH9SGRTMQg5383243p1
|
||||
|
||||
## diversité des approches
|
||||
La diversité est utile, de nouveaux paradigmes apportent de nouvelles façons de voir.
|
||||
Langages multi-paradigmes
|
||||
|
||||
|
||||
## créer un paradigme pour chaque type de problème
|
||||
|
||||
|
||||
@ -199,3 +251,4 @@ Notamment :
|
||||
|
||||
De la même manière, connaître un langage de programmation ne permet pas de savoir immédiatement résoudre tous les problèmes que l'on peut rencontrer. Par exemple, la syntaxe des langages similaires à LISP est très simple et peut être apprise en quelques heures pour certains dialectes. Cependant, connaître la syntaxe complête et le fonctionnement de LISP ne permettra pas de résoudre tout problème : il est également nécessaire d'être capable de "faire le lien" entre un problème et un langage. C'est ce lien que les paradigmes de programmation permettent de faire, soit en donnant explicitement une méthode pour le faire (comme la [[paradigme programmation structurée|programmation structurée]]), soit en définissant comment le programmeur doit voir les programmes, soit en implémentant certaines fonctionnalités utiles pour gérer certains problèmes.
|
||||
|
||||
|
||||
|
@ -4,8 +4,6 @@ alias: [ "livres à lire", "livres à lire" ]
|
||||
up:: [[gestion]]
|
||||
#PKM
|
||||
|
||||
---
|
||||
|
||||
- _La Route de la servitude_, Friedrich Hayeck [wikipedia](https://fr.wikipedia.org/wiki/La_Route_de_la_servitude) (économie)
|
||||
- l'élégance du hérrisson
|
||||
- salmon fishing in the yemen (a propos de la corruption en politique, conseillé par matthias John)
|
||||
|
@ -1,8 +1,8 @@
|
||||
up:: [[gestion]]
|
||||
sibling:: [[personnes]]
|
||||
title:: "Liste de toutes les citations"
|
||||
#PKM
|
||||
|
||||
---
|
||||
|
||||
```dataview
|
||||
LIST title FROM #citation
|
||||
WHERE file.name != "citation"
|
||||
|
@ -5,13 +5,6 @@ kung_fu: 0
|
||||
|
||||
## Todo
|
||||
- [x] #task déposer chèque 🔺 ✅ 2024-03-30
|
||||
- [ ] #task envoyer attestation service fait 🔺
|
||||
- [ ] #task photos d'identité pour permis ⏫
|
||||
- [ ] #task remettre camille
|
||||
- [ ] #task courrier recommandé pour annuler plainte 🔺
|
||||
- [ ] #task convention de stage ⏫
|
||||
- [ ] #task payer felix
|
||||
- [ ] #task gérer CERCIP ⏫
|
||||
- spaced repetition : `INPUT[toggle(onValue(1), offValue(0)):spaced_repetition]`
|
||||
- kung-fu : `INPUT[number:kung_fu]` minutes
|
||||
|
||||
|
25
daily/2024-04-01.md
Normal file
25
daily/2024-04-01.md
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
spaced_repetition: 0
|
||||
kung_fu: 0
|
||||
---
|
||||
|
||||
## Todo
|
||||
- [ ] #task envoyer attestation service fait 🔺
|
||||
- [ ] #task photos d'identité pour permis ⏫
|
||||
- [ ] #task remettre camille
|
||||
- [ ] #task courrier recommandé pour annuler plainte 🔺
|
||||
- [ ] #task convention de stage ⏫
|
||||
- [ ] #task payer felix
|
||||
- [ ] #task gérer CERCIP ⏫
|
||||
- spaced repetition : `INPUT[toggle(onValue(1), offValue(0)):spaced_repetition]`
|
||||
- kung-fu : `INPUT[number:kung_fu]` minutes
|
||||
|
||||
## I did
|
||||
> [!smallquery]+ Modified files
|
||||
> ```dataview
|
||||
> LIST file.mtime
|
||||
> where file.mtime > date(this.file.name) and file.mtime < (date(this.file.name) + dur(1 day)) sort file.mtime asc
|
||||
> ```
|
||||
|
||||
## I am gratefull to
|
||||
|
11
différence entre gauche et droite.md
Normal file
11
différence entre gauche et droite.md
Normal file
@ -0,0 +1,11 @@
|
||||
up:: [[politique.gauche|gauche]], [[politique.droite|droite]]
|
||||
#politique
|
||||
|
||||
|
||||
> [!smallquery]+ Sous-notes de `$= dv.el("span", "[[" + dv.current().file.name + "]]")`
|
||||
> ```breadcrumbs
|
||||
> title: false
|
||||
> type: tree
|
||||
> dir: down
|
||||
> ```
|
||||
|
14
est de gauche ce qui veut sortir du cadre.md
Normal file
14
est de gauche ce qui veut sortir du cadre.md
Normal file
@ -0,0 +1,14 @@
|
||||
up:: [[différence entre gauche et droite]]
|
||||
link:: https://www.youtube.com/watch?v=Hy7LJ4FHBQM
|
||||
author:: [[Frédéric Lordon]]
|
||||
date:: 2013-09-24
|
||||
date-seen:: 2024-04-01
|
||||
#politique #citation
|
||||
|
||||
|
||||
> [!cite] [[Frédéric Lordon]] - Les économistes atterrés aux mardis de l'ESSEC
|
||||
> Pour moi, la différence de la gauche et de la droite, elle est là : elle est dans ce rapport au cadre.
|
||||
> Est de droite ce qui reste dans le cadre.
|
||||
> Est de gauche ce qui veut sortir du cadre et refaire le cadre.
|
||||
> A cette aune, vous avez tout de suite compris : le parti socialiste est de droite.
|
||||
|
@ -9,7 +9,7 @@ Ex: $sorte(R) = \{titre, réalisateur, année\}$
|
||||
En BDD, l'_arité_ d'une relation est
|
||||
?
|
||||
le nombre d'attributs. C'est le cardinal de la _sorte_.
|
||||
<!--SR:!2023-11-24,365,310-->
|
||||
<!--SR:!2028-07-14,1565,330-->
|
||||
|
||||
En BDD, le _shéma_ d'une relation est
|
||||
?
|
||||
|
@ -21,7 +21,7 @@ propriétés d'un monoïde
|
||||
une loi de composition **interne**
|
||||
et **associative**
|
||||
Il existe un **élément neutre**
|
||||
<!--SR:!2024-01-15,56,152!2024-07-23,397,272-->
|
||||
<!--SR:!2024-04-28,27,132!2024-07-23,397,272-->
|
||||
|
||||
l'**ordre d'un groupe** est...
|
||||
??
|
||||
@ -109,7 +109,7 @@ Soit $E$ un [[espace vectoriel]] de [[dimension d'un espace vectoriel|dimension]
|
||||
Soit $\mathcal{F}$ une [[famille de vecteurs libre|famille libre]] de vecteurs de $E$.
|
||||
On peut toujours ajouter un nombre fini de vecteurs à $\mathcal{F}$ pour qu'elle devienne une base de $E$
|
||||
(Ces vecteurs ajoutés rendent $\mathcal{F}$ [[famille de vecteurs génératrice|génératrice]] )
|
||||
<!--SR:!2024-03-12,264,293!2024-02-17,240,273-->
|
||||
<!--SR:!2024-03-12,264,293!2024-07-31,121,253-->
|
||||
|
||||
Espace préhilbertien réel
|
||||
??
|
||||
@ -213,8 +213,8 @@ Matrice de rotation en 2D (angle $\theta$) ::: $\large\begin{pmatrix}\cos\theta
|
||||
Matrice de symétrie en 2D (angle $\theta$) ::: $\large \begin{pmatrix}\cos \theta & \sin \theta \\ \sin \theta & -\cos \theta\end{pmatrix}$
|
||||
<!--SR:!2023-11-04,5,150!2023-12-21,230,270-->
|
||||
|
||||
[[direction d'un espace affine]] ::: Ensemble des vecteurs formés par deux points d'un [[espace affine]]
|
||||
<!--SR:!2025-05-13,691,313!2024-02-16,162,233-->
|
||||
[[direction d'un espace affine]] ::: Ensemble des vecteurs formés par deux points d'un [[espace affine]]
|
||||
<!--SR:!2025-05-13,691,313!2025-09-15,532,253-->
|
||||
$\{ \overrightarrow{AB} \mid (A, B) \in \mathcal{E}^{2} \}$
|
||||
|
||||
|
||||
|
@ -6,13 +6,13 @@
|
||||
# Vocabulary
|
||||
|
||||
_praise_ :: éloges, admiration
|
||||
<!--SR:!2024-03-10,151,210-->
|
||||
<!--SR:!2024-06-17,77,190-->
|
||||
|
||||
_overcrowded_ ::: surpeuplé, encombré
|
||||
<!--SR:!2026-04-16,991,330!2025-08-03,773,308-->
|
||||
|
||||
_bespoke_ :: _customize according to your preferences_ ("a bespoke suit by a good tailor")
|
||||
<!--SR:!2024-04-01,332,270-->
|
||||
<!--SR:!2024-09-13,165,250-->
|
||||
|
||||
_hurdle_ :: obstacle, difficulté, barrière
|
||||
<!--SR:!2024-04-26,365,270-->
|
||||
@ -21,13 +21,13 @@ _hurdle_ :: obstacle, difficulté, barrière
|
||||
<!--SR:!2024-04-22,26,130-->
|
||||
|
||||
rehearsal ::: répétition (d'un spectacle).
|
||||
<!--SR:!2024-01-17,257,248!2024-05-04,365,268-->
|
||||
<!--SR:!2026-09-12,894,268!2024-05-04,365,268-->
|
||||
|
||||
Vol de données :: data theft
|
||||
<!--SR:!2025-06-23,733,328-->
|
||||
|
||||
To wire funds ::: transférer des fonds
|
||||
<!--SR:!2025-08-25,644,249!2024-02-22,293,265-->
|
||||
<!--SR:!2025-08-25,644,249!2027-03-21,1084,285-->
|
||||
|
||||
worsen ::: aggravé
|
||||
<!--SR:!2026-10-10,927,289!2024-04-26,365,249-->
|
||||
@ -42,7 +42,7 @@ a swidler ::: un escroc
|
||||
<!--SR:!2024-12-24,421,229!2024-04-26,365,249-->
|
||||
|
||||
the motive ::: le motif
|
||||
<!--SR:!2025-12-31,723,269!2024-02-18,289,269-->
|
||||
<!--SR:!2025-12-31,723,269!2027-03-22,1085,289-->
|
||||
|
||||
shortage :: pénurie, manque
|
||||
<!--SR:!2024-04-26,365,289-->
|
||||
@ -54,16 +54,16 @@ scarcity :: rareté
|
||||
<!--SR:!2024-12-17,414,229-->
|
||||
|
||||
to streamline :: simplifier (rendre accessible), uniformiser
|
||||
<!--SR:!2024-03-29,81,184-->
|
||||
<!--SR:!2024-05-11,40,164-->
|
||||
|
||||
to impersonate ::: imiter
|
||||
<!--SR:!2024-01-19,8,130!2024-04-30,162,204-->
|
||||
<!--SR:!2024-04-05,4,130!2024-04-30,162,204-->
|
||||
|
||||
whereabouts ::: localisation, endroit
|
||||
<!--SR:!2024-06-06,380,284!2024-03-14,314,284-->
|
||||
<!--SR:!2024-06-06,380,284!2026-09-09,891,284-->
|
||||
|
||||
to be fined :: recevoir une amende
|
||||
<!--SR:!2024-02-03,149,224-->
|
||||
<!--SR:!2025-07-17,472,244-->
|
||||
|
||||
to part with :: se séparer de
|
||||
<!--SR:!2024-06-25,292,224-->
|
||||
@ -78,34 +78,34 @@ to clock in (at work) ::: pointer (au travail)
|
||||
<!--SR:!2024-10-19,206,266!2024-11-16,234,266-->
|
||||
|
||||
to moonlight ::: travailler au noir
|
||||
<!--SR:!2023-12-31,41,206!2023-12-03,13,166-->
|
||||
<!--SR:!2024-06-23,83,206!2024-05-01,30,186-->
|
||||
|
||||
the paperwork ::: la paperasse
|
||||
<!--SR:!2024-01-13,75,286!2024-09-08,244,286-->
|
||||
<!--SR:!2025-01-23,297,306!2024-09-08,244,286-->
|
||||
|
||||
a payrise ::: une augmentation de salaire
|
||||
<!--SR:!2024-10-04,270,306!2023-11-30,31,266-->
|
||||
<!--SR:!2024-10-04,270,306!2024-07-24,114,286-->
|
||||
|
||||
When a company buys another one, the **bought one** is a ==subsidiary==
|
||||
<!--SR:!2024-01-25,66,246-->
|
||||
<!--SR:!2024-09-09,161,246-->
|
||||
|
||||
When a company buys another one, the one **buying** is the ==parent company==
|
||||
<!--SR:!2024-03-15,67,226-->
|
||||
<!--SR:!2024-10-30,212,246-->
|
||||
|
||||
the gross wages ::: le salaire brut
|
||||
<!--SR:!2023-11-25,26,246!2024-02-25,48,206-->
|
||||
<!--SR:!2024-06-03,63,246!2024-07-08,98,206-->
|
||||
|
||||
the net wages ::: le salaire net
|
||||
<!--SR:!2024-01-12,74,286!2024-08-25,230,286-->
|
||||
<!--SR:!2025-01-19,293,306!2024-08-25,230,286-->
|
||||
|
||||
to be workshy ::: être fainéant
|
||||
<!--SR:!2024-03-11,63,246!2023-11-24,19,246-->
|
||||
<!--SR:!2024-09-02,154,246!2024-05-17,46,246-->
|
||||
|
||||
a workaholic ::: un bourreau de travail
|
||||
<!--SR:!2024-10-14,277,306!2024-04-09,92,266-->
|
||||
|
||||
to resign ::: démissionner
|
||||
<!--SR:!2024-10-26,289,306!2024-03-21,73,246-->
|
||||
<!--SR:!2024-10-26,289,306!2024-05-07,36,226-->
|
||||
|
||||
jobless ::: au chômage
|
||||
<!--SR:!2024-04-28,111,286!2024-05-27,140,246-->
|
||||
@ -114,21 +114,25 @@ standard of living ::: niveau de vie
|
||||
<!--SR:!2024-09-01,237,286!2024-10-10,197,246-->
|
||||
|
||||
on strike ::: en grève
|
||||
<!--SR:!2024-10-10,273,306!2023-11-23,18,246-->
|
||||
<!--SR:!2024-10-10,273,306!2024-06-01,61,266-->
|
||||
|
||||
cover letter ::: lettre de motivation
|
||||
<!--SR:!2023-12-22,32,226!2023-11-22,2,146-->
|
||||
<!--SR:!2024-07-11,101,246!2024-04-05,4,166-->
|
||||
|
||||
fixed-term ::: à durée déterminée
|
||||
<!--SR:!2024-05-19,53,246!2024-01-12,4,166-->
|
||||
<!--SR:!2024-05-19,53,246!2024-04-03,2,146-->
|
||||
|
||||
gig economy ::: le freelance
|
||||
<!--SR:!2024-04-04,3,250!2024-04-02,1,230-->
|
||||
|
||||
gig worker ::: un freelanceur, un travailleur en freelance
|
||||
<!--SR:!2024-04-04,3,250!2024-04-02,1,230-->
|
||||
|
||||
regulatory bodies ::: organismes de réglementation
|
||||
<!--SR:!2024-04-04,3,250!2024-04-04,3,250-->
|
||||
|
||||
enforcing regulations :: appliquer les règlements, les régulations
|
||||
<!--SR:!2024-04-04,3,250-->
|
||||
|
||||
|
||||
|
||||
@ -144,4 +148,5 @@ To climb up the ladder ::: gravir les échelons
|
||||
<!--SR:!2024-07-03,177,266!2024-04-06,89,246-->
|
||||
|
||||
to exercise reasonable care :: faire preuve d'une (dilligence|prudence) raisonnable.
|
||||
<!--SR:!2024-04-02,1,230-->
|
||||
|
||||
|
0
flashcards citations.md
Normal file
0
flashcards citations.md
Normal file
@ -1,10 +1,11 @@
|
||||
title::
|
||||
link::
|
||||
#personne
|
||||
|
||||
|
||||
```dataview
|
||||
LIST elink(link)
|
||||
FROM ""
|
||||
WHERE contains(author, this.file.link)
|
||||
```
|
||||
> [!smallquery]+ Sous-notes de `$= dv.el("span", "[[" + dv.current().file.name + "]]")`
|
||||
> ```breadcrumbs
|
||||
> title: false
|
||||
> type: tree
|
||||
> dir: down
|
||||
> ```
|
||||
|
||||
|
@ -4,7 +4,8 @@ aliases:
|
||||
---
|
||||
up:: [[capitalisme]], [[salaire]]
|
||||
author:: [[Frédéric Lordon]]
|
||||
#politique
|
||||
source::
|
||||
#politique #citation
|
||||
|
||||
> La grande force du capitalisme, c'est d'avoir imposé le salariat comme quasi-unique solution d'accès à l'argent.
|
||||
[[Frédéric Lordon]]
|
||||
|
@ -1,8 +1,7 @@
|
||||
up::[[algèbre]]
|
||||
#maths/algèbre
|
||||
|
||||
----
|
||||
Une matrice est l'objet mathématique désignant un tableau. ^431974
|
||||
Une matrice est l'objet mathématique désignant un tableau.
|
||||
|
||||
Une matrice à $m$ lignes et $n$ colonnes (souvent dit $m\times n$) est un tableau rectangulaire de $m\times n$ nombres.
|
||||
On note ces nombres entre parenthèses :
|
||||
|
@ -23,6 +23,9 @@ source:: [[ParadigmeProgrammation]]
|
||||
> > - chaque paradigme est défini à partir de principes de base (éventuellement une théorie mathématique)
|
||||
> ^2294PTUDaP4L4LCJZg5383243p2
|
||||
|
||||
> [!cite]- [Paradigme (programmation)](zotero://select/groups/5383243/items/U2XUNF8V) - [Page ](zotero://open-pdf/groups/5383243/items/PYQD2DCX?annotation=FZJDRZRQ)
|
||||
> Le paradigme de programmation est la façon (parmi d'autres) d'approcher la programmation informatique et de formuler les solutions aux problèmes et leur formalisation dans un langage de programmation approprié[1]. Ce n'est pas de la méthodologie contenant une méthode ; cette dernière organise le traitement des problèmes reconnus dans l'écosystème concerné pour aboutir à la solution conceptuelle et programme exécutable.
|
||||
> ^FZJDRZRQaPYQD2DCXg5383243
|
||||
|
||||
> [!example] Exemples de paradigmes
|
||||
> - [[paradigme programmation orientée objet|programmation orientée objet]]
|
||||
|
@ -7,6 +7,6 @@ up:: [[paradigme de programmation]]
|
||||
#informatique
|
||||
|
||||
> [!definition] programmation orientée tableaux
|
||||
> La programmation orientée tableaux est un paradigme de programmation dans lequel les programmes sont des manipulations par des opérateurs généralisés de tableaux. Le principe est donc de manipuler des tableaux entiers, plutôt que de s'occuper individuellement de leurs éléments.
|
||||
> La programmation orientée tableaux (ou programmation matricielle, de l'anglais *array programming*) est un paradigme de programmation dans lequel les programmes sont des manipulations par des opérateurs généralisés de tableaux. Le principe est donc de manipuler des tableaux entiers, plutôt que de s'occuper individuellement de leurs éléments.
|
||||
^definition
|
||||
|
||||
|
9
parti politique.md
Normal file
9
parti politique.md
Normal file
@ -0,0 +1,9 @@
|
||||
up:: [[politique]]
|
||||
#politique
|
||||
|
||||
> [!smallquery]+ Sous-notes de `$= dv.el("span", "[[" + dv.current().file.name + "]]")`
|
||||
> ```breadcrumbs
|
||||
> title: false
|
||||
> type: tree
|
||||
> dir: down
|
||||
> ```
|
3
parti socialiste.md
Normal file
3
parti socialiste.md
Normal file
@ -0,0 +1,3 @@
|
||||
up:: [[parti politique]]
|
||||
#politique
|
||||
|
@ -2,6 +2,7 @@
|
||||
BC-tag-note: "#personne"
|
||||
BC-tag-note-field: down
|
||||
---
|
||||
sibling:: [[citations]]
|
||||
#personne #PKM
|
||||
|
||||
> [!smallquery]+ Sous-notes de `$= dv.el("span", "[[" + dv.current().file.name + "]]")`
|
||||
|
@ -12,6 +12,6 @@ date-seen::2024-01-24
|
||||
|
||||
## Interprétation
|
||||
|
||||
- comme dit précédemment : [[202401242342|le capitalisme est né avant la révolution industrielle]]
|
||||
- comme dit précédemment : [[le capitalisme est né avant la révolution industrielle|le capitalisme est né avant la révolution industrielle]]
|
||||
- c'est le déclin du système corporatif qui à permis le capitalisme, et non le capitalisme qui à tué le système corporatif
|
||||
- la naissance du [[capitalisme]] **n'est pas due** à des progès techniques ou des modifications de l'appareil productif
|
||||
|
@ -1,12 +1,10 @@
|
||||
#personne
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
```dataview
|
||||
TABLE title, description, elink(link) as "link"
|
||||
FROM ""
|
||||
WHERE contains(author, this.file.link)
|
||||
```
|
||||
title::
|
||||
link::
|
||||
#personne
|
||||
|
||||
> [!smallquery]+ Sous-notes de `$= dv.el("span", "[[" + dv.current().file.name + "]]")`
|
||||
> ```breadcrumbs
|
||||
> title: false
|
||||
> type: tree
|
||||
> dir: down
|
||||
> ```
|
||||
|
@ -1,8 +1,7 @@
|
||||
author::[[Descartes]]
|
||||
source::[[Discours de la méthode]]
|
||||
title::"la vérité serait dans les raisonnements de chacun, pas dans ceux des philosophes"
|
||||
|
||||
----
|
||||
#citation
|
||||
|
||||
> Car il me semblait que je pourrais rencontrer beaucoup plus de vérité dans les raisonnements que chacun fait touchant les affaires qui lui importent et dont l'événement le doit punir bientôt après s'il à mal jugé, que dans ceux que fait un homme de lettres dans son cabinet touchant des spéculation qui ne produisent aucun effet, et qui ne lui sont d'autre conséquence sinon que peut-être il en tirera d'autant plus de vanité qu'elles seront plus éloignées du sens commun, à cause qu'il aura dû employer d'autant plus d'esprit pour les rendre vraisemblables.
|
||||
|
||||
|
@ -3,8 +3,6 @@ source::[[Discours de la méthode]]
|
||||
title::"ceux qui donnent des conseils sont responsables si leurs conseils sont mauvais"
|
||||
#citation
|
||||
|
||||
----
|
||||
|
||||
> Ceux qui se mêlent de donner des préceptes se doivent estimer plus habiles que ceux auxquels ils les donnent, et si ils manquent en la moindre chose, ils en sont blâmables
|
||||
|
||||
|
||||
|
@ -1,14 +1,10 @@
|
||||
title::
|
||||
link::
|
||||
anniv::
|
||||
#personne
|
||||
|
||||
---
|
||||
|
||||
|
||||
```dataview
|
||||
TABLE title, description, elink(link) as "link"
|
||||
FROM ""
|
||||
WHERE contains(author, this.file.link)
|
||||
```
|
||||
|
||||
> [!smallquery]+ Sous-notes de `$= dv.el("span", "[[" + dv.current().file.name + "]]")`
|
||||
> ```breadcrumbs
|
||||
> title: false
|
||||
> type: tree
|
||||
> dir: down
|
||||
> ```
|
||||
|
Loading…
x
Reference in New Issue
Block a user