背景

提供灵活的查询能力,汇聚展示某个特定规则的笔记,并支持展示笔记属性。

使用时,编写类似 SQL 的 DQL 语法进行查询、过滤、排序等各种数据操作。

展示支持列表、表格和日历形式展示

插件使用

基础用法

在 Markdown 笔记插入代码块,文件类型写为 dataview 就可以使用 dataview 进行查询展示了。例如:

list
from "02-Areas"

最简单的表格

table without id file.link as "笔记"
where contains(type, "person")

table 常用的写法 table without id file. link as "笔记"

发布 Dataview 查询结果内容

参考 Using Dataview on Obsidian Publish · joschua.io 文章

使用 Obsidian Templater Plugin ,创建一个模板,在其中编写代码将 Dataview 查询结果写入到 markdown 文件中:

// Update Publish Files.md
<%*
const dv = app. plugins. plugins["dataview"]. api;
const filename = "Recently Edited";
const query = `TABLE WITHOUT ID
file. link AS Note, dateformat (file. mtime, "ff") AS Modified
FROM ""
WHERE publish SORT file. mtime desc
LIMIT 7`;
 
const tFile = tp. file. find_tfile (filename);
const queryOutput = await dv.queryMarkdown (query);
 
// write query output to file
await app.vault.modify (tFile, queryOutput. value);
%>

之后需要发布时,执行这个模板就会更新 Dataview 查询结果到笔记中。

查询带链接的属性

示例:

list
where contains(tags, [[Area.AI应用]])

效果:

list
where contains(tags, [[Area.AI应用]])

playground 体验尝试

table
where dateformat(file.created,"yyyy-MM-dd") = 2025-04-16