feat!(journal): periodic & multiple journals
implements #1471
Features
- Support for multiple journals, and periodic journals
- Each journal gets a name, start date, time period, and file format string/stategy
- you can specify period as either days or months + years.
- Ships with a daily, weekly, and monthly journal by default
- users can create their own journals
- all the journal commands now optionally take a journal name. When the name is left out, uses the default journal (configurable, defaults to daily).
- new commands,
:Neorg journal previous|current|next <journal_name> - each journal gets it's own template
Of Note
- looking for feedback on:
- functionality--does this cover all the cases we want? Does this ship the defaults that we want?
- user experience/configuration--anything else that should be configurable? Should each journal be able to have its own folder? or should they continue to be in the same overarching folder, with configurable subfolders/the option to not be in a subfolder?
- TOC code is untouched and untested, I think forcing each journal into its own subfolder would make the TOC implementation easier, other suggestions on how to handle it would be welcome
- The breaking change is pretty minimal right now. Templates are now configured differently, and templates files will have a new name. Instead of configuring with
template_name = template.norgit's nowbase_template_name = "template"and templates files will be created on a per-journal basis like:template-daily.norg
@maxkuzn if you have feedback on the features here that would be great
With core.tempus now being the defacto (since 0.10 is required) I can start reviewing this sooner than later. I took a general glance at it and the execution looks solid.
Had a look at this again. I think the best solution for the journal toc commands will be to make them pattern match for file names so that you get a toc specific to each journal.
I'm fairly sure it's possible to transform the path_format_strategy into a lua pattern iff the path_format_strategy is a string. When that value is a function (which is allowed) we would have to also ask the user to provide some type of filter function that takes a path and tells us if it's a part of the journal.
I think this is a fairly reasonable approach. Let me know if you have thoughts @vhyrro
just stumbled upon this after posting https://github.com/nvim-neorg/neorg/issues/1648 but seems like the general idea/concept behind this was at least similar.
as this feature here goes well beyond my quick-fix/workaround, i definitely think this would add great value to the journal module and would therefore love to see this becoming fully available.
one thing that i'm wondering about is how a unified TOC may look like for this.
some may want/prefer completely separate TOC's for each journal but at least for my intended use-case, a fused general journal-TOC would also be desireable. the big question is how this should look like, especially when a smaller timespan won't completely fit into a larger one (think of a weekly and a monthly journal where the week overlaps into another month) rendering nesting somewhat unsuitable.
it would however IMHO still make sense to aim for a fused/unified TOC but the only option i see right now would be an adequately named link (e.g. week07.start, week07.end, q1.start / q1.end , ...) at the start and at the end of a period and drop those next to the respective day.
another idea/questionmark that was popping up reading through the description was how about a possibility to express link-templates within journal templates which effectively would generate links into another journal's entries (e.g. dynamically generating and embedding a link into a newly created daily journal's entry to the surrounding weekly and/or monthly and/or quarterly journal given that such exists)? the downside of this could be that for such a thing to work, the outermost journal (e.q. quarterly) hierarchy of a new period may have to be created first followed by the inner ones in the right order. while i could imagine to easily manually edit a quarter's template, doing the same for e.g. a weekly or bi-weekly journal seems a bit tedious.
Glad you like it!
Unified toc
Yeah that would be useful. We could add a new function for it. Formatting it would be a challenge, months throw things off for sure.
We could easily do years + months + days or years + weeks (mostly work) + days.
Including months, if we want to be strict about days being correct, we could include a week that spans two separate months in both of those months, and list only the days of that week which are in the current month.
Something else to think about:
-
someone could make their own journal that reoccurs every 48 days, how do you nest that? Do we start repeating months now?
-
If someone makes a journal that repeats every 30 days, which one nests inside the other? Months or 30 days?
I think the answer to this question is to make the toc generation modular enough that users can decide how their custom journals fit in, and then default only include daily, monthly, yearly in the unified view.
Dynamic templates
There's a third party module, pysan3/neorg-templates, that allows for dynamic templates using luasnip. Highly recommend.