HeroBlackInk / ultimate-todoist-sync-for-obsidian

GNU General Public License v3.0
145 stars 20 forks source link

Support for nested tags #50

Open tophee opened 1 year ago

tophee commented 1 year ago

Not sure if this is a bug report or a feature request but I noticed that tags don't sync properly for me and I think that has to do with the fact that I mostöy use nested tags. For example, all my tags designating a project start with #p/ so that the Garden project would be tagged #p/garden, but the plugin only syncs the top level tag (#p) to todoist, not the rest.

So, what I'm saying is: it would be nice if the entire tag could be synced (including the "path")

torstenfeld commented 1 year ago

I'd love to see this change as well. I use the tag paths a lot for, e.g., #people/xyz or #project/xyz.

torstenfeld commented 1 year ago

I created a pull request which should fix the issue.

tophee commented 1 year ago

Haha, one extra character is all it took!

However, will this work with tags that don’t end with a /?

torstenfeld commented 1 year ago

Yes, the position of the / doesn't matter. If you want to understand the regex better, I recommend to go to https://regex101.com/ and enter the regex into the input field at the top. Choose "ECMAScript" as the flavor on the left hand side. Afterwards, the regex will be explained in the right hand side of the page.

The regex to enter: (^|\s)(#[a-zA-Z\d\u4e00-\u9fa5-/]+)

torstenfeld commented 1 year ago

And in case you do not want to wait for a new release, you can go to the plugins directory of Obsidian and make the changes manually in the main.ts file of the plugin.

tophee commented 1 year ago

Yes, the position of the / doesn't matter.

of course not. That was a stupid comment by me. I should have looked more carefully at the regex in the PR, then I would have seen the square brackets… Now when you paste it here it is obvious.

Sorry about that. And thanks for the fix.

BTW: what would it take to replace underscores with Spaces (which are allowed in Todoist but not in Obsidian)?