From 2d4c2ca4360bcd1e4428b2bf936268373cfb7467 Mon Sep 17 00:00:00 2001 From: Gentleman-DE Date: Sun, 16 Apr 2023 18:51:05 +0200 Subject: [PATCH] vault backup: 2023-04-16 18:51:05 --- .obsidian/community-plugins.json | 4 +- .../plugins/obsidian-dynamic-toc/main.js | 2 + .../obsidian-dynamic-toc/manifest.json | 9 + .../plugins/obsidian-dynamic-toc/styles.css | 1 + .obsidian/plugins/obsidian-plugin-toc/main.js | 303 ++++++++++++++++++ .../plugins/obsidian-plugin-toc/manifest.json | 10 + .obsidian/workspace.json | 43 +-- FH/Informationssicherheit/Ueb2/Ueb2.md | 2 + 8 files changed, 352 insertions(+), 22 deletions(-) create mode 100644 .obsidian/plugins/obsidian-dynamic-toc/main.js create mode 100644 .obsidian/plugins/obsidian-dynamic-toc/manifest.json create mode 100644 .obsidian/plugins/obsidian-dynamic-toc/styles.css create mode 100644 .obsidian/plugins/obsidian-plugin-toc/main.js create mode 100644 .obsidian/plugins/obsidian-plugin-toc/manifest.json diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json index 1db39af..52e1045 100644 --- a/.obsidian/community-plugins.json +++ b/.obsidian/community-plugins.json @@ -2,5 +2,7 @@ "obsidian-git", "obsidian-mind-map", "better-pdf-plugin", - "table-editor-obsidian" + "table-editor-obsidian", + "obsidian-plugin-toc", + "obsidian-dynamic-toc" ] \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-dynamic-toc/main.js b/.obsidian/plugins/obsidian-dynamic-toc/main.js new file mode 100644 index 0000000..d87b7b8 --- /dev/null +++ b/.obsidian/plugins/obsidian-dynamic-toc/main.js @@ -0,0 +1,2 @@ +var W=Object.create;var m=Object.defineProperty,j=Object.defineProperties,F=Object.getOwnPropertyDescriptor,B=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertyNames,M=Object.getOwnPropertySymbols,Y=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var L=(i,e,t)=>e in i?m(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,y=(i,e)=>{for(var t in e||(e={}))A.call(e,t)&&L(i,t,e[t]);if(M)for(var t of M(e))X.call(e,t)&&L(i,t,e[t]);return i},f=(i,e)=>j(i,B(e)),D=i=>m(i,"__esModule",{value:!0});var z=(i,e)=>{D(i);for(var t in e)m(i,t,{get:e[t],enumerable:!0})},q=(i,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $(e))!A.call(i,n)&&n!=="default"&&m(i,n,{get:()=>e[n],enumerable:!(t=F(e,n))||t.enumerable});return i},h=i=>q(D(m(i!=null?W(Y(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var r=(i,e,t)=>new Promise((n,s)=>{var a=l=>{try{p(t.next(l))}catch(g){s(g)}},d=l=>{try{p(t.throw(l))}catch(g){s(g)}},p=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,d);p((t=t.apply(i,e)).next())});z(exports,{default:()=>k});var V=h(require("obsidian"));var H=h(require("obsidian"));function _(i,e){let t=Object.assign({},e,i);return Object.keys(t).reduce((n,s)=>{let a=i[s],d=typeof a=="undefined"||a===null;return f(y({},n),{[s]:d?e[s]:a})},{})}function N(i,e){try{let t=(0,H.parseYaml)(i);return _(t,e)}catch(t){return e}}var c={None:"",TOC:"[TOC]",_TOC_:"__TOC__",AzureWiki:"_TOC_",DevonThink:"{{toc}}",TheBrain:"[/toc/]"};var P={style:"bullet",min_depth:2,max_depth:6,externalStyle:"None",supportAllMatchers:!1,allow_inconsistent_headings:!1},u="dynamic-toc",R=`.${u}`,I=Object.keys(c);var C=h(require("obsidian"));var v=class{constructor(e){this.cached=e}get level(){return this.cached.level}get rawHeading(){return this.cached.heading}get isLink(){return/\[\[(.*?)\]\]/.test(this.cached.heading)}get href(){return this.isLink?`#${this.parseMarkdownLink(this.rawHeading).split("|").join(" ")}`:null}get markdownHref(){if(!this.isLink)return`[[#${this.rawHeading}]]`;let t=this.parseMarkdownLink(this.rawHeading).split("|");return t.length>1?`[[#${t.join(" ")}|${t[1]}]]`:`[[#${t[0]}]]`}parseMarkdownLink(e){let[,t]=e.match(/\[\[(.*?)]\]/)||[];return t}};function T(i,e){if(!(i==null?void 0:i.headings))return"";let{headings:t}=i,n=t.filter(a=>!!a&&a.level>=e.min_depth&&a.level<=e.max_depth);if(!n.length)return"";let s=n.map(a=>new v(a));return e.style==="inline"?J(s,e):U(s,e)}function G(i,e,t){let n=t.style==="number"&&"1."||"-";return!t.varied_style||i.level===e?n:t.style==="number"?"-":"1."}function U(i,e){let t=i[0].level,n=[];e.title&&n.push(`${e.title}`);let s=0;for(let a=0;a1&&(l=new Array(s+1)),s=l.length);let g=l.fill(" ").join("");n.push(`${g}${p} ${d.markdownHref}`)}return n.join(` +`)}function J(i,e){let t=i.map(a=>a.level).reduce((a,d)=>Math.min(a,d)),n=i.filter(a=>a.level===t),s=e.delimiter?e.delimiter:"|";return n.map(a=>`${a.markdownHref}`).join(` ${s.trim()} `)}var S=class extends C.MarkdownRenderChild{constructor(e,t,n,s){super(s);this.app=e;this.config=t;this.filePath=n;this.container=s;this.onActiveLeafChangeHandler=e=>{let t=this.app.workspace.getActiveFile();this.filePath=t.path,this.onFileChangeHandler(t)};this.onSettingsChangeHandler=e=>{this.render(_(this.config,e))};this.onFileChangeHandler=e=>{this.filePath=e.path,!e.deleted&&this.render()}}onload(){return r(this,null,function*(){yield this.render(),this.registerEvent(this.app.metadataCache.on("dynamic-toc:settings",this.onSettingsChangeHandler)),this.registerEvent(this.app.workspace.on("active-leaf-change",this.onActiveLeafChangeHandler)),this.registerEvent(this.app.metadataCache.on("changed",this.onFileChangeHandler))})}render(e){return r(this,null,function*(){this.container.empty(),this.container.classList.add(u);let t=T(this.app.metadataCache.getCache(this.filePath),e||this.config);yield C.MarkdownRenderer.renderMarkdown(t,this.container,this.filePath,this)})}};var o=h(require("obsidian"));var O=class extends o.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:"Dynamic Table of Contents Settings"}),new o.Setting(e).setName("List Style").setDesc("The table indication").addDropdown(n=>n.addOptions({bullet:"Bullet",number:"Number",inline:"Inline"}).setValue(this.plugin.settings.style).onChange(s=>r(this,null,function*(){this.plugin.settings.style=s,yield this.plugin.saveSettings()}))),new o.Setting(e).setName("Enable varied style").setDesc("Varied style allows for the most top level heading to match your list style, then subsequent levels to be the opposite. For example if your list style is number, then your level 2 headings will be number, any levels lower then 2 will be bullet and vice versa.").addToggle(n=>n.setValue(this.plugin.settings.varied_style).onChange(s=>r(this,null,function*(){this.plugin.settings.varied_style=s,yield this.plugin.saveSettings()}))),new o.Setting(e).setName("Delimiter").setDesc("Only used when list style is inline. The delimiter between the list items").addText(n=>n.setPlaceholder("e.g. -, *, ~").setValue(this.plugin.settings.delimiter).onChange(s=>r(this,null,function*(){this.plugin.settings.delimiter=s,this.plugin.saveSettings()}))),new o.Setting(e).setName("Minimum Header Depth").setDesc("The default minimum header depth to render").addSlider(n=>n.setLimits(1,6,1).setValue(this.plugin.settings.min_depth).setDynamicTooltip().onChange(s=>r(this,null,function*(){s>this.plugin.settings.max_depth?new o.Notice("Min Depth is higher than Max Depth"):(this.plugin.settings.min_depth=s,yield this.plugin.saveSettings())}))),new o.Setting(e).setName("Maximum Header Depth").setDesc("The default maximum header depth to render").addSlider(n=>n.setLimits(1,6,1).setValue(this.plugin.settings.max_depth).setDynamicTooltip().onChange(s=>r(this,null,function*(){sn.setPlaceholder("## Table of Contents").setValue(this.plugin.settings.title).onChange(s=>r(this,null,function*(){this.plugin.settings.title=s,this.plugin.saveSettings()})));let t=new o.Setting(e).setName("External rendering support").setDesc("Different markdown viewers provided Table of Contents support such as [TOC] or [[_TOC_]]. You may need to restart Obsidian for this to take effect.").addDropdown(n=>n.addOptions(Object.keys(c).reduce((s,a)=>{let d=c[a];return f(y({},s),{[a]:d})},{})).setDisabled(this.plugin.settings.supportAllMatchers).setValue(this.plugin.settings.externalStyle).onChange(s=>r(this,null,function*(){this.plugin.settings.externalStyle=s,yield this.plugin.saveSettings()})));new o.Setting(e).setName("Support all external renderers").setDesc("Cannot be used in conjunction with individual renderers").addToggle(n=>n.setValue(this.plugin.settings.supportAllMatchers).onChange(s=>r(this,null,function*(){this.plugin.settings.supportAllMatchers=s,t.setDisabled(s),yield this.plugin.saveSettings()}))),new o.Setting(e).setName("Allow inconsistent heading levels").setDesc("NOT RECOMMENDED (may be removed in future): If enabled, the table of contents will be generated even if the header depth is inconsistent. This may cause the table of contents to be rendered incorrectly.").addToggle(n=>n.setValue(this.plugin.settings.allow_inconsistent_headings).onChange(s=>r(this,null,function*(){this.plugin.settings.allow_inconsistent_headings=s,yield this.plugin.saveSettings()})))}};var b=h(require("obsidian"));var w=class extends b.MarkdownRenderChild{constructor(e,t,n,s,a){super(s);this.app=e;this.settings=t;this.filePath=n;this.match=a;this.onSettingsChangeHandler=()=>{this.render()};this.onFileChangeHandler=e=>{e.deleted||e.path!==this.filePath||this.render()}}static findMatch(e,t){return Array.from(e.querySelectorAll("p, span, a")).find(s=>s.textContent.toLowerCase().includes(t.toLowerCase()))||null}onload(){return r(this,null,function*(){this.render(),this.registerEvent(this.app.metadataCache.on("dynamic-toc:settings",this.onSettingsChangeHandler)),this.registerEvent(this.app.metadataCache.on("changed",this.onFileChangeHandler))})}render(){return r(this,null,function*(){let e=T(this.app.metadataCache.getCache(this.filePath),this.settings),t=document.createElement("div");t.classList.add(u),yield b.MarkdownRenderer.renderMarkdown(e,t,this.filePath,this),this.match.style.display="none";let n=this.containerEl.querySelector(R);n&&this.containerEl.removeChild(n),this.match.parentNode.appendChild(t)})}};var K=h(require("obsidian")),E={"code-block":{value:"```toc\n```",label:"Code block"},TOC:{value:"[TOC]",label:"[TOC]"},_TOC_:{label:"__TOC__",value:"[[__TOC__]]"},AzureWiki:{label:"_TOC_",value:"[[_TOC_]]"},DevonThink:{label:"{{toc}}",value:"{{toc}}"},TheBrain:{label:"[/toc/]",value:"[/toc/]"}},x=class extends K.FuzzySuggestModal{constructor(e,t){super(e);this.app=e,this.plugin=t,this.setPlaceholder("Type name of table of contents type...")}getItems(){return this.plugin.settings.supportAllMatchers?Object.keys(E):this.plugin.settings.externalStyle!=="None"?["code-block",this.plugin.settings.externalStyle]:["code-block"]}getItemText(e){let t=Object.keys(E).find(n=>n===e);return E[t].label}onChooseItem(e){this.callback(E[e].value)}start(e){this.callback=e,this.open()}};var k=class extends V.Plugin{constructor(){super(...arguments);this.onload=()=>r(this,null,function*(){yield this.loadSettings(),this.addSettingTab(new O(this.app,this)),this.addCommand({id:"dynamic-toc-insert-command",name:"Insert Table of Contents",editorCallback:e=>{new x(this.app,this).start(n=>{e.setCursor(e.getCursor().line,0),e.replaceSelection(n)})}}),this.registerMarkdownCodeBlockProcessor("toc",(e,t,n)=>{let s=N(e,this.settings);n.addChild(new S(this.app,s,n.sourcePath,t))}),this.registerMarkdownPostProcessor((e,t)=>{let n=this.settings.supportAllMatchers===!0?I:[this.settings.externalStyle];for(let s of n){if(!s||s==="None")continue;let a=w.findMatch(e,c[s]);!(a==null?void 0:a.parentNode)||t.addChild(new w(this.app,this.settings,t.sourcePath,e,a))}})});this.loadSettings=()=>r(this,null,function*(){this.settings=Object.assign({},P,yield this.loadData())});this.saveSettings=()=>r(this,null,function*(){yield this.saveData(this.settings),this.app.metadataCache.trigger("dynamic-toc:settings",this.settings)})}};0&&(module.exports={}); diff --git a/.obsidian/plugins/obsidian-dynamic-toc/manifest.json b/.obsidian/plugins/obsidian-dynamic-toc/manifest.json new file mode 100644 index 0000000..22771b4 --- /dev/null +++ b/.obsidian/plugins/obsidian-dynamic-toc/manifest.json @@ -0,0 +1,9 @@ +{ + "id": "obsidian-dynamic-toc", + "name": "Dynamic Table of Contents", + "author": "aidurber", + "description": "An Obsidian plugin to generate Tables of Contents that stay up to date with your document outline.", + "minAppVersion": "0.11.0", + "version": "0.0.27", + "repo": "aidurber/obsidian-plugin-dynamic-toc" +} diff --git a/.obsidian/plugins/obsidian-dynamic-toc/styles.css b/.obsidian/plugins/obsidian-dynamic-toc/styles.css new file mode 100644 index 0000000..0dfc94c --- /dev/null +++ b/.obsidian/plugins/obsidian-dynamic-toc/styles.css @@ -0,0 +1 @@ +.is-live-preview .dynamic-toc>*{margin-top:0;margin-bottom:0}.is-live-preview .dynamic-toc>* br{display:none}.is-live-preview .dynamic-toc>*:first-child{margin-top:16px}.is-live-preview .dynamic-toc>*:last-child{margin-bottom:16px}.is-live-preview .dynamic-toc ul{white-space:normal}.is-live-preview .dynamic-toc ol{white-space:normal} diff --git a/.obsidian/plugins/obsidian-plugin-toc/main.js b/.obsidian/plugins/obsidian-plugin-toc/main.js new file mode 100644 index 0000000..47cbdba --- /dev/null +++ b/.obsidian/plugins/obsidian-plugin-toc/main.js @@ -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; diff --git a/.obsidian/plugins/obsidian-plugin-toc/manifest.json b/.obsidian/plugins/obsidian-plugin-toc/manifest.json new file mode 100644 index 0000000..5dcbe60 --- /dev/null +++ b/.obsidian/plugins/obsidian-plugin-toc/manifest.json @@ -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" +} \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index b2e97c8..d3db1b1 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -6,28 +6,11 @@ { "id": "08ad9b53ade42d31", "type": "tabs", - "dimension": 37.274368231046935, + "dimension": 62.27436823104693, "children": [ { "id": "bd69cec7a0f30b48", "type": "leaf", - "state": { - "type": "pdf", - "state": { - "file": "FH/Informationssicherheit/Ueb2/02-ueb_uebungsblatt.pdf" - } - } - } - ] - }, - { - "id": "f25fa43f3ff34c47", - "type": "tabs", - "dimension": 62.72563176895307, - "children": [ - { - "id": "90d0b00747e29420", - "type": "leaf", "state": { "type": "markdown", "state": { @@ -38,6 +21,23 @@ } } ] + }, + { + "id": "9b12f77c63f5916c", + "type": "tabs", + "dimension": 37.725631768953065, + "children": [ + { + "id": "20668ba691cd80b3", + "type": "leaf", + "state": { + "type": "pdf", + "state": { + "file": "FH/Informationssicherheit/Ueb2/02-ueb_uebungsblatt.pdf" + } + } + } + ] } ], "direction": "vertical" @@ -174,11 +174,13 @@ "table-editor-obsidian:Advanced Tables Toolbar": false } }, - "active": "90d0b00747e29420", + "active": "bd69cec7a0f30b48", "lastOpenFiles": [ "FH/Informationssicherheit/Ueb2/02-ueb_uebungsblatt.pdf", - "README.md", + "FH/Untitled Diagram.svg", + "FH/2023-04-16.md", "FH/Informationssicherheit/Ueb2/Ueb2.md", + "README.md", "FH/Informationssicherheit/Ueb1/01-ueb_uebungsblatt.pdf", "FH/Informationssicherheit/VL/01-orga-motivation-handout.pdf", "FH/Informationssicherheit/VL/02-terminologie-handout.pdf", @@ -197,7 +199,6 @@ "FH/Informationssicherheit/Ueb1/20230331_10h28m43s_grim.png", "FH/Informationssicherheit/Ueb1/20230331_10h28m24s_grim.png", "FH/Informationssicherheit/Ueb1/20230331_07h21m13s_grim.png", - "FH/Informationssicherheit/Ueb1/20230330_19h34m13s_grim.png", "FH/Informationssicherheit/Ueb1", "FH/Informationssicherheit/Neuer Ordner", "FH/Algorithmen und Datenstrukturen/UEB01.md", diff --git a/FH/Informationssicherheit/Ueb2/Ueb2.md b/FH/Informationssicherheit/Ueb2/Ueb2.md index adb7f41..c174a5b 100644 --- a/FH/Informationssicherheit/Ueb2/Ueb2.md +++ b/FH/Informationssicherheit/Ueb2/Ueb2.md @@ -1,3 +1,4 @@ +- [[#K12|K12]] - [[#Intro|Intro]] - [[#Intro#1|1]] - [[#Intro#2|2]] @@ -14,6 +15,7 @@ # 2.1 +## K12 | Schritt | Sicheheitsziele | Assets | Parteien | | ------------------------------- | --------------------------------------------- | ----------------------------------------------------------------- | ------------------------- | | Formular-basierte Webseite | Verfügbarkeit | Webseite und Webserver | Bank und Kunde |