Skip to content

Commit e1fddfb

Browse files
authored
Merge pull request #20 from SebastianMC/19-improve-handling-of-the-designated-note
19 improve handling of the designated note
2 parents 8d562ee + 4cfe62a commit e1fddfb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ export default class CustomSortPlugin extends Plugin {
8282
// - files with designated name (sortspec.md by default)
8383
// - files with the same name as parent folders (aka folder notes): References/References.md
8484
// - the file explicitly indicated in documentation, by default Inbox/Inbox.md
85-
if (aFile.name === SORTSPEC_FILE_NAME || aFile.basename === parent.name || aFile.path === this.settings.additionalSortspecFile) {
85+
if (aFile.name === SORTSPEC_FILE_NAME ||
86+
aFile.basename === parent.name ||
87+
aFile.basename === this.settings.additionalSortspecFile || // (A) 'Inbox/sort' === setting 'Inbox/sort'
88+
aFile.path === this.settings.additionalSortspecFile || // (B) 'Inbox/sort.md' === setting 'Inbox/sort.md'
89+
aFile.path === this.settings.additionalSortspecFile + '.md' // (C) 'Inbox/sort.md.md' === setting 'Inbox/sort.md'
90+
) {
8691
const sortingSpecTxt: string = mCache.getCache(aFile.path)?.frontmatter?.[SORTINGSPEC_YAML_KEY]
8792
if (sortingSpecTxt) {
8893
anySortingSpecFound = true
@@ -328,9 +333,9 @@ class CustomSortSettingTab extends PluginSettingTab {
328333

329334
new Setting(containerEl)
330335
.setName('Path to the designated note containing sorting specification')
331-
.setDesc('The YAML front matter of this note will be scanned for sorting specification, in addition to the sortspec.md notes and folder notes. Remember to add the `.md` explicitly here.')
336+
.setDesc('The YAML front matter of this note will be scanned for sorting specification, in addition to the `sortspec` notes and folder notes. The `.md` filename suffix is optional.')
332337
.addText(text => text
333-
.setPlaceholder('e.g. Inbox/Inbox.md')
338+
.setPlaceholder('e.g. Inbox/sort')
334339
.setValue(this.plugin.settings.additionalSortspecFile)
335340
.onChange(async (value) => {
336341
this.plugin.settings.additionalSortspecFile = value.trim() ? normalizePath(value) : '';

0 commit comments

Comments
 (0)