diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts
index 79be3383..f48a412b 100644
--- a/src/BreadcrumbsSettingTab.ts
+++ b/src/BreadcrumbsSettingTab.ts
@@ -945,6 +945,30 @@ export class BCSettingTab extends PluginSettingTab {
})
);
+ new Setting(threadingDetails)
+ .setName("New Note Name Template")
+ .setDesc(
+ fragWithHTML(
+ `When threading into a new note, choose the template for the new note name.
+ The default is {{field}} of {{current}}
.
+ Options include:
+
+ {{field}}
: the field being thread into
+ {{dir}}
: the direction being thread into
+ {{current}}
: the current note name
+ {{date}}
: the current date
+
+ `
+ )
+ )
+ .addText((text) => {
+ text.setValue(settings.threadingTemplate);
+ text.inputEl.onblur = async () => {
+ settings.threadingTemplate = text.getValue();
+ await plugin.saveSettings();
+ };
+ });
+
const debugDetails = details("Debugging");
new Setting(debugDetails)
diff --git a/src/constants.ts b/src/constants.ts
index 57bc0028..7cc64cdb 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -183,6 +183,7 @@ export const DEFAULT_SETTINGS: BCSettings = {
showAll: false,
noPathMessage: `This note has no real or implied parents`,
threadIntoNewPane: false,
+ threadingTemplate: "{{field}} of {{current}}",
trailSeperator: "→",
treatCurrNodeAsImpliedSibling: false,
trimDendronNotes: false,
diff --git a/src/interfaces.ts b/src/interfaces.ts
index 8ef7aa49..648ba633 100644
--- a/src/interfaces.ts
+++ b/src/interfaces.ts
@@ -58,6 +58,7 @@ export interface BCSettings {
showTrail: boolean;
squareDirectionsOrder: (0 | 1 | 2 | 3 | 4)[];
threadIntoNewPane: boolean;
+ threadingTemplate: string;
trailSeperator: string;
treatCurrNodeAsImpliedSibling: boolean;
trimDendronNotes: boolean;
diff --git a/src/main.ts b/src/main.ts
index ba5c1fe8..74038dde 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -434,9 +434,19 @@ export default class BCPlugin extends Plugin {
const newFileParent = app.fileManager.getNewFileParent(currFile.path);
+ const dir = getFieldInfo(userHiers, field).fieldDir;
const oppField =
- getOppFields(userHiers, field)[0] ??
- fallbackOppField(field, getFieldInfo(userHiers, field).fieldDir);
+ getOppFields(userHiers, field)[0] ?? fallbackOppField(field, dir);
+
+ let newBasename = settings.threadingTemplate
+ .replace("{{current}}", currFile.basename)
+ .replace("{{field}}", field)
+ .replace("{{dir}}", dir)
+ .replace(
+ "{{date}}",
+ new Date().toLocaleDateString().replaceAll(/[/\\]/g, "")
+ );
+
const newFile = await app.vault.create(
normalizePath(