Use case or problem
- task-management integration in Obsidian using Todo.Txt format
- matching and filtering by properties:
price: (25 .. 30)USD
- filtering stuff due for spaced-repetition
- Expiration date or reminder for notes
- search notes by creation/modification date
- …
Proposed solution
OPTION 1:
Proposed syntax is combination of:
-
double dot
“..
” is used to denote range in some programming languages and does not play any other common role, except parent directory in file path. -
interval notation
Allows concise inclusion/exclusion of bounding values and AFAIK, every student learns it in school. - Interval notation alone without double dot would be easily confused with other meanings (markdown links, ordinary parenthesis, yaml lists, …).
- Proposed syntax (see examples) is distinct enough to avoid need for escaping in most cases. When search for unusual literal string like
due:(a .. b]
is needed anyway, then use regular expression/due:\(a \.\. b \]/
.
OPTION 2:
Double dot can be replaced by another keyword, e.g. (a TO b)
.
OPTION 3:
Alternative using just one type of brackets:
- Include both starting/ending values in range:
(a .. b)
- Precede starting/ending value by “
-
” to exclude it from the range.
(-a .. b)
,(a .. -b)
,(-a .. -b)
This is consistent with current exclusion syntax in search. - To express negative numbers, enclose them in parentheses:
-
( (-5) .. 5 )
= range from minus five to plus five including both ends -
( -(-5) .. -(5) )
= range from minus five to plus five excluding both ends
-
Examples
-
[2020-11-23 .. 2020-12-23]
includes all dates between 2020-11-23 (including) and 2020-12-23 (including) -
(2020-11-23 .. 2020-12-23]
as above but 2020-11-23 is excluded -
(2020-11-23 .. )
or(2020-11-23 .. ]
includes all dates after 2020-11-23 (excluding) -
[2020-01-01 .. yesterday]
,[today .. today+7days]
common time-describing words could be recognized in ranges or maybe they could be specified using some format for variables, e.g.{{yesterday}}
or!yesterday
(reminds of transclusion syntax). -
[2020-11-23 .. 2030)
when at least one bounding value is in format YYYY-MM-DD, then the other value is treated as date also. -
[-55.5 .. 66]
number range, including negative and non-integer values. In settings would have list of characters that match as decimal separator, e.g. “.,”. -
(20201123 .. 20211123]
Number range allows also to search dates in concise format. -
[0.5 .. 0.9.18.1b]
When at least one bounding values contains more than one dot, then dot-separated sequences are considered. Use case: Matching versions. -
due:(2020-11-23 .. 2021-11-23]
range syntax can be recognized within phrases. -
possible extension to other value types, e.g. strings
["string1" .. "string2")
to get “index” or “dictionary”. -
Syntax for range should work together with specification of path in nested yaml metadata.
E.g. something likeSRS/past-repetitions/[2020-09-01 .. 2020-12-01)
would match in YAML:
SRS:
next-repetition: 2021-12-23
past-repetitions:
- 2020-01-01
- 2020-10-10
- Why Date/time in ISO 8601 format? Because it is language independent and elements are ordered by time-scale: millennia→centuries→decades→years→months→days→hours→…
Current workarounds
- producing search string listing each date belonging to range: Search a range of dates with Keyboard Maestro on macOS
- -: Produced search string is excessively long and needs to be produced externally again each time we change the end date. Out of question for floating point numbers.
- complicated regular expressions
- existing implementation of number-ranges alone (not within phrase) in interval notation: https://www.emeditor.com/text-editor-features/history/new-in-version-18-4/
Related feature requests
- general:
- task management in Obsidian:
- spaced repetition within Obsidian:
- time-based variables
keywords: after, before, begin, bounded, deadline, duration, end, future, greater than, infinity, less than, limit, past, period, range, scope, sequence, span, start, stop, time