From 533383e4216d8b1a69f92c424cdfe392048de3ed Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann Date: Wed, 5 Apr 2023 13:49:11 +0200 Subject: [PATCH] fix: render Templater syntax when inserting into active file Logic for rendering Templater syntax was left out of previous updates by mistake. This re-adds it. fix #440 --- src/engine/CaptureChoiceEngine.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/engine/CaptureChoiceEngine.ts b/src/engine/CaptureChoiceEngine.ts index 36a9941..8bafc5d 100644 --- a/src/engine/CaptureChoiceEngine.ts +++ b/src/engine/CaptureChoiceEngine.ts @@ -7,6 +7,7 @@ import { appendToCurrentLine, openFile, replaceTemplaterTemplatesInCreatedFile, + templaterParseTemplate, } from "../utilityObsidian"; import { VALUE_SYNTAX } from "../constants"; import type QuickAdd from "../main"; @@ -64,7 +65,12 @@ export class CaptureChoiceEngine extends QuickAddChoiceEngine { if (this.choice.captureToActiveFile && !this.choice.prepend) { - appendToCurrentLine(captureContent, this.app); + // Parse Templater syntax in the capture content. + // If Templater isn't installed, it just returns the capture content. + const content = await templaterParseTemplate(app, captureContent, file); + + appendToCurrentLine(content, this.app); + } else { await this.app.vault.modify(file, newFileContent); } @@ -74,6 +80,7 @@ export class CaptureChoiceEngine extends QuickAddChoiceEngine { file, "" ); + appendToCurrentLine(markdownLink, this.app); }