Skip to content

Add option to define function to customize dailies #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dominiwe
Copy link

@dominiwe dominiwe commented Jun 7, 2025

Add option to define function to customize dailies

Adds an option func to the daily notes options that allows for more advanced customization of where dailies are located. The function gets the time and can return the path and optionally the alias.

Here is an example of how it could be defined:

daily_notes = {
  alias_format = "%B %-d, %Y",
  workdays_only = false,
  func = function(datetime)
    local note = os.date("%Y/%m-%B/%Y-%m-%d", datetime)
    return "journal/" .. note .. ".md"
  end,
},

This would result in the following daily notes structure:

journal
└── 2025
    ├── 05-May
    │   └── 2025-05-08.md
    └── 06-June
        ├── 2025-06-06.md
        └── 2025-06-07.md

PR Checklist

  • The PR contains a description of the changes
  • I read the [CONTRIBUTING.md] file
  • The CHANGELOG.md is updated
  • The changes are documented in the README.md file
  • The code complies with make chores (for style, lint, types, and tests)

Adds an option `func` to the daily notes options that allows
for more advanced customization of where dailies are located.

Here is an example of how it could be defined:

```lua
daily_notes = {
  alias_format = "%B %-d, %Y",
  workdays_only = false,
  func = function(datetime)
    local note = os.date("%Y/%m-%B/%Y-%m-%d", datetime)
    return "journal/" .. note .. ".md"
  end,
},
```
Comment on lines +646 to 650
-- TODO: Check the notes created by custom daily notes func...

if self.opts.daily_notes.folder ~= nil then
paths_to_check[#paths_to_check + 1] = self.dir / self.opts.daily_notes.folder / fname
end
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still unsure about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant