pyrochlore / obsidian-tracker

A plugin tracks occurrences and numbers in your notes
MIT License
1.35k stars 231 forks source link

Can it track by adding a variable after text #6

Closed 5eagull closed 3 years ago

5eagull commented 3 years ago

Can it track by adding a variable after text, such as "weightlifting: 10". sometimes use the label to track, Obsidian label system will look very confusing .

pyrochlore commented 3 years ago

Can it track by adding a variable after text, such as "weightlifting: 10".

This plugin can track value-attached tags like "#weight:60.0kg". Note that there is no space between the colon and the value. Extra spaces in between will make the tag and the value syntactically fall apart.

sometimes use the label to track, Obsidian label system will look very confusing .

I am not sure what you met here, could you give me some examples or pictures showing the problems? I would be more than happy if the problem can be solved.

pyrochlore commented 3 years ago

By the way, if you really need a space between the colon and the value. There is a feature on the road map, allowing users to define regular expressions in searchTarget. It will be there in the near future.

5eagull commented 3 years ago

I am not sure what you met here, could you give me some examples or pictures showing the problems? I would be more than happy if the problem can be solved.

This is actually very simple, just don't want to make statistics items appear in the obsidian label.

At present, the "text" method cannot be used for counting well. It can only count the number of occurrences of keywords, and cannot use "Push-ups:10". When using tags to count, such as "#Push-ups:10", this is very convenient, but I don't want it to appear in obsidian tags.

By the way, if you really need a space between the colon and the value. There is a feature on the road map, allowing users to define regular expressions in searchTarget. It will be there in the near future.

Sorry for the misunderstanding, the presence or absence of spaces is not important.

pyrochlore commented 3 years ago

I got it. That's why I'm going to implement text search with regular expression. With that feature, the value in text can be 'extracted' using regex. As I mentioned, it's on the road map and will be there in near future.

pyrochlore commented 3 years ago

Seems this issue is more important than I thought. Not too many people like to use tags in their articles, so enhance the searching of text would be helpful. Thanks for letting me know this.

pyrochlore commented 3 years ago

Done in the dev branch. Will merge it to master in the next release.

To track something like "weightlifting: 10", now you can use a regular expression while using 'text' as searchType. See here for the detail usage.

Another option is to put the information in the frontmatter, like --- tags: weightlifting: 10 --- Then use the new searchType 'frontmatter' to do the search. Check MoodTracker for an example.