Skip to content

Commit b165bff

Browse files
committed
Capture frontmatter insertion fix and replace linebreak in insert after
1 parent 9d2ca05 commit b165bff

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ Quickly add new pages or content to your vault.
99
You can also do a [manual installation](docs/ManualInstallation.md).
1010

1111
## What's new?
12-
### 0.3.6 - 0.3.7
12+
### 0.3.6 - 0.3.8
1313
- Added setting to create the 'Insert After' line if it isn't found.
1414
- (HOTFIX) Escape regular expression special characters in Insert After when searching for it
15+
- (HOTFIX) Insert _after_ frontmatter
1516

1617
### 0.3.5
1718
- You can now execute [inline JavaScript](docs/InlineScripts.md) in templates or captures.

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "quickadd",
33
"name": "QuickAdd",
4-
"version": "0.3.7",
4+
"version": "0.3.8",
55
"minAppVersion": "0.12.5",
66
"description": "Quickly add new pages or content to your vault.",
77
"author": "Christian B. B. Houmann",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quickadd",
3-
"version": "0.3.7",
3+
"version": "0.3.8",
44
"description": "Quickly add new pages or content to your vault.",
55
"main": "main.js",
66
"scripts": {

src/formatters/captureChoiceFormatter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ export class CaptureChoiceFormatter extends CompleteFormatter {
5454
const targetPosition = fileContentLines.findIndex(line => targetRegex.test(line));
5555
if (targetPosition === -1) {
5656
if (this.choice.insertAfter?.createIfNotFound) {
57-
const insertAfterLineAndFormatted: string = `${await this.format(this.choice.insertAfter.after)}\n${formatted}`;
57+
const insertAfterLine: string = this.replaceLinebreakInString(await this.format(this.choice.insertAfter.after));
58+
const insertAfterLineAndFormatted: string = `${insertAfterLine}\n${formatted}`;
5859

5960
if (this.choice.insertAfter?.createIfNotFoundLocation === CREATE_IF_NOT_FOUND_TOP) {
6061
const frontmatterEndPosition = this.file ? await this.getFrontmatterEndPosition(this.file) : 0;
61-
return this.insertTextAfterPositionInBody(insertAfterLineAndFormatted, this.fileContent, frontmatterEndPosition - 1);
62+
return this.insertTextAfterPositionInBody(insertAfterLineAndFormatted, this.fileContent, frontmatterEndPosition);
6263
}
6364
else {
6465
return this.insertTextAfterPositionInBody(insertAfterLineAndFormatted, this.fileContent, fileContentLines.length - 1);

versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"0.2.16": "0.12.4",
3-
"0.3.7": "0.12.5"
3+
"0.3.8": "0.12.5"
44
}

0 commit comments

Comments
 (0)