Skip to content

Commit

Permalink
feat: add date format configuration for filename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed Jun 19, 2023
1 parent b3627e8 commit f1f0a2d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,36 @@ class OmnivoreSettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName("Filename Date Format")
.setDesc(
createFragment((fragment) => {
fragment.append(
"Enter the format date for use in rendered filename. Format ",
fragment.createEl("a", {
text: "reference",
href: "https://moment.github.io/luxon/#/formatting?id=table-of-tokens",
})
);
})
)
.addText((text) =>
text
.setPlaceholder("yyyy-MM-dd")
.setValue(this.plugin.settings.filenameDateFormat)
.onChange(async (value) => {
this.plugin.settings.filenameDateFormat = value;
await this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName("Folder Date Format")
.setDesc(
createFragment((fragment) => {
fragment.append(
"Enter the format date for use in rendered template. Format ",
"Enter the format date for use in rendered folder name. Format ",
fragment.createEl("a", {
text: "reference",
href: "https://moment.github.io/luxon/#/formatting?id=table-of-tokens",
Expand Down
2 changes: 2 additions & 0 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const DEFAULT_SETTINGS: OmnivoreSettings = {
folderDateFormat: "yyyy-MM-dd",
endpoint: "https://api-prod.omnivore.app/api/graphql",
filename: "{{{title}}}",
filenameDateFormat: "yyyy-MM-dd",
attachmentFolder: "Omnivore/attachments",
version: "0.0.0",
isSingleFile: false,
Expand Down Expand Up @@ -74,4 +75,5 @@ export interface OmnivoreSettings {
intervalId: number;
frontMatterVariables: string[];
frontMatterTemplate: string;
filenameDateFormat: string;
}

0 comments on commit f1f0a2d

Please sign in to comment.