alangrainger / obsidian-frontmatter-modified-date

Automatically update a frontmatter/YAML modified date field
MIT License
78 stars 10 forks source link

[Feature Proposal] Add new edit history settings and functionality #20

Closed craigcent closed 2 months ago

craigcent commented 8 months ago

After I got familiar with your extension, I found myself wanting to keep both a log of my edit history and my last modification date for all new notes. Currently, the extension can either store the edit history or the last modification date but not both. In order to store both we would need to modify both the functionality of the extension and the extension settings.

We could have a toggle in settings that enables an edit history on all new notes. Additionally, we should also have a setting where we specify the edit history property name to keep it consistent with the last modification date property. Then, the extension functionality would need to be updated to respect the new toggle and to save edit history to the separate edit history property.

Since I wanted this functionality, I went ahead and implemented it in my own fork of the repo. After I implemented it, I noticed that this fixes issue #14. I also noticed that there is another fix in PR #19 by @smallstepman that has some of the same functionality. Feel free to compare them.

I also took the liberty of adding a UI for a couple of settings that were accessible in data.json but not through the settings GUI.

I would appreciate if @alangrainger could review and possibly merge the PR I will be creating soon in for these changes.

craigcent commented 8 months ago

See PR #21

alangrainger commented 2 months ago

Sorry for getting back to you so late.

Thanks for the suggestion on adding some of the hidden settings values - I will add that in.

Regarding the history YAML fields - why would there be a need for two fields? If you have a field with the list of edit dates, then the "last modification date" is the last entry in that list.

Since frontmatter is programmatically accessible, your last modified date is simply field.pop(). I plan to implement #27 which makes this even easier because your last modified date is then just field[0].

alangrainger commented 2 months ago

New settings and reverse sorting added in 1.4.0, so you can now use field[0] to reference the most recent date if you want.