todotxt / todo.txt

‼️ A complete primer on the whys and hows of todo.txt.
GNU General Public License v3.0
2.33k stars 102 forks source link

key-value pairs starting with numerics #77

Open clach04 opened 1 year ago

clach04 commented 1 year ago

Came up in https://github.com/todotxt/todo.txt/issues/69 from @xsrvmy

Can/should keys be allowed to start with a number, i.e. 0-9? Current spec https://github.com/todotxt/todo.txt#additional-file-format-definitions implies this is currently allowed:

Developers should use the format key:value to define additional metadata (e.g. due:2010-01-02 as a due date).

Both key and value must consist of non-whitespace characters, which are not colons. Only one colon separates the key and value.

@rachmadaniHaryono recommends against using numbers which I concur with. However I'd go as far as saying the spec needs clarification here as this conflicts with how most people write times down, e.g. 11:00am doesn't seem to me to be a useful key of "11" and value of "00am".

clach04 commented 1 year ago

Related but possibly more of an extension https://github.com/todotxt/todo.txt/discussions/64

xsrvmy commented 1 year ago

Another possibility is that double colon will escape a colon. This is currently simply invalid syntax since a key or a value can't contain a colon.

jgclark commented 1 year ago

There appears to be a universal rule (but no spec that I can find) that says #hashtags can't start with a numeral, as they often mean a list item (as indeed they do in GH). They're not the same as keys, but I would apply the same logic.

jgclark commented 1 year ago

Also, borrowing from other key:value systems, all examples of YAML at yaml.org use a space character after the separator colon. I can't find this in the spec, but its common usage. JSON too, often is written out with a space after the separator colon. So, I suggest there has to be a good reason to disallow whitespace after the separator colon.