add creation-date-key modification-date-key configuration options#531
add creation-date-key modification-date-key configuration options#531BennoLossin wants to merge 7 commits intozk-org:mainfrom
creation-date-key modification-date-key configuration options#531Conversation
|
Ah I just noticed that I didn't finish the |
|
This pull request has been automatically marked as stale because it has not had recent activity. |
d188989 to
541535e
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity. |
541535e to
30d1a9a
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity. |
|
Hey, sorry for being slow here. Got some stable free time back now. Can you explain why this is needed and what effect these changes have for the user? |
|
The motivation is the following: I'm using a git repository to store my notes & sync them between multiple devices. This means that things like The user can specify |
|
Sorry again.. So the user would need to update the modification date value in the frontmatter every time the modified the file? |
|
Indeed, I have set up my editor to do that for me. Other ways to do it are for example git hooks. |
|
Ok, I'd be down to merge this. But could you also add a quick documentation in the docs about how to automate the updating of modification dates? eg, in tips |
creation-date-key modification-date-key` configuration optionscreation-date-key modification-date-key configuration options
|
There is now also an effort to auto update the modification date at zk-org/zk-nvim#272 But I'd prefer to support this on the side of the |
WhyNotHugo
left a comment
There was a problem hiding this comment.
LGTM, I only have very minor suggestions wrt reducing verbosity.
So this is good to go on the code side (thanks to WhyNotHugo), but it' still missing some example config / setup to get this working for users. It's not immediately clear how to set this up, either manually and definitely not to automate it. Both would be great. E.g, a current note looks like this: ---
title: higher complexity does not always result in more order
date: 2024-01-03
id: u6nh
tags: []
aliases:
---
...How should they add a secondary date to the frontmatter, so that zk knows which is the creation date and the modification date? This doc also needs to be updated then (which I can do to help drop the workload on documentation if needed). But I really would like docuemntation on how to implement this, with automation (even just a copy and paste snippet in tips, as above). It's a great feature and it should be used. |
These two configuration options are used to change the way zk obtains the creation date and modification date from a file.
Co-authored-by: Hugo <hugo@whynothugo.nl>
Co-authored-by: Hugo <hugo@whynothugo.nl>
2346483 to
ce3a15d
Compare
ce3a15d to
038f08b
Compare
|
Sorry for the long wait, I was very busy in the last two months. I added a lot more docs now and also included automation for neovim and git. Would probably be a good idea to also include other common editors like vscode, emacs etc. But I'm not familiar with those, so I'd leave that to others. (I also rebased onto the lastest changes from One thing that also could be done would be to add the |
|
Fantastic. Thanks for getting back on this <3 |
docs/tips/modification-date.md
Outdated
|
|
||
| #!/usr/bin/env bash |
There was a problem hiding this comment.
Hashbang in middle of script is erroneous:
| #!/usr/bin/env bash |
There was a problem hiding this comment.
seems like I left in a previous script, fixed now
| $ echo "---\ncreated: 2025-03-27 01:18:43\n---\n\n# Note" > note.md | ||
| $ zk list -qflink | ||
| >{"filename":"note"} |
There was a problem hiding this comment.
How is this testing anything related to creation date?
There was a problem hiding this comment.
I have forgotten why I wrote these tests, I removed them, feel free to suggest correct ones :)
There was a problem hiding this comment.
A tesh test would need to execute with filechanges in order to test this functionlity.
So zk new and check the creation date.
Not sure how the modified-date would be tested though, as a note would have to be opened by zk, edited and then saved..
tests/config-format-markdown-frontmatter-modification-date.tesh
Outdated
Show resolved
Hide resolved
|
I'm really looking forward to this being implemented, the lack of integrated date-tracking is the main reason why I haven't made zk my primary note-taking app. |
|
On Mon, 26 Jan 2026, at 16:07, Tillman Jex wrote:
***@***.**** commented on this pull request.
In tests/config-format-markdown-frontmatter-creation-date.tesh <#531 (comment)>:
> +$ echo "---\ncreated: 2025-03-27 01:18:43\n---\n\n# Note" > note.md
+$ zk list -qflink
+>{"filename":"note"}
A tesh test would need to execute with filechanges in order to test this functionlity.
So `zk new` and check the creation date.
Not sure how the modified-date would be tested though, as a note would have to be opened by zk, edited and then saved..
I think you can use touch to update the notes mtime and then `zk index`.
You can also set EDITOR=touch I guess?
|
|
Sorry, I won't have the time to add tests myself, if any of you want to add them, feel free to send them to me or just directly push them if that's possible. |
These two configuration options are used to change the way
zkobtains the creation date and modification date from a file.I have a lot of notes that use
createdandchangedas the keys for the creation and modification date (I store them in git and thus the true creation/modification date are useless).This also is useful when one wants to use a different language for the keys in the frontmatter.
I am pretty new to go and this is my first contribution to
zk, so I very likely have missed something.