1
0
Fork 0

vault backup: 2023-05-07 15:39:06

This commit is contained in:
Dmitry Belyaev 2023-05-07 15:39:07 +03:00
parent add54a6048
commit 3758c4d311
29 changed files with 49889 additions and 2 deletions

66
.obsidian.vimrc Normal file
View File

@ -0,0 +1,66 @@
map й q
map ц w
map у e
map к r
map е t
map н y
map г u
map ш i
map щ o
map з p
map х [
map ъ ]
map ф a
map ы s
map в d
map а f
map п g
map р h
map о j
map л k
map д l
map ж ;
map э '
map ё \
map я z
map ч x
map с c
map м v
map и b
map т n
map ь m
map б ,
map ю .
map Й Q
map Ц W
map У E
map К R
map Е T
map Н Y
map Г U
map Ш I
map Щ O
map З P
map Х {
map Ъ }
map Ф A
map Ы S
map В D
map А F
map П G
map Р H
map О J
map Л K
map Д L
map Ж :
map Э "
map Я Z
map Ч X
map С C
map М V
map И B
map Т N
map Ь M
map Б <
map Ю >
map Ё /|

3
.obsidian/app.json vendored
View File

@ -1,4 +1,5 @@
{
"newFileLocation": "folder",
"newFileFolderPath": "файлы"
"newFileFolderPath": "файлы",
"vimMode": true
}

View File

@ -2,5 +2,14 @@
"table-editor-obsidian",
"dataview",
"calendar",
"obsidian-git"
"obsidian-git",
"obsidian-kanban",
"obsidian-outliner",
"obsidian-admonition",
"emoji-shortcodes",
"obsidian-excel-to-markdown-table",
"obsidian-mind-map",
"nldates-obsidian",
"obsidian-plugin-toc",
"obsidian-vimrc-support"
]

2069
.obsidian/plugins/emoji-shortcodes/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
{
"id": "emoji-shortcodes",
"name": "Emoji Shortcodes",
"version": "2.2.0",
"minAppVersion": "1.0.0",
"description": "This Plugin enables the use of Markdown Emoji Shortcodes :smile:",
"author": "phibr0",
"authorUrl": "https://github.com/phibr0",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/phibr0"
}

View File

@ -0,0 +1,31 @@
a[href="https://ko-fi.com/phibr0"] > img
{
height: 3em;
}
a[href="https://ko-fi.com/phibr0"]
{
transform: translate(0, 5%);
}
.ES-suggester-container {
display: flex;
place-content: space-between;
}
.ES-shortcode {
margin-right: 8px;
}
.ES-suggestion-item {
border-top: solid var(--background-secondary) 1px;
padding-left: 10px;
}
.ES-sub-setting {
padding-left: 2em;
}
.ES-sub-setting + .ES-sub-setting {
padding-left: 0;
margin-left: 2em;
}

9202
.obsidian/plugins/nldates-obsidian/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"id": "nldates-obsidian",
"name": "Natural Language Dates",
"description": "Create date-links based on natural language",
"version": "0.6.1",
"author": "Argentina Ortega Sainz",
"authorUrl": "https://argentinaos.com/",
"isDesktopOnly": false,
"minAppVersion": "0.13.0"
}

View File

@ -0,0 +1,24 @@
{
"userAdmonitions": {},
"syntaxHighlight": false,
"copyButton": false,
"version": "9.2.3",
"autoCollapse": false,
"defaultCollapseType": "open",
"injectColor": true,
"parseTitles": true,
"dropShadow": true,
"hideEmpty": false,
"open": {
"admonitions": true,
"icons": true,
"other": true,
"advanced": false
},
"icons": [],
"useFontAwesome": true,
"rpgDownloadedOnce": false,
"msDocConverted": false,
"useSnippet": false,
"snippetPath": "custom-admonitions.cd4e3a"
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-admonition",
"name": "Admonition",
"version": "9.2.3",
"minAppVersion": "1.1.0",
"description": "Enhanced callouts for Obsidian.md",
"author": "Jeremy Valentine",
"authorUrl": "",
"isDesktopOnly": false
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,228 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/main.ts
__export(exports, {
default: () => ExcelToMarkdownTablePlugin
});
var import_obsidian = __toModule(require("obsidian"));
// src/table-alignment-syntax.ts
var ALIGNED_LEFT_SYNTAX = {
prefix: "",
postfix: "",
adjust: 0
};
var ALIGNED_RIGHT_SYNTAX = {
prefix: "",
postfix: ":",
adjust: 1
};
var ALIGNED_CENTER_SYNTAX = {
prefix: ":",
postfix: ":",
adjust: 2
};
// src/excel-markdown-helpers.ts
var ALIGNED_LEFT = "l";
var ALIGNED_RIGHT = "r";
var ALIGNED_CENTER = "c";
var EXCEL_COLUMN_DELIMITER = " ";
var MARKDOWN_NEWLINE = "<br/>";
var UNESCAPED_DOUBLE_QUOTE = '"';
var EXCEL_ROW_DELIMITER_REGEX = /[\n\u0085\u2028\u2029]|\r\n?/g;
var COLUMN_ALIGNMENT_REGEX = /^(\^[lcr])/i;
var EXCEL_NEWLINE_ESCAPED_CELL_REGEX = /"([^\t]*(?<=[^\r])\n[^\t]*)"/g;
var EXCEL_NEWLINE_REGEX = /\n/g;
var EXCEL_DOUBLE_QUOTE_ESCAPED_REGEX = /""/g;
function addMarkdownSyntax(rows, columnWidths) {
return rows.map(function(row, rowIndex) {
return "| " + row.map(function(column, index) {
column = column.replace("|", "\\|");
return column + Array(columnWidths[index] - column.length + 1).join(" ");
}).join(" | ") + " |";
});
}
function addAlignmentSyntax(markdownRows, columnWidths, colAlignments) {
let result = Object.assign([], markdownRows);
result.splice(1, 0, "|" + columnWidths.map(function(width, index) {
let { prefix, postfix, adjust } = calculateAlignmentMarkdownSyntaxMetadata(colAlignments[index]);
return prefix + Array(columnWidths[index] + 3 - adjust).join("-") + postfix;
}).join("|") + "|");
return result;
}
function calculateAlignmentMarkdownSyntaxMetadata(alignment) {
switch (alignment) {
case ALIGNED_LEFT:
return ALIGNED_LEFT_SYNTAX;
case ALIGNED_CENTER:
return ALIGNED_CENTER_SYNTAX;
case ALIGNED_RIGHT:
return ALIGNED_RIGHT_SYNTAX;
default:
return ALIGNED_LEFT_SYNTAX;
}
}
function getColumnWidthsAndAlignments(rows) {
let colAlignments = [];
return {
columnWidths: rows[0].map(function(column, columnIndex) {
let alignment = columnAlignment(column);
colAlignments.push(alignment);
column = column.replace(COLUMN_ALIGNMENT_REGEX, "");
rows[0][columnIndex] = column;
return columnWidth(rows, columnIndex);
}),
colAlignments
};
}
function columnAlignment(columnHeaderText) {
var m = columnHeaderText.match(COLUMN_ALIGNMENT_REGEX);
if (m) {
var alignChar = m[1][1].toLowerCase();
return columnAlignmentFromChar(alignChar);
}
return ALIGNED_LEFT;
}
function columnAlignmentFromChar(alignChar) {
switch (alignChar) {
case ALIGNED_LEFT:
return ALIGNED_LEFT;
case ALIGNED_CENTER:
return ALIGNED_CENTER;
case ALIGNED_RIGHT:
return ALIGNED_RIGHT;
default:
return ALIGNED_LEFT;
}
}
function columnWidth(rows, columnIndex) {
return Math.max.apply(null, rows.map(function(row) {
return row[columnIndex] && row[columnIndex].length || 0;
}));
}
function splitIntoRowsAndColumns(data) {
var rows = data.split(EXCEL_ROW_DELIMITER_REGEX).map(function(row) {
return row.split(EXCEL_COLUMN_DELIMITER);
});
return rows;
}
function replaceIntraCellNewline(data) {
let cellReplacer = (_) => _.slice(1, -1).replace(EXCEL_DOUBLE_QUOTE_ESCAPED_REGEX, UNESCAPED_DOUBLE_QUOTE).replace(EXCEL_NEWLINE_REGEX, MARKDOWN_NEWLINE);
return data.replace(EXCEL_NEWLINE_ESCAPED_CELL_REGEX, cellReplacer);
}
// src/excel-markdown-tables.ts
var LINE_ENDING = "\n";
function excelToMarkdown(rawData) {
let data = rawData.trim();
var intraCellNewlineReplacedData = replaceIntraCellNewline(data);
var rows = splitIntoRowsAndColumns(intraCellNewlineReplacedData);
var { columnWidths, colAlignments } = getColumnWidthsAndAlignments(rows);
const markdownRows = addMarkdownSyntax(rows, columnWidths);
return addAlignmentSyntax(markdownRows, columnWidths, colAlignments).join(LINE_ENDING);
}
function getExcelRows(rawData) {
let data = rawData.trim();
var intraCellNewlineReplacedData = replaceIntraCellNewline(data);
return splitIntoRowsAndColumns(intraCellNewlineReplacedData);
}
function excelRowsToMarkdown(rows) {
var { columnWidths, colAlignments } = getColumnWidthsAndAlignments(rows);
const markdownRows = addMarkdownSyntax(rows, columnWidths);
return addAlignmentSyntax(markdownRows, columnWidths, colAlignments).join(LINE_ENDING);
}
function isExcelData(rows) {
return rows && rows[0] && rows[0].length > 1 ? true : false;
}
// src/main.ts
var ExcelToMarkdownTablePlugin = class extends import_obsidian.Plugin {
constructor() {
super(...arguments);
this.pasteHandler = (evt, editor) => {
if (evt.clipboardData === null) {
return;
}
if (evt.clipboardData.types.length === 1 && evt.clipboardData.types[0] === "text/plain") {
return;
}
const rawData = evt.clipboardData.getData("text");
const rows = getExcelRows(rawData);
if (isExcelData(rows)) {
const markdownData = excelRowsToMarkdown(rows);
editor.replaceSelection(markdownData + "\n");
evt.preventDefault();
}
};
}
onload() {
return __async(this, null, function* () {
this.addCommand({
id: "excel-to-markdown-table",
name: "Excel to Markdown",
hotkeys: [
{
modifiers: ["Mod", "Alt"],
key: "v"
}
],
editorCallback: (editor, view) => __async(this, null, function* () {
const text = yield navigator.clipboard.readText();
editor.replaceSelection(excelToMarkdown(text));
})
});
this.app.workspace.on("editor-paste", this.pasteHandler);
});
}
onunload() {
this.app.workspace.off("editor-paste", this.pasteHandler);
}
};

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-excel-to-markdown-table",
"name": "Excel to Markdown Table",
"version": "0.4.0",
"minAppVersion": "0.12.0",
"description": "An Obsidian plugin to paste data from Microsoft Excel, Google Sheets, Apple Numbers and LibreOffice Calc as Markdown tables in Obsidian editor.",
"author": "Ganessh Kumar R P <rpganesshkumar@gmail.com>",
"authorUrl": "https://ganesshkumar.com",
"isDesktopOnly": false
}

View File

@ -0,0 +1 @@

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-kanban",
"name": "Kanban",
"version": "1.5.3",
"minAppVersion": "1.0.0",
"description": "Create markdown-backed Kanban boards in Obsidian.",
"author": "mgmeyers",
"authorUrl": "https://github.com/mgmeyers/obsidian-kanban",
"isDesktopOnly": false
}

File diff suppressed because one or more lines are too long

32629
.obsidian/plugins/obsidian-mind-map/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
{
"id": "obsidian-mind-map",
"name": "Mind Map",
"version": "1.1.0",
"description": "A plugin to preview notes as Markmap mind maps",
"isDesktopOnly": false,
"js": "main.js"
}

View File

@ -0,0 +1,12 @@
{
"styleLists": true,
"debug": false,
"stickCursor": "bullet-and-checkbox",
"betterEnter": true,
"betterTab": true,
"selectAll": true,
"listLines": false,
"listLineAction": "toggle-folding",
"dndExperiment": false,
"previousRelease": "4.6.7"
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-outliner",
"name": "Outliner",
"version": "4.6.7",
"minAppVersion": "1.1.16",
"description": "Work with your lists like in Workflowy or RoamResearch.",
"author": "Viacheslav Slinko",
"authorUrl": "https://github.com/vslinko",
"isDesktopOnly": false
}

View File

@ -0,0 +1,108 @@
/* lists and bullets */
.outliner-plugin-better-lists .cm-s-obsidian .HyperMD-list-line {
padding-top: 0.4em;
}
.outliner-plugin-better-lists .cm-formatting-list-ul {
margin-right: 0.3em;
}
.outliner-plugin-better-lists .list-bullet::after {
width: 0.4em;
height: 0.4em;
background-color: var(--text-muted);
}
/* lines */
.outliner-plugin-list-lines-scroller {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: var(--file-margins);
padding-left: 0;
pointer-events: none;
overflow: hidden;
}
.outliner-plugin-list-lines-content-container {
position: relative;
}
.outliner-plugin-list-line {
pointer-events: auto;
position: absolute;
width: 5px;
margin-left: 0.5ch;
margin-top: 1em;
z-index: 1;
cursor: pointer;
background: transparent;
background-image: linear-gradient(
to right,
var(--text-faint) 1px,
transparent 1px
);
background-position-x: 2px;
background-repeat: no-repeat;
}
.outliner-plugin-better-bullets .outliner-plugin-list-line {
margin-top: 1.4em;
}
.markdown-source-view.mod-cm6.is-readable-line-width
.outliner-plugin-list-lines-content-container {
max-width: 700px;
margin: auto;
}
.outliner-plugin-list-line:hover {
background: var(--text-faint);
}
.outliner-plugin-vertical-lines
.markdown-source-view.mod-cm6
.cm-hmd-list-indent
.cm-indent::before {
content: none;
}
/* drag-n-drop */
.outliner-plugin-dropping-line {
background-color: hsla(var(--interactive-accent-hsl), 0.4);
}
.outliner-plugin-dragging-line {
opacity: 0.5;
background-color: hsla(var(--interactive-accent-hsl), 0.2);
}
.outliner-plugin-drop-zone {
width: 300px;
height: 4px;
background: var(--color-accent);
z-index: 999;
position: absolute;
pointer-events: none;
}
.outliner-plugin-drop-zone-before {
margin-top: -8px;
}
.outliner-plugin-drop-zone-after {
margin-top: -1px;
}
body.outliner-plugin-dnd:not(.outliner-plugin-dragging) .cm-formatting-list,
body.outliner-plugin-dnd:not(.outliner-plugin-dragging)
.cm-fold-indicator
.collapse-indicator {
cursor: grab !important;
}
html body.outliner-plugin-dnd.outliner-plugin-dragging {
cursor: grabbing !important;
}

View File

@ -0,0 +1,303 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
var __commonJS = (callback, module2) => () => {
if (!module2) {
module2 = {exports: {}};
callback(module2.exports, module2);
}
return module2.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {get: all[name], enumerable: true});
};
var __exportStar = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
}
return target;
};
var __toModule = (module2) => {
if (module2 && module2.__esModule)
return module2;
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", {value: module2, enumerable: true})), module2);
};
// node_modules/dedent/dist/dedent.js
var require_dedent = __commonJS((exports2, module2) => {
"use strict";
function dedent(strings) {
var raw = void 0;
if (typeof strings === "string") {
raw = [strings];
} else {
raw = strings.raw;
}
var result = "";
for (var i = 0; i < raw.length; i++) {
result += raw[i].replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`");
if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
result += arguments.length <= i + 1 ? void 0 : arguments[i + 1];
}
}
var lines = result.split("\n");
var mindent = null;
lines.forEach(function(l) {
var m = l.match(/^(\s+)\S+/);
if (m) {
var indent = m[1].length;
if (!mindent) {
mindent = indent;
} else {
mindent = Math.min(mindent, indent);
}
}
});
if (mindent !== null) {
result = lines.map(function(l) {
return l[0] === " " ? l.slice(mindent) : l;
}).join("\n");
}
result = result.trim();
return result.replace(/\\n/g, "\n");
}
if (typeof module2 !== "undefined") {
module2.exports = dedent;
}
});
// node_modules/objectorarray/index.js
var require_objectorarray = __commonJS((exports2, module2) => {
module2.exports = (val) => {
return val != null && typeof val === "object" && val.constructor !== RegExp;
};
});
// node_modules/fast-json-parse/parse.js
var require_parse = __commonJS((exports2, module2) => {
"use strict";
function Parse(data) {
if (!(this instanceof Parse)) {
return new Parse(data);
}
this.err = null;
this.value = null;
try {
this.value = JSON.parse(data);
} catch (err) {
this.err = err;
}
}
module2.exports = Parse;
});
// node_modules/endent/lib/index.js
var require_lib = __commonJS((exports2) => {
"use strict";
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : {default: mod};
};
Object.defineProperty(exports2, "__esModule", {value: true});
var dedent_1 = __importDefault(require_dedent());
var objectorarray_1 = __importDefault(require_objectorarray());
var fast_json_parse_1 = __importDefault(require_parse());
var ENDENT_ID = "twhZNwxI1aFG3r4";
function endent2(strings, ...values) {
let result = "";
for (let i = 0; i < strings.length; i++) {
result += strings[i];
if (i < values.length) {
let value = values[i];
let isJson = false;
if (fast_json_parse_1.default(value).value) {
value = fast_json_parse_1.default(value).value;
isJson = true;
}
if (value && value[ENDENT_ID] || isJson) {
let rawlines = result.split("\n");
let l = rawlines[rawlines.length - 1].search(/\S/);
let endentation = l > 0 ? " ".repeat(l) : "";
let valueJson = isJson ? JSON.stringify(value, null, 2) : value[ENDENT_ID];
let valueLines = valueJson.split("\n");
valueLines.forEach((l2, index) => {
if (index > 0) {
result += "\n" + endentation + l2;
} else {
result += l2;
}
});
} else if (typeof value === "string" && value.includes("\n")) {
let endentations = result.match(/(?:^|\n)( *)$/);
if (typeof value === "string") {
let endentation = endentations ? endentations[1] : "";
result += value.split("\n").map((str, i2) => {
str = ENDENT_ID + str;
return i2 === 0 ? str : `${endentation}${str}`;
}).join("\n");
} else {
result += value;
}
} else {
result += value;
}
}
}
result = dedent_1.default(result);
return result.split(ENDENT_ID).join("");
}
endent2.pretty = (data) => {
return objectorarray_1.default(data) ? {[ENDENT_ID]: JSON.stringify(data, null, 2)} : data;
};
exports2.default = endent2;
});
// src/main.ts
__markAsModule(exports);
__export(exports, {
default: () => main_default
});
var import_obsidian2 = __toModule(require("obsidian"));
// src/create-toc.ts
var import_endent = __toModule(require_lib());
var import_obsidian = __toModule(require("obsidian"));
var getCurrentHeaderDepth = (headings, cursor) => {
const previousHeadings = headings.filter((heading) => heading.position.end.line < cursor.line);
if (!previousHeadings.length) {
return 0;
}
return previousHeadings[previousHeadings.length - 1].level;
};
var getSubsequentHeadings = (headings, cursor) => {
return headings.filter((heading) => heading.position.end.line > cursor.line);
};
var getPreviousLevelHeading = (headings, currentHeading) => {
const index = headings.indexOf(currentHeading);
const targetHeadings = headings.slice(0, index).reverse();
return targetHeadings.find((item, _index, _array) => {
return item.level == currentHeading.level - 1;
});
};
var createToc = ({headings = []}, cursor, settings) => {
const currentDepth = getCurrentHeaderDepth(headings, cursor);
const subsequentHeadings = getSubsequentHeadings(headings, cursor);
const includedHeadings = [];
for (const heading of subsequentHeadings) {
if (heading.level <= currentDepth) {
break;
}
if (heading.level >= settings.minimumDepth && heading.level <= settings.maximumDepth) {
includedHeadings.push(heading);
}
}
if (!includedHeadings.length) {
new import_obsidian.Notice(import_endent.default`
No headings below cursor matched settings
(min: ${settings.minimumDepth}) (max: ${settings.maximumDepth})
`);
return;
}
const firstHeadingDepth = includedHeadings[0].level;
const links = includedHeadings.map((heading) => {
const itemIndication = settings.listStyle === "number" && "1." || "-";
const indent = new Array(Math.max(0, heading.level - firstHeadingDepth)).fill(" ").join("");
const previousLevelHeading = getPreviousLevelHeading(includedHeadings, heading);
if (typeof previousLevelHeading == "undefined") {
return `${indent}${itemIndication} [[#${heading.heading}|${heading.heading}]]`;
} else {
return `${indent}${itemIndication} [[#${previousLevelHeading.heading}#${heading.heading}|${heading.heading}]]`;
}
});
return import_endent.default`
${settings.title ? `${settings.title}
` : ""}
${`${links.join("\n")}
`}
`;
};
// src/main.ts
var TableOfContentsSettingsTab = class extends import_obsidian2.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const {containerEl} = this;
containerEl.empty();
containerEl.createEl("h2", {text: "Table of Contents - Settings"});
new import_obsidian2.Setting(containerEl).setName("List Style").setDesc("The type of list to render the table of contents as.").addDropdown((dropdown) => dropdown.setValue(this.plugin.settings.listStyle).addOption("bullet", "Bullet").addOption("number", "Number").onChange((value) => {
this.plugin.settings.listStyle = value;
this.plugin.saveData(this.plugin.settings);
this.display();
}));
new import_obsidian2.Setting(containerEl).setName("Title").setDesc("Optional title to put before the table of contents").addText((text) => text.setPlaceholder("**Table of Contents**").setValue(this.plugin.settings.title || "").onChange((value) => {
this.plugin.settings.title = value;
this.plugin.saveData(this.plugin.settings);
}));
new import_obsidian2.Setting(containerEl).setName("Minimum Header Depth").setDesc("The lowest header depth to add to the table of contents. Defaults to 2").addSlider((text) => text.setValue(this.plugin.settings.minimumDepth).setDynamicTooltip().setLimits(1, 6, 1).onChange((value) => {
this.plugin.settings.minimumDepth = value;
this.plugin.saveData(this.plugin.settings);
}));
new import_obsidian2.Setting(containerEl).setName("Maximum Header Depth").setDesc("The highest header depth to add to the table of contents. Defaults to 6").addSlider((text) => text.setValue(this.plugin.settings.maximumDepth).setDynamicTooltip().setLimits(1, 6, 1).onChange((value) => {
this.plugin.settings.maximumDepth = value;
this.plugin.saveData(this.plugin.settings);
}));
}
};
var TableOfContentsPlugin = class extends import_obsidian2.Plugin {
constructor() {
super(...arguments);
this.settings = {
minimumDepth: 2,
maximumDepth: 6,
listStyle: "bullet"
};
this.createTocForActiveFile = (settings = this.settings) => () => {
const activeView = this.app.workspace.getActiveViewOfType(import_obsidian2.MarkdownView);
if (activeView && activeView.file) {
const editor = activeView.sourceMode.cmEditor;
const cursor = editor.getCursor();
const data = this.app.metadataCache.getFileCache(activeView.file) || {};
const toc = createToc(data, cursor, typeof settings === "function" ? settings(data, cursor) : settings);
if (toc) {
editor.replaceRange(toc, cursor);
}
}
};
}
async onload() {
console.log("Load Table of Contents plugin");
this.settings = {
...this.settings,
...await this.loadData()
};
this.addCommand({
id: "create-toc",
name: "Create table of contents",
callback: this.createTocForActiveFile()
});
this.addCommand({
id: "create-toc-next-level",
name: "Create table of contents for next heading level",
callback: this.createTocForActiveFile((data, cursor) => {
const currentHeaderDepth = getCurrentHeaderDepth(data.headings || [], cursor);
const depth = Math.max(currentHeaderDepth + 1, this.settings.minimumDepth);
return {
...this.settings,
minimumDepth: depth,
maximumDepth: depth
};
})
});
this.addSettingTab(new TableOfContentsSettingsTab(this.app, this));
}
};
var main_default = TableOfContentsPlugin;

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-plugin-toc",
"name": "Table of Contents",
"author": "Andrew Lisowski",
"authorUrl": "https://twitter.com/hipstersmoothie",
"description": "Create a table of contents for a note.",
"isDesktopOnly": false,
"minAppVersion": "0.10.12",
"version": "0.1.4"
}

View File

@ -0,0 +1,8 @@
{
"vimrcFileName": ".obsidian.vimrc",
"displayChord": false,
"displayVimMode": false,
"fixedNormalModeLayout": false,
"capturedKeyboardMap": {},
"supportJsCommands": false
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-vimrc-support",
"name": "Vimrc Support",
"version": "0.9.0",
"description": "Auto-load a startup file with Obsidian Vim commands.",
"minAppVersion": "0.15.3",
"author": "esm",
"authorUrl": "",
"isDesktopOnly": false
}