vault backup: 2022-12-09 23:31:44

This commit is contained in:
Bram Adams
2022-12-09 23:31:44 -06:00
parent f60681cf3e
commit c51aa547ef
21 changed files with 6821 additions and 59 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-tasks-plugin",
"name": "Tasks",
"version": "1.19.0",
"minAppVersion": "0.14.6",
"description": "Task management for Obsidian",
"author": "Martin Schenck and Clare Macrae",
"authorUrl": "https://github.com/obsidian-tasks-group",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,199 @@
.plugin-tasks-query-explanation{
/* Prevent long explanation lines wrapping, so they are more readable,
especially on small screens.
A horizontal scroll bar will be displayed, if the explanation
is too wide to fit.
*/
--code-white-space: pre;
}
.tasks-count {
color: var(--text-faint);
padding-left: 20px;
}
/* Pencil icon. */
.tasks-edit {
background-color: var(--text-faint);
mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20aria-hidden%3D%22true%22%20focusable%3D%22false%22%20width%3D%221em%22%20height%3D%221em%22%20style%3D%22-ms-transform%3A%20rotate(360deg)%3B%20-webkit-transform%3A%20rotate(360deg)%3B%20transform%3A%20rotate(360deg)%3B%22%20preserveAspectRatio%3D%22xMidYMid%20meet%22%20viewBox%3D%220%200%201536%201536%22%3E%3Cpath%20d%3D%22M363%201408l91-91l-235-235l-91%2091v107h128v128h107zm523-928q0-22-22-22q-10%200-17%207l-542%20542q-7%207-7%2017q0%2022%2022%2022q10%200%2017-7l542-542q7-7%207-17zm-54-192l416%20416l-832%20832H0v-416zm683%2096q0%2053-37%2090l-166%20166l-416-416l166-165q36-38%2090-38q53%200%2091%2038l235%20234q37%2039%2037%2091z%22%20fill%3D%22%23626262%22%2F%3E%3C%2Fsvg%3E");
-webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20aria-hidden%3D%22true%22%20focusable%3D%22false%22%20width%3D%221em%22%20height%3D%221em%22%20style%3D%22-ms-transform%3A%20rotate(360deg)%3B%20-webkit-transform%3A%20rotate(360deg)%3B%20transform%3A%20rotate(360deg)%3B%22%20preserveAspectRatio%3D%22xMidYMid%20meet%22%20viewBox%3D%220%200%201536%201536%22%3E%3Cpath%20d%3D%22M363%201408l91-91l-235-235l-91%2091v107h128v128h107zm523-928q0-22-22-22q-10%200-17%207l-542%20542q-7%207-7%2017q0%2022%2022%2022q10%200%2017-7l542-542q7-7%207-17zm-54-192l416%20416l-832%20832H0v-416zm683%2096q0%2053-37%2090l-166%20166l-416-416l166-165q36-38%2090-38q53%200%2091%2038l235%20234q37%2039%2037%2091z%22%20fill%3D%22%23626262%22%2F%3E%3C%2Fsvg%3E");
mask-size: contain;
-webkit-mask-size: contain;
display: inline-block;
width: 1em;
height: 1em;
vertical-align: middle;
margin-left: 0.5em;
cursor: pointer;
}
/* Urgency score */
.tasks-urgency {
font-size: var(--font-ui-smaller);
font-family: var(--font-interface);
padding: 2px 6px;
border-radius: var(--radius-s);
color: var(--text-normal);
background-color: var(--background-secondary);
margin-left: 0.5em;
line-height: 1;
}
.internal-link.internal-link-short-mode {
text-decoration: none;
}
.tasks-list-text {
position: relative;
}
.tasks-list-text .tooltip {
position: absolute;
top: 0px;
left: 0px;
white-space: nowrap;
}
.tasks-setting-important {
color: red;
font-weight: bold;
}
.tasks-modal-section + .tasks-modal-section {
margin-top: 16px;
}
.tasks-modal-section label {
display: inline-block;
margin-bottom: 4px;
}
.tasks-modal-section label > span {
display: inline-block;
}
.tasks-modal .with-accesskeys .accesskey-first::first-letter,
.tasks-modal .with-accesskeys .accesskey {
text-decoration: underline;
text-underline-offset: 1pt;
}
.tasks-modal-buttons {
display: grid;
grid-template-columns: 3fr 1fr;
column-gap: .5em;
}
.tasks-modal label + input[type="checkbox"] {
margin-left: 0.67em;
top: 2px;
}
.tasks-modal input[type="text"] {
width: 100%;
}
.tasks-modal-priorities {
display: grid;
grid-template-columns: 4em 5em 5em 7em 5em;
grid-column-gap: 1.33em;
}
.tasks-modal-priorities span {
line-height: 1.41;
white-space: nowrap;
}
.tasks-modal-priorities label {
border-radius: var(--input-radius);
padding: 2px 3px;
}
.tasks-modal-priorities input:focus + label {
box-shadow: 0 0 0 2px var(--background-modifier-border-focus);
border-color: var(--background-modifier-border-focus);
}
.tasks-modal-priorities input:checked + label > span:first-child {
font-weight: bold;
}
.tasks-modal-priorities input:not(:checked) + label > span:nth-child(2) {
filter: grayscale(100%) opacity(60%);
}
.tasks-modal-dates {
display: grid;
grid-template-columns: 5.5em auto;
column-gap: .5em;
row-gap: 5px;
}
.tasks-modal-dates > label {
grid-column: 1;
margin-top: 6px;
}
.tasks-modal-dates > input, .tasks-modal-dates > code {
grid-column: 2;
align-items: stretch;
}
.tasks-modal-dates > code {
margin-bottom: 5px;
}
.tasks-modal-dates > div {
grid-column-start: 1;
grid-column-end: 3;
}
.tasks-modal-status {
display: flex;
justify-content: space-between;
}
@media (max-width: 649px) {
.tasks-modal-priorities {
grid-template-columns: 4em 7.5em 5em;
margin-bottom: -10px;
}
.tasks-modal-priorities > label {
grid-row: 1 / span 2;
}
.tasks-modal-dates {
grid-template-columns: 1fr;
}
.tasks-modal-dates > label {
margin: 0;
}
.tasks-modal-dates > input, .tasks-modal-dates > code {
grid-column: 1;
}
.tasks-modal-dates > div {
grid-column-end: 1;
}
.tasks-modal-status {
display: block;
}
}
@media (max-width: 399px) {
.tasks-modal-priorities {
grid-template-columns: 4em auto;
}
.tasks-modal-priorities > label {
grid-row: 1 / span 4;
}
}
@media (max-width: 259px) {
.tasks-modal-priorities {
grid-template-columns: 1fr;
margin-bottom: 0;
}
.tasks-modal-priorities > label {
grid-row: 1;
}
}

View File

@@ -11,8 +11,8 @@
"weekly": {
"format": "",
"template": "",
"folder": "",
"enabled": false
"folder": "Weekly",
"enabled": true
},
"monthly": {
"format": "",
@@ -22,7 +22,8 @@
"quarterly": {
"format": "",
"template": "",
"folder": ""
"folder": "Quarterly",
"enabled": true
},
"yearly": {
"format": "",

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "templater-obsidian",
"name": "Templater",
"version": "1.16.0",
"description": "Create and use templates",
"minAppVersion": "0.11.13",
"author": "SilentVoid",
"authorUrl": "https://github.com/SilentVoid13",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,281 @@
.templater_search {
width: calc(100% - 20px);
}
.templater_div {
border-top: 1px solid var(--background-modifier-border);
}
.templater_div > .setting-item {
border-top: none !important;
align-self: center;
}
.templater_div > .setting-item > .setting-item-control {
justify-content: space-around;
padding: 0;
width: 100%;
}
.templater_div
> .setting-item
> .setting-item-control
> .setting-editor-extra-setting-button {
align-self: center;
}
.templater_donating {
margin: 10px;
}
.templater_title {
margin: 0;
padding: 0;
margin-top: 5px;
text-align: center;
}
.templater_template {
align-self: center;
margin-left: 5px;
margin-right: 5px;
width: 70%;
}
.templater_cmd {
margin-left: 5px;
margin-right: 5px;
font-size: 14px;
width: 100%;
}
.templater_div2 > .setting-item {
align-content: center;
justify-content: center;
}
.templater-prompt-div {
display: flex;
}
.templater-prompt-form {
display: flex;
flex-grow: 1;
}
.templater-prompt-input {
flex-grow: 1;
}
.templater-button-div {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 1rem;
}
textarea.templater-prompt-input {
height: 10rem;
}
textarea.templater-prompt-input:focus {
border-color: var(--interactive-accent);
}
.cm-s-obsidian .templater-command-bg {
left: 0px;
right: 0px;
background-color: var(--background-primary-alt);
}
.cm-s-obsidian .cm-templater-command {
font-size: 0.85em;
font-family: var(--font-monospace);
line-height: 1.3;
}
.cm-s-obsidian .templater-inline .cm-templater-command {
background-color: var(--background-primary-alt);
}
.cm-s-obsidian .cm-templater-command.cm-templater-opening-tag {
font-weight: bold;
}
.cm-s-obsidian .cm-templater-command.cm-templater-closing-tag {
font-weight: bold;
}
.cm-s-obsidian .cm-templater-command.cm-templater-interpolation-tag {
color: #008bff;
}
.cm-s-obsidian .cm-templater-command.cm-templater-execution-tag {
color: #c0d700;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-keyword {
color: #00a7aa;
font-weight: normal;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-atom {
color: #f39b35;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-number {
color: #a06fca;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-type {
color: #a06fca;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-def {
color: #98e342;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-property {
color: #d4d4d4;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-variable {
color: #d4d4d4;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-variable-2 {
color: #da7dae;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-variable-3 {
color: #a06fca;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-type.cm-def {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-property.cm-def {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-callee {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-operator {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-qualifier {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-tag {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-tag.cm-bracket {
color: #d4d4d4;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-attribute {
color: #a06fca;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-comment {
color: #696d70;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-comment.cm-tag {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-comment.cm-attribute {
color: #d4d4d4;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-string {
color: #e6db74;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-string-2 {
color: #f39b35;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-meta {
color: #d4d4d4;
background: inherit;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-builtin {
color: #fc4384;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-header {
color: #da7dae;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-hr {
color: #98e342;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-link {
color: #696d70;
}
.theme-dark .cm-s-obsidian .cm-templater-command.cm-error {
border-bottom: 1px solid #c42412;
}
.theme-dark .cm-s-obsidian pre.HyperMD-codeblock .cm-keyword {
font-weight: normal;
}
.theme-dark
.cm-s-obsidian
.cm-templater-command.CodeMirror-activeline-background {
background: #272727;
}
.theme-dark .cm-s-obsidian .cm-templater-command.CodeMirror-matchingbracket {
outline: 1px solid grey;
color: #d4d4d4 !important;
}
.CodeMirror-hints {
position: absolute;
z-index: 10;
overflow: hidden;
list-style: none;
margin: 0;
padding: 2px;
-webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
border-radius: 3px;
border: 1px solid silver;
background: white;
font-size: 90%;
font-family: monospace;
max-height: 20em;
overflow-y: auto;
}
.CodeMirror-hint {
margin: 0;
padding: 0 4px;
border-radius: 2px;
white-space: pre;
color: black;
cursor: pointer;
}
li.CodeMirror-hint-active {
background: #08f;
color: white;
}

402
.obsidian/plugins/waypoint/main.js vendored Normal file
View File

@@ -0,0 +1,402 @@
/*
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());
});
};
// main.ts
__export(exports, {
default: () => Waypoint
});
var import_obsidian = __toModule(require("obsidian"));
var FolderNoteType;
(function(FolderNoteType2) {
FolderNoteType2["InsideFolder"] = "INSIDE_FOLDER";
FolderNoteType2["OutsideFolder"] = "OUTSIDE_FOLDER";
})(FolderNoteType || (FolderNoteType = {}));
var DEFAULT_SETTINGS = {
waypointFlag: "%% Waypoint %%",
stopScanAtFolderNotes: false,
showFolderNotes: false,
debugLogging: false,
useWikiLinks: true,
showEnclosingNote: false,
folderNoteType: FolderNoteType.InsideFolder
};
var _Waypoint = class extends import_obsidian.Plugin {
constructor() {
super(...arguments);
this.foldersWithChanges = new Set();
this.detectWaypointFlag = (file) => __async(this, null, function* () {
this.log("Modification on " + file.name);
this.log("Scanning for Waypoint flags...");
const text = yield this.app.vault.cachedRead(file);
const lines = text.split("\n");
for (let i = 0; i < lines.length; i++) {
if (lines[i].trim() === this.settings.waypointFlag) {
if (this.isFolderNote(file)) {
this.log("Found waypoint flag in folder note!");
yield this.updateWaypoint(file);
yield this.updateParentWaypoint(file.parent, this.settings.folderNoteType === FolderNoteType.OutsideFolder);
return;
} else if (file.parent.isRoot()) {
this.log("Found waypoint flag in root folder.");
this.printWaypointError(file, `%% Error: Cannot create a waypoint in the root folder of your vault. For more information, check the instructions [here](https://github.com/IdreesInc/Waypoint) %%`);
return;
} else {
this.log("Found waypoint flag in invalid note.");
this.printWaypointError(file, `%% Error: Cannot create a waypoint in a note that's not the folder note. For more information, check the instructions [here](https://github.com/IdreesInc/Waypoint) %%`);
return;
}
}
}
this.log("No waypoint flags found.");
});
this.updateChangedFolders = () => __async(this, null, function* () {
this.log("Updating changed folders...");
this.foldersWithChanges.forEach((folder) => {
this.log("Updating " + folder.path);
this.updateParentWaypoint(folder, true);
});
this.foldersWithChanges.clear();
});
this.scheduleUpdate = (0, import_obsidian.debounce)(this.updateChangedFolders.bind(this), 500, true);
this.updateParentWaypoint = (node, includeCurrentNode) => __async(this, null, function* () {
const parentWaypoint = yield this.locateParentWaypoint(node, includeCurrentNode);
if (parentWaypoint !== null) {
this.updateWaypoint(parentWaypoint);
}
});
}
onload() {
return __async(this, null, function* () {
yield this.loadSettings();
this.app.workspace.onLayoutReady(() => __async(this, null, function* () {
this.registerEvent(this.app.vault.on("create", (file) => {
this.log("create " + file.name);
this.foldersWithChanges.add(file.parent);
this.scheduleUpdate();
}));
this.registerEvent(this.app.vault.on("delete", (file) => {
this.log("delete " + file.name);
const parentFolder = this.getParentFolder(file.path);
if (parentFolder !== null) {
this.foldersWithChanges.add(parentFolder);
this.scheduleUpdate();
}
}));
this.registerEvent(this.app.vault.on("rename", (file, oldPath) => {
this.log("rename " + file.name);
this.foldersWithChanges.add(file.parent);
const parentFolder = this.getParentFolder(oldPath);
if (parentFolder !== null) {
this.foldersWithChanges.add(parentFolder);
}
this.scheduleUpdate();
}));
this.registerEvent(this.app.vault.on("modify", this.detectWaypointFlag));
}));
this.addSettingTab(new WaypointSettingsTab(this.app, this));
});
}
onunload() {
}
isFolderNote(file) {
if (this.settings.folderNoteType === FolderNoteType.InsideFolder) {
return file.basename == file.parent.name;
} else if (this.settings.folderNoteType === FolderNoteType.OutsideFolder) {
if (file.parent) {
return this.app.vault.getAbstractFileByPath(this.getCleanParentPath(file) + file.basename) instanceof import_obsidian.TFolder;
}
return false;
}
}
getCleanParentPath(node) {
if (node.parent instanceof import_obsidian.TFolder && node.parent.isRoot()) {
return "";
} else {
return node.parent.path + "/";
}
}
printWaypointError(file, error) {
return __async(this, null, function* () {
this.log("Creating waypoint error in " + file.path);
const text = yield this.app.vault.read(file);
const lines = text.split("\n");
let waypointIndex = -1;
for (let i = 0; i < lines.length; i++) {
const trimmed = lines[i].trim();
if (trimmed === this.settings.waypointFlag) {
waypointIndex = i;
}
}
if (waypointIndex === -1) {
console.error("Error: No waypoint flag found while trying to print error.");
return;
}
lines.splice(waypointIndex, 1, error);
yield this.app.vault.modify(file, lines.join("\n"));
});
}
updateWaypoint(file) {
return __async(this, null, function* () {
this.log("Updating waypoint in " + file.path);
let fileTree;
if (this.settings.folderNoteType === FolderNoteType.InsideFolder) {
fileTree = yield this.getFileTreeRepresentation(file.parent, file.parent, 0, true);
} else if (this.settings.folderNoteType === FolderNoteType.OutsideFolder) {
const folder = this.app.vault.getAbstractFileByPath(this.getCleanParentPath(file) + file.basename);
if (folder instanceof import_obsidian.TFolder) {
fileTree = yield this.getFileTreeRepresentation(file.parent, folder, 0, true);
}
}
const waypoint = `${_Waypoint.BEGIN_WAYPOINT}
${fileTree}
${_Waypoint.END_WAYPOINT}`;
const text = yield this.app.vault.read(file);
const lines = text.split("\n");
let waypointStart = -1;
let waypointEnd = -1;
for (let i = 0; i < lines.length; i++) {
const trimmed = lines[i].trim();
if (waypointStart === -1 && (trimmed === this.settings.waypointFlag || trimmed === _Waypoint.BEGIN_WAYPOINT)) {
waypointStart = i;
} else if (waypointStart !== -1 && trimmed === _Waypoint.END_WAYPOINT) {
waypointEnd = i;
break;
}
}
if (waypointStart === -1) {
console.error("Error: No waypoint found while trying to update " + file.path);
return;
}
this.log("Waypoint found at " + waypointStart + " to " + waypointEnd);
lines.splice(waypointStart, waypointEnd !== -1 ? waypointEnd - waypointStart + 1 : 1, waypoint);
yield this.app.vault.modify(file, lines.join("\n"));
});
}
getFileTreeRepresentation(rootNode, node, indentLevel, topLevel = false) {
return __async(this, null, function* () {
const bullet = " ".repeat(indentLevel) + "-";
if (node instanceof import_obsidian.TFile) {
if (node.path.endsWith(".md")) {
if (this.settings.useWikiLinks) {
return `${bullet} [[${node.basename}]]`;
} else {
return `${bullet} [${node.basename}](${this.getEncodedUri(rootNode, node)})`;
}
}
return null;
} else if (node instanceof import_obsidian.TFolder) {
let text = "";
if (!topLevel || this.settings.showEnclosingNote) {
text = `${bullet} **${node.name}**`;
let folderNote;
if (this.settings.folderNoteType === FolderNoteType.InsideFolder) {
folderNote = this.app.vault.getAbstractFileByPath(node.path + "/" + node.name + ".md");
} else if (this.settings.folderNoteType === FolderNoteType.OutsideFolder) {
if (node.parent) {
folderNote = this.app.vault.getAbstractFileByPath(node.parent.path + "/" + node.name + ".md");
}
}
if (folderNote instanceof import_obsidian.TFile) {
if (this.settings.useWikiLinks) {
text = `${bullet} **[[${folderNote.basename}]]**`;
} else {
text = `${bullet} **[${folderNote.basename}](${this.getEncodedUri(rootNode, folderNote)})**`;
}
if (!topLevel) {
if (this.settings.stopScanAtFolderNotes) {
return text;
} else {
const content = yield this.app.vault.cachedRead(folderNote);
if (content.includes(_Waypoint.BEGIN_WAYPOINT) || content.includes(this.settings.waypointFlag)) {
return text;
}
}
}
}
}
if (node.children && node.children.length > 0) {
let children = node.children;
children = children.sort((a, b) => {
return a.name.localeCompare(b.name, void 0, { numeric: true, sensitivity: "base" });
});
if (!this.settings.showFolderNotes) {
if (this.settings.folderNoteType === FolderNoteType.InsideFolder) {
children = children.filter((child) => this.settings.showFolderNotes || child.name !== node.name + ".md");
} else if (this.settings.folderNoteType === FolderNoteType.OutsideFolder) {
const folderNames = new Set();
for (const element of children) {
if (element instanceof import_obsidian.TFolder) {
folderNames.add(element.name + ".md");
}
}
children = children.filter((child) => child instanceof import_obsidian.TFolder || !folderNames.has(child.name));
}
}
if (children.length > 0) {
const nextIndentLevel = topLevel && !this.settings.showEnclosingNote ? indentLevel : indentLevel + 1;
text += (text === "" ? "" : "\n") + (yield Promise.all(children.map((child) => this.getFileTreeRepresentation(rootNode, child, nextIndentLevel)))).filter(Boolean).join("\n");
}
return text;
} else {
return `${bullet} **${node.name}**`;
}
}
return null;
});
}
getEncodedUri(rootNode, node) {
if (rootNode.isRoot()) {
return `./${encodeURI(node.path)}`;
}
return `./${encodeURI(node.path.substring(rootNode.path.length + 1))}`;
}
locateParentWaypoint(node, includeCurrentNode) {
return __async(this, null, function* () {
this.log("Locating parent waypoint of " + node.name);
let folder = includeCurrentNode ? node : node.parent;
while (folder) {
let folderNote;
if (this.settings.folderNoteType === FolderNoteType.InsideFolder) {
folderNote = this.app.vault.getAbstractFileByPath(folder.path + "/" + folder.name + ".md");
} else if (this.settings.folderNoteType === FolderNoteType.OutsideFolder) {
if (folder.parent) {
folderNote = this.app.vault.getAbstractFileByPath(this.getCleanParentPath(folder) + folder.name + ".md");
}
}
if (folderNote instanceof import_obsidian.TFile) {
this.log("Found folder note: " + folderNote.path);
const text = yield this.app.vault.cachedRead(folderNote);
if (text.includes(_Waypoint.BEGIN_WAYPOINT) || text.includes(this.settings.waypointFlag)) {
this.log("Found parent waypoint!");
return folderNote;
}
}
folder = folder.parent;
}
this.log("No parent waypoint found.");
return null;
});
}
getParentFolder(path) {
const abstractFile = this.app.vault.getAbstractFileByPath(path.split("/").slice(0, -1).join("/"));
if (abstractFile instanceof import_obsidian.TFolder) {
return abstractFile;
} else {
return null;
}
}
log(message) {
if (this.settings.debugLogging) {
console.log(message);
}
}
loadSettings() {
return __async(this, null, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __async(this, null, function* () {
yield this.saveData(this.settings);
});
}
};
var Waypoint = _Waypoint;
Waypoint.BEGIN_WAYPOINT = "%% Begin Waypoint %%";
Waypoint.END_WAYPOINT = "%% End Waypoint %%";
var WaypointSettingsTab = class extends import_obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Waypoint Settings" });
new import_obsidian.Setting(this.containerEl).setName("Folder Note Style").setDesc("Select the style of folder note used.").addDropdown((dropdown) => dropdown.addOption(FolderNoteType.InsideFolder, "Folder Name Inside").addOption(FolderNoteType.OutsideFolder, "Folder Name Outside").setValue(this.plugin.settings.folderNoteType).onChange((value) => __async(this, null, function* () {
this.plugin.settings.folderNoteType = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Show Folder Notes").setDesc("If enabled, folder notes will be listed alongside other notes in the generated waypoints.").addToggle((toggle) => toggle.setValue(this.plugin.settings.showFolderNotes).onChange((value) => __async(this, null, function* () {
this.plugin.settings.showFolderNotes = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Show Enclosing Note").setDesc("If enabled, the name of the folder note containing the waypoint will be listed at the top of the generated waypoints.").addToggle((toggle) => toggle.setValue(this.plugin.settings.showEnclosingNote).onChange((value) => __async(this, null, function* () {
this.plugin.settings.showEnclosingNote = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Stop Scan at Folder Notes").setDesc("If enabled, the waypoint generator will stop scanning nested folders when it encounters a folder note. Otherwise, it will only stop if the folder note contains a waypoint.").addToggle((toggle) => toggle.setValue(this.plugin.settings.stopScanAtFolderNotes).onChange((value) => __async(this, null, function* () {
this.plugin.settings.stopScanAtFolderNotes = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Use WikiLinks").setDesc("If enabled, links will be generated like [[My Page]] instead of [My Page](../Folder/My%Page.md).").addToggle((toggle) => toggle.setValue(this.plugin.settings.useWikiLinks).onChange((value) => __async(this, null, function* () {
this.plugin.settings.useWikiLinks = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Waypoint Flag").setDesc("Text flag that triggers waypoint generation in a folder note. Must be surrounded by double-percent signs.").addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.waypointFlag).setValue(this.plugin.settings.waypointFlag).onChange((value) => __async(this, null, function* () {
if (value && value.startsWith("%%") && value.endsWith("%%") && value !== "%%" && value !== "%%%" && value !== "%%%%") {
this.plugin.settings.waypointFlag = value;
} else {
this.plugin.settings.waypointFlag = DEFAULT_SETTINGS.waypointFlag;
console.error("Error: Waypoint flag must be surrounded by double-percent signs.");
}
yield this.plugin.saveSettings();
})));
const postscriptElement = containerEl.createEl("div", {
cls: "setting-item"
});
const descriptionElement = postscriptElement.createDiv({ cls: "setting-item-description" });
descriptionElement.createSpan({ text: "For instructions on how to use this plugin, check out the README on " });
descriptionElement.createEl("a", { attr: { "href": "https://github.com/IdreesInc/Waypoint" }, text: "GitHub" });
descriptionElement.createSpan({ text: " or get in touch with the author " });
descriptionElement.createEl("a", { attr: { "href": "https://twitter.com/IdreesInc" }, text: "@IdreesInc" });
postscriptElement.appendChild(descriptionElement);
}
};

View File

@@ -0,0 +1,10 @@
{
"id": "waypoint",
"name": "Waypoint",
"version": "1.3.0",
"minAppVersion": "0.12.0",
"description": "Easily generate dynamic content maps in your folder notes. Enables folders to show up in the graph view and removes the need for messy tags!",
"author": "Idrees Hassan",
"authorUrl": "https://idreesinc.com",
"isDesktopOnly": false
}