gitmyhub

obsidian-dataview

TypeScript ★ 9.1k updated 7mo ago

A data index and query language over Markdown files, for https://obsidian.md/.

A plugin for the Obsidian note-taking app that lets you query your notes like a database, producing tables, lists, and task views from metadata you add to your files. No coding required for basic queries, a JavaScript API is available for advanced use.

TypeScriptObsidiansetup: easycomplexity 2/5

Obsidian Dataview is a plugin for Obsidian, a note-taking app where all your notes are stored as plain Markdown files on your own computer. Dataview turns your collection of notes into something you can query like a database: you add metadata to your notes, and then you write queries inside those notes that pull information across your entire vault and display it as tables, lists, or task lists.

The metadata can come from two places. You can add a block of structured data at the top of a note (called frontmatter, written in YAML format) to record things like a rating, a date, or a category. You can also add inline fields anywhere in the body of a note using a simple Key:: Value syntax. Once your notes have this metadata, you can write queries in code blocks that Dataview reads and renders when you view the note.

There are four ways to query. The simplest is the Dataview Query Language, which looks a bit like SQL. For example, you can write a query that shows all notes tagged as books, sorted by your rating field, displayed as a table. There are also inline expressions that evaluate inside a sentence of text. For more advanced use, there is a full JavaScript API that gives access to everything Dataview has indexed, which is much more flexible but requires knowing some JavaScript.

A practical example from the README: if you have a folder of game notes, each with fields for time played, length, and rating, a single five-line query can produce a sorted table of all of them. Another query can show every uncompleted task across all your project notes at once.

The JavaScript query option comes with a note on trust: those queries run with the same access level as any Obsidian plugin, meaning they can read, write, or delete files. The simpler DQL queries are sandboxed and cannot modify anything.

Dataview is a hobby project maintained by an individual contributor. Installation happens through Obsidian's community plugin browser.

Where it fits