[father::元笔记汇总]
官方文档
官方完整文档
Dataview (blacksmithgu.github.io)
梗概
- dataview插件:一个高级的内嵌笔记自动搜索器
适用范围
作用
可以自定义笔记显示样式
- 甚至能以树状图进行显示
场景
- 做笔记的自动索引
- 做笔记的自5动汇总
详解
dataview的作用
- 按照制定规则归类显示一堆文件
支持的语言:
截至2022-02-24
- dataview共提供了两种语言
- DQL(Dataview Query Language)
- 官方自创的语言
- 简单易用,功能够用
- DataviewJS:
- 一个高性能的JavaScript API,可以完全访问Dataview索引和一些方便的渲染实用程序。
- DQL(Dataview Query Language)
- 以上两种语言都有两种用法
- 写在多行代码块中
- 在代码块头加上
dataview或dataviewjs
- 在代码块头加上
- 写在单行代码块中
- 加上前缀
=(该前缀可以在设置中自定义)
- 加上前缀
- 写在多行代码块中
DQL(Dataview Query Language)的语法
- 先选择要怎么展示文件(有list或table或task)
- 直接在第一行写list或table或task即可
- 选择展示的文件范围(可以选择文件夹或标签)
- 在新的一行写上
from "文件夹名"或from #标签 - 如果不写,就默认是所有文件
- 在新的一行写上
- 填写以文件为单位的过滤条件
- 在新的一行写
where 针对每个文件元数据的条件表达式- 元数据的来源
- 官方自动为每个文件索引的元数据
file.name: The file title (a string).file.folder: The path of the folder this file belongs to.file.path: The full file path (a string).file.link: A link to the file (a link).file.size: The size (in bytes) of the file (a number).file.ctime: The date that the file was created (a date + time).file.cday: The date that the file was created (just a date).file.mtime: The date that the file was last modified (a date + time).file.mday: The date that the file was last modified (just a date).file.tags: An array of all unique tags in the note. Subtags are broken down by each level, so will be stored in the array as#Tag/1/A``[#Tag, #Tag/1, #Tag/1/A]file.etags: An array of all explicit tags in the note; unlikefile.tags, does not include subtags.file.inlinks: An array of all incoming links to this file.file.outlinks: An array of all outgoing links from this file.file.aliases: An array of all aliases for the note.file.tasks: An array of all tasks (I.e.- [ ] blah blah blah, ) in this file.
- 自定义添加的元数据
- 用
YAML格式在文件头创建键值对
- 用
- 官方自动为每个文件索引的元数据
- 对元数据的处理
- 官方内置封装了非常多的处理函数,直接调用即可
- 条件判断函数
- 官方内置封装了很多条件判断函数
- 一些常用的判断函数总结
regexmatch(".*测试类1-1.*", join(file.etags))ragexmatch用第一个参数的正则表达式(用""括起来,默认有/^ $/把第一个参数包围起来)来匹配第二个参数的字符串join把数组按第二个参数指定的分割符连成一个字符串,默认分隔符为逗号.
- 元数据的来源
- 当一个文件的元数据导致条件表达式最终为ture时,该文件就会被展示出来
- 在新的一行写