jmhobbs / jsTodoTxt

JavaScript parser for todo.txt formatted text files.
https://jstodotxt.velvetcache.org
MIT License
67 stars 14 forks source link

How does jsTodoTxt (next) detect an extension? #42

Closed ransome1 closed 1 year ago

ransome1 commented 1 year ago

Hi there.

Good jobs on the next branch, I successfully deployed it into my project and it works well.

Back in 0.1.0 we were able to define extensions. Specific patterns in the string were extracted as extensions and thus were available in the todo object.

How would I do the same in next? Let's say I want #TestTag1, #TestTag2 and #TestTag3 (part of the string) recognized as tags and put into the extensions key tags

Thanks for your support.

jmhobbs commented 1 year ago

Hmm, I'm not sure here. This is the design I have for extensions, https://github.com/jmhobbs/jsTodoTxt/pull/36

It is designed 100% around the <key>:<value> style defined in the spec https://github.com/todotxt/todo.txt#additional-file-format-definitions

I think for something like #TestTag1 that might need to be something that post-processes the Item somehow. I'm open to suggestions though!

jmhobbs commented 1 year ago

I think most of the difficulty is in keeping tags in the same position when modified, which was a weakness in how the original system worked, it would move new/altered tags to the end of the line.

ransome1 commented 1 year ago

I think can work around it somehow. And you're right, the arbitrary positioning of attributes should not be altered. It's working very well in the next branch :)