nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.38k stars 209 forks source link

Feature Request: Simple Journal Template Transformation? #1585

Open pankajgarkoti opened 2 weeks ago

pankajgarkoti commented 2 weeks ago

Issues

Feature description

I have a journal template that I use daily, and I would like to streamline the process of creating new journal entries by automatically transferring tasks from the previous day.

Current Template


___

*DDDD DDDD-MM-YY*

___

* Tasks
    - ( ) Task 1
    - ( ) Task 2
* Logs
    > Logs of the day
    - HH:mm:ss describe what you're doing
* Notes
    > Any additional notes
* /Template Version: YYYY-MM-DD/

Entry for 2024-09-24

___
*Tuesday 2024-09-24*
___

* Tasks
    - ( ) world domination
    - (x) grocery shopping
* Logs
    > Logs of the day
    - HH:mm:ss describe what you're doing
* Notes
    > Any additional notes
* /Template Version: 2024-09-24/

Entry for 2024-09-25

___
*Wednesday 2024-09-25*
___

* Tasks
    - ( ) world domination # Automatically transferred from the previous day #
* Logs
    > Logs of the day
    - HH:mm:ss describe what you're doing
* Notes
    > Any additional notes
* /Template Version: 2024-09-24/

Want

As shown in the examples, I want to:

Implementation Suggestion


Is this already possible in Neorg? If not, would this be a feature the community is interested in? Otherwise, I plan to implement it as a macro in my configuration.

Help

Yes, but I don't know how to start. I would need guidance

Implementation help

benlubas commented 4 days ago

The general idea of dynamic templates for your journal is covered in a external module neorg-templates which I highly recommend. And implementing some sort of task carryover would be best done in that plugin I think.

I attempted a "task carryover" feature myself dots. Unfortunately, the way I wanted to do this with Treesitter is inconsistent b/c of a bug in the TS parser that prevented matching something that looked like this:

** heading with a specific name

  - ( ) tasks after a blank line

As far as implementation details, you could search for all todo items very easily with just a single TS query if you don't care about what heading they're under, then you could just return them from a function that you turn into a snippet node in neorg-templates.

You could then contribute that function to neorg-templates, or just keep it for yourself and share it in a discussion in the neorg-templates repo.