From 4353f222f2afea590deb639956ac7ffc448107ef Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 3 May 2023 14:56:33 +0200 Subject: [PATCH 1/3] fixes #10 --- src/types/MarkdownTextRenderer.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/types/MarkdownTextRenderer.ts b/src/types/MarkdownTextRenderer.ts index d1eb2e8..3d69615 100644 --- a/src/types/MarkdownTextRenderer.ts +++ b/src/types/MarkdownTextRenderer.ts @@ -50,7 +50,7 @@ export class MarkdownTextRenderer { private buildContentMarkdownText(file: TFile, indentLevel: number, isFolder = false): string { let markdownText = "" - markdownText += this.buildMarkdownLinkString(file.basename, encodeURI(file.path), indentLevel, isFolder) + markdownText += this.buildMarkdownLinkString(this.getTitleFromPath(file.path), encodeURI(file.path), indentLevel, isFolder) const headers: HeadingCache[] | null = this.app.metadataCache.getFileCache(file)?.headings if (headers && !this.plugin.settings.disableHeadlines) { @@ -103,6 +103,18 @@ export class MarkdownTextRenderer { return link } + private getTitleFromPath(path: string): string { + const file = this.app.vault.getAbstractFileByPath(path) + if (file instanceof TFile) { + const cache = this.app.metadataCache.getFileCache(file) + if (cache) { + return cache.frontmatter?.title ?? file.basename + } + return file.basename + } + return "Something went wrong. Please report this issue." + } + private buildHeaderChain(header: HeaderWrapper): string { if (header.parent) { return `${this.buildHeaderChain(header.parent)}#${encodeURI(header.header.heading)}` From 1a6cf1546a19c94a0236cbea58f1bc2bbe145e34 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 3 May 2023 15:10:48 +0200 Subject: [PATCH 2/3] obsidian-folder-index-10 --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index b58d8a4..ed90411 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,23 @@ From now on you should be able to use folders like they are a normal note! Folders will also be added to the Graph View by default and link all files that are contained within it :D +#### Manual Indexing + +You can also use the ``folder-index-content`` Block processor directly like this: + +```` +```folder-index-content +``` +```` + +to include the content of the folder index in any note you want + +#### Frontmatter + +| Key | Description | +|-------|---------------------------------------------------| +| title | This will overwrite the Filename inside the Index | + ### Manual Installation 1. Go to [Releases](https://github.com/turulix/obsidian-folder-index/releases) and download the ZIP file from the latest From d73b027f5ffde7b40c55db22dcb602dc6cc526ce Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 3 May 2023 15:11:52 +0200 Subject: [PATCH 3/3] Bump Version to 1.0.19 --- manifest.json | 2 +- package.json | 2 +- versions.json | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 066b6d8..88bc896 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-folder-index", "name": "Folder Index", - "version": "1.0.18", + "version": "1.0.19", "minAppVersion": "1.1.16", "description": "This Plugin will automatically generate a TOC for the current Folder.", "author": "turulix", diff --git a/package.json b/package.json index f692112..988c61e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-sample-plugin", - "version": "1.0.18", + "version": "1.0.19", "description": "This is a sample plugin for Obsidian (https://obsidian.md)", "main": "main.js", "scripts": { diff --git a/versions.json b/versions.json index 4ad47b4..14d2734 100644 --- a/versions.json +++ b/versions.json @@ -9,5 +9,6 @@ "1.0.15": "1.1.16", "1.0.16": "1.1.16", "1.0.17": "1.1.16", - "1.0.18": "1.1.16" + "1.0.18": "1.1.16", + "1.0.19": "1.1.16" } \ No newline at end of file