背景
按照之前对 DataView 插件的介绍,对于任务列表的使用其实就可以使用其中的 list
插件完成的,但是 DataView 插件只能完成列表的查询功能,而查询功能只能是任务列表中其中一个功能,因此就使用 DataVIew 插件是不够满足对任务列表的使用的,因此在 Obsidian 的插件库中还提供了另外一个专门针对任务列表的插件 —— Tasks
日常使用
场景一
使用 Calendar 插件记录每天需要完成的任务,而 Tasks 起到统计作用,负责记录的任务哪些已经做完,哪些还没有做完。
场景二
[!note]
如果使用 Obsidian Memos 插件和 Tasks 插件搭配使用,需要将 Memos 插件格式改为代办格式
使用 Obsidian Memos 插件作为记录需要完成任务,并且使用 TAG 来标注,方便后续 Tasks 插件查询的时候进行过滤
基础使用
创建任务
Tasks 插件提供一个窗口来创建或者编辑任务,在命令窗口搜索 Tasks: Create or edit task
命令就可以进入该窗口。
[!note]
也可以通过快捷键方法进入创建/编辑窗口,默认是shift + command + B
对于 Tasks 窗口,最简单的使用方式就是输入任务名称就算是创建完任务,当然也可以按照提供的样式来对任务进行限定,比如加上优先级,循环,期限以及开始结束时间。
以下就是添加完所有选项之后的待办任务,🔼表示优先级,🔁表示循环,🛫表示开始时间,⏳表示结束时间,📅表示期限,这和 Tasks 窗口中出现的 Emoji 表情是一一对应的,还有一种 Emoji 表情就是✅,这表示完成时间。
- [ ] DEMO 🔼 🔁 every day 🛫 2022-11-13 ⏳ 2022-11-12 📅 2022-11-06
- [x] DEMO 🔼 🔁 every day 🛫 2022-11-13 ⏳ 2022-11-12 📅 2022-11-06 ✅ 2022-11-05
除了使用 Tasks 窗口来创建 Tasks 样式的待办任务,也可以通过正常创建待办任务的方法创建 Tasks 央视的待办任务,只需要带上对应的 Emoji 表情以及对应的时间就能被 Tasks 插件识别。
[!note]
在创建待办任务的过程中,Tasks 插件会提供Auto-Suggestion
自动提示的弹窗更好的帮助用户使用该插件上的功能
过滤规则
在说明查询功能使用之前需要先介绍 Tasks 插件提供的过滤规则,方便在查询过程中进行过滤待办任务。常用的过滤规则就前面的 Done Date
,Due Date
以及 Tag
几种,剩下的都是文档中介绍
Done Date 完成时间
done
not done
no done date
has done date
done (before|after|on) <date>
done date is invalid
Due Date 期限时间
no due date
has due date
due (before|after|on) <date>
due date is invalid
Scheduled Date 结束时间
no scheduled date
has scheduled date
scheduled (before|after|on) <date>
scheduled date is invalid
Start Date 开始时间
no start date
has start date
starts (before|after|on) <date>
start date is invalid
Description 描述
- description (includes|does not include)
<string>
- description (regex matches|regex does not match)
/<JavaScript-style Regex>/
Priority 优先级
priority is (above|below)? (low|none|medium|high)
Recurrence 循环
is recurring
is not recurring
Tags 标签
tags (include|do not include) <tag>
tag (includes|does not include) <tag>
tags (regex matches|regex does not match) /<JavaScript-style Regex>/
tag (regex matches|regex does not match) /<JavaScript-style Regex>/
File Path 文件路径
path (includes|does not include) <path>
path (regex matches|regex does not match) /<JavaScript-style Regex>/
File Name 文件名称
filename (includes|does not include) <filename>
filename (regex matches|regex does not match) /<JavaScript-style Regex>/
Heading 开头
heading (includes|does not include) <string>
heading (regex matches|regex does not match) /<JavaScript-style Regex>/
查询任务
查询任务的功能和DataView很类似,也是一种类SQL的写法,其中和DataView插件和SQL最大的不同就是Tasks写法其实只是SQL中where
关键词后的过滤部分,但是没有and
关键词作为连接而是使用换行进行区分。
例子如下:
从例子中可以看出,Tasks查询除了可以使用之前上面所介绍的过滤规则,也可以定义样式或者更准确的说是功能。下面简单介绍日常使用中比较多的功能,更为详细的可以查看官方文档。
Sort 排序
urgency
(urgency)status
(done or todo)priority
(priority of the task; “low” is below “none”: priorities)start
(the date when the task starts)scheduled
(the date when the task is scheduled)due
(the date when the task is due)done
(the date when the task was done)path
(the path to the file that contains the task)description
(the description of the task)tag
(the description of the task)
例子:
Hiding/Showing Elements 组件
以下都是可以选择展示或者隐藏的组件,而日常使用的话,使用edit button
比较多,因为平时关于这类查询的文件都是预览界面,不需要进行修改编辑。
edit button
backlink
urgency
priority
start date
scheduled date
due date
done date
recurrence rule
task coun