4.4.0: custom groups and filters support variables, functions, if and return statements
What's Changed
Please restart Obsidian after updating the plugin. Thank you.
Here are the most notable user-visible changes.
π Features
- feat: Support variables and more in custom filters and groups by @claremacrae in #2179
The following can now be used in filter by function
and group by function
:
- Named variables
- Functions
if
statementsreturn
There are some simple examples in the Expressions docs page.
For example, Before:
# 4 places need updating to change from using task.due to, say, task.happens:
group by function (!task.due.moment) ? '%%4%% ==Undated==' : task.due.moment.isBefore(moment(), 'day') ? '%%1%% ==Overdue==' : task.due.moment.isSame(moment(), 'day') ? '%%2%% ==Today==' : '%%3%% ==Future=='
After:
# Only 1 place needs updating to change from using task.due to, say, task.happens:
group by function const date = task.due.moment; return (!date) ? '%%4%% ==Undated==' : date.isBefore(moment(), 'day') ? '%%1%% ==Overdue==' : date.isSame(moment(), 'day') ? '%%2%% ==Today==' : '%%3%% ==Future=='
Full Changelog (including changes too small to note above, and that do not affect the behaviour of the plugin itself):