Skip to content

Commit

Permalink
fix: render Templater syntax when inserting into active file
Browse files Browse the repository at this point in the history
Logic for rendering Templater syntax was left out of previous updates by mistake. This re-adds it.

fix #440
  • Loading branch information
chhoumann committed Apr 5, 2023
1 parent b572764 commit 533383e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/engine/CaptureChoiceEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
appendToCurrentLine,
openFile,
replaceTemplaterTemplatesInCreatedFile,
templaterParseTemplate,
} from "../utilityObsidian";
import { VALUE_SYNTAX } from "../constants";
import type QuickAdd from "../main";
Expand Down Expand Up @@ -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);
}
Expand All @@ -74,6 +80,7 @@ export class CaptureChoiceEngine extends QuickAddChoiceEngine {
file,
""
);

appendToCurrentLine(markdownLink, this.app);
}

Expand Down

1 comment on commit 533383e

@vercel
Copy link

@vercel vercel bot commented on 533383e Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

quickadd – ./

quickadd.obsidian.guide
quickadd-chrisbbh.vercel.app
quickadd-git-master-chrisbbh.vercel.app

Please sign in to comment.