From 0c29e1685644240c84a42c65c19dda8bff76b69d Mon Sep 17 00:00:00 2001 From: Ole Eskild Steensen Date: Wed, 23 Mar 2022 16:18:49 +0100 Subject: [PATCH 1/4] Bumped version --- Publisher.ts | 5 ++++- main.ts | 2 +- manifest.json | 4 ++-- versions.json | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Publisher.ts b/Publisher.ts index f07c5e70..e5020dee 100644 --- a/Publisher.ts +++ b/Publisher.ts @@ -225,7 +225,10 @@ export default class Publisher { prettyName = prettyName || linkedFileName; if (linkedFileName.includes("#")) { - linkedFileName = linkedFileName.split("#")[0]; + const headerSplit = linkedFileName.split("#"); + //currently no support for linking to nested heading with multiple #s + linkedFileName = headerSplit.length > 1 ? `${headerSplit[0]}#${headerSplit[1]}` : headerSplit[0]; + } const fullLinkedFilePath = getLinkpath(linkedFileName); const linkedFile = this.metadataCache.getFirstLinkpathDest(fullLinkedFilePath, filePath); diff --git a/main.ts b/main.ts index 1f805b22..300e6d59 100644 --- a/main.ts +++ b/main.ts @@ -26,7 +26,7 @@ export default class DigitalGarden extends Plugin { publishModal: PublishModal; async onload() { - this.appVersion = "2.7.0"; + this.appVersion = "2.8.0"; //If current appversion in settings unmatches this, show new notice with info about updating the template console.log("Initializing DigitalGarden plugin v" + this.appVersion); diff --git a/manifest.json b/manifest.json index 2b680bee..f6f78751 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "id": "digitalgarden", "name": "Digital Garden", - "version": "2.7.0", + "version": "2.8.0", "minAppVersion": "0.12.0", "description": "Publish your notes to a digital garden for others to enjoy.", "author": "Ole Eskild Steensen", "authorUrl": "https://ole.dev/garden", "isDesktopOnly": false -} \ No newline at end of file +} diff --git a/versions.json b/versions.json index 884587dc..7480e01f 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { + "2.8.0": "0.12.0", "2.7.0": "0.12.0", "2.6.2": "0.12.0", "2.6.1": "0.12.0", @@ -19,4 +20,4 @@ "1.2.0": "0.12.0", "1.1.0": "0.12.0", "1.0.0": "0.12.0" -} \ No newline at end of file +} From 034e1def08d2a77cc8e57fa515d9347beb45911a Mon Sep 17 00:00:00 2001 From: Ole Eskild Steensen Date: Wed, 23 Mar 2022 16:30:28 +0100 Subject: [PATCH 2/4] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a974a8fe..1989e697 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ dg-publish: true 8. Go to your site's URL which you should find on [Netlify](https://app.netlify.com). If nothing shows up yet, wait a minute and refresh. Your note should now appear. Congratulations, you now have your own digital garden, hosted free of charge! -You can now start adding links as you usually would in Obisidan, with double square brackets like this: [[Some Other Note]]) to the note that you just published. Remember to also publish the notes your are linking to as this will not happen automatically. This is by design. You are always in control of what notes you actually want to publish. If you did not publish a linked note, the link will simply lead to a site telling the user that this note does not exist. +You can now start adding links as you usually would in Obisidan, with double square brackets like this: [[Some Other Note]]) to the note that you just published. You can also link to a specific header by using the syntax [[Some Other Note#A Header]]. Remember to also publish the notes your are linking to as this will not happen automatically. This is by design. You are always in control of what notes you actually want to publish. If you did not publish a linked note, the link will simply lead to a site telling the user that this note does not exist. ## Commands @@ -149,4 +149,4 @@ By default, all notes except the home-note shows a link back to the home-note. I --- dg-home-link: false --- -``` \ No newline at end of file +``` From ee44c0ce91661ecc1fd0b0fd7c73e5f6b5890e41 Mon Sep 17 00:00:00 2001 From: Ole Eskild Steensen Date: Wed, 23 Mar 2022 16:37:26 +0100 Subject: [PATCH 3/4] Fixed headerlink logic --- Publisher.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Publisher.ts b/Publisher.ts index e5020dee..c4923f5f 100644 --- a/Publisher.ts +++ b/Publisher.ts @@ -224,10 +224,11 @@ export default class Publisher { let [linkedFileName, prettyName] = textInsideBrackets.split("|"); prettyName = prettyName || linkedFileName; + let headerPath = ""; if (linkedFileName.includes("#")) { - const headerSplit = linkedFileName.split("#"); + linkedFilename = linkedFileName.split("#")[0]; //currently no support for linking to nested heading with multiple #s - linkedFileName = headerSplit.length > 1 ? `${headerSplit[0]}#${headerSplit[1]}` : headerSplit[0]; + headerPath = headerSplit.length > 1 ? `#${headerSplit[1]}` : ''; } const fullLinkedFilePath = getLinkpath(linkedFileName); @@ -235,7 +236,7 @@ export default class Publisher { if (linkedFile.extension === "md") { const extensionlessPath = linkedFile.path.substring(0, linkedFile.path.lastIndexOf('.')); - convertedText = convertedText.replace(linkedFileMatch, `[[${extensionlessPath}|${prettyName}]]`); + convertedText = convertedText.replace(linkedFileMatch, `[[${extensionlessPath}${headerPath}|${prettyName}]]`); } } catch { continue; From 8791721c0ddfb96fe349a63c022f107c2a1b90ec Mon Sep 17 00:00:00 2001 From: Ole Eskild Steensen Date: Wed, 23 Mar 2022 16:46:05 +0100 Subject: [PATCH 4/4] Show #Header as part of linktitle --- Publisher.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Publisher.ts b/Publisher.ts index c4923f5f..e172678b 100644 --- a/Publisher.ts +++ b/Publisher.ts @@ -226,7 +226,8 @@ export default class Publisher { prettyName = prettyName || linkedFileName; let headerPath = ""; if (linkedFileName.includes("#")) { - linkedFilename = linkedFileName.split("#")[0]; + const headerSplit = linkedFileName.split("#"); + linkedFileName = headerSplit[0]; //currently no support for linking to nested heading with multiple #s headerPath = headerSplit.length > 1 ? `#${headerSplit[1]}` : '';