c6p / logseq-habit-tracker

Habit tracker for Logseq
MIT License
95 stars 5 forks source link

Alternative method of habit notation #1

Closed WillPlatnick closed 2 years ago

WillPlatnick commented 2 years ago

Hello, I wanted to ask if you'd be open to an alternative method of looking for habits rather than nesting them under a habits block that doesn't work with formatting (headings).

What if instead of this opinionated nested block, we were able to tag each habit with something like #habit, so they could live anywhere in the document?

c6p commented 2 years ago

It doesn't work with headings? I should definitely fix it. Though nested block is not opinionated, you can edit Block content: to customize it.

Good idea, in the next version I am going to add a customizable habit tag option, so there will be no need for nesting.

steubens commented 2 years ago

I came here to ask for the same thing... as I go through the day I would like to be able to just tag a line in the journal as so: 14:10 pushups #habit or 14:11 #habit drink water etc...

Thank you!!

c6p commented 2 years ago

@someinternetguy since I'm tracking habits by habit text, to implement this format I'm planning to provide a habit template (regex). For your example (not final):

\d{2}:\d{2} {{habit}}

And 2 options:

If that is fine, just stay tuned, I will implement it when I find the time.

steubens commented 2 years ago

@c6p that regex looks good to my novice eyes. It would be cool if you could make it a user customizable regex so everyone can use the format they like... Also, I think having a customizable habit tag like you mentioned above would be good too. Thanks for your response and work on this 🤩.

c6p commented 2 years ago

@someinternetguy v0.2.0 released. Set habit pattern to \d{2}:\d{2} (?<habit>.*).

Instead of multiple markers as in here, I decided to use only one both for nested or inline habits, and default to #habit. README has been updated, though I need to update the images.

steubens commented 2 years ago

Thanks again @c6p! I finally had some time to test it out this evening, and it works a charm... :)