A data index and query language over Markdown files, for https://obsidian.md/.
MIT License
Bot releases are hidden (Show)
Published by blacksmithgu about 3 years ago
Re-release of 0.4.12 that fixes an important indexing issue.
completion
instead of completed
when setting task completion time.startswith
/ endswith
string functions.padleft
and padright
, and string
.Published by blacksmithgu about 3 years ago
Fixes task behavior and adds "truly inline" fields!
Task queries are now much improved from their primitive foundations - you can now filter, sort, and group them! The FROM
block is still page-based, sadly, though you can simply use WHERE
instead if desired. For example, you can now access
task fields like text
, line
, or completed
:
TASK WHERE contains(text, "#tag")
WHERE !completed
GROUP BY file.folder
The full list of all available task metadata can be found
here; tasks include all the information
needed to uniquely identify them, and automatically inherit all of the metadata from their parent file as well (so you
can access file.name
, for example). You can also annotate tasks with inline fields, as described in the section below.
There is some additional UX work to be done - primarily on more easily allowing you to navigate to where the task is
defined, as well as render tasks in views other than the TASK
view. The semantics of how grouping works (to make it
more intuitive/useful than it currently is) will likely also be revisited.
Early support for truly inline fields have been added, where you can add metadata in the middle of a sentence. It looks
similar to existing inline field syntax, but with brackets or parenthesis:
I would rate this a [rating:: 6]. It was (thoughts:: acceptable).
Improved rendering for all inline fields is coming in an unpcoming update to improve the visual look of these inline
fields.
SORT
functionality to do something.Published by blacksmithgu about 3 years ago
I'm not sure how I did it, but I broke the GitHub release UI, so a new release it is! This one with a correct tag.
Published by blacksmithgu about 3 years ago
Tiny bugfix release; fixes #477, by making dv.paragraph
actually produce a paragraph element. Also includes fixes for
DataArray#limit
and DataArray#mutate
.
Published by blacksmithgu about 3 years ago
Bugfix release which improves emoji parsing in tags and strings.
Published by blacksmithgu about 3 years ago
Tiny bugfix release which fixes date parsing causing pages to not index properly. Turns out the Luxon DateTime API made
questionable choices with DateTime.toObject()
and DateTime.fromObject()
!
Published by blacksmithgu about 3 years ago
Task feature release, and general bugfix release which fixes some performance issues due to a bad CSV implementation,
adds asynchronous script support, and fixes some performance issues for DataviewJS.
Thanks to @sheeley, Dataview is finally getting some task query improvements! It is frankly still really janky, but much
more usable. TASK
queries can now filter over tasks instead of just pages in the WHERE
, SORT
, and GROUP BY
statements. So things like:
TASK WHERE !completed
Or
TASK WHERE contains(text, "haha")
Are now possible. Note that FROM
statements in task queries still select based on pages for now until we finish the
revamp, so
TASK FROM #tag
will still select tasks from pages with the given tag. That being said, you can select tasks with the given tag via a
quick TASK WHERE contains(text, "#tag")
.
More improvements and general performance upgrades for task queries are already in the works, and should be available in
0.4.7.
Dataview now properly loads CSVs on-demand and asynchronously, instead of trying to index them all when Dataview starts
up (which is bad and horridly slow). This will fix performance problems for people who have lots of CSV files, though
the downside is that the JavaScript API dv.csv
call has been made asynchronous and moved to a sub-api. If you want to
load CSV files in DataviewJS, use
let data = await dv.io.csv("path");
The API supports local files in the vault OR files that can be fetched via AJAX (so http, https):
let data = await dv.io.csv("https://some.domain.com/thing.csv");
DataviewJS blocks have been updated to automatically support asynchronous calls, so you can now use await
and async
.
Improve #118, #32: Better emoji regex matching
Improve #454: Revert link comparison behavior to default
Improve #462: Don't render unrecognized classes
Prevents some freezes if you have a preview window open and try to
render $= dv
or something.
Also adds a few more nice functions like min
and max
.
Improve #462: Add max render depth for values to avoid freezes
Published by blacksmithgu about 3 years ago
Bugfix release which includes a few minor features, and documentation improvements. This includes a few breaking changes
which align Dataview more closely with Obsidian preferences, especially around links.
As per Obsidian recommendation from Licat, Dataview now expects frontmatter links to be quoted. I.e.,
link: "[[Link]]"
Instead of
link: [[Link]]
This resolves a long-standing parse ambiguity error in frontmatter which was hurting people who preferred to use
frontmatter over inline fields. Note that inline fields are unaffected.
A secretive and poorly-documented feature of Dataview allows you to call functions vectorized, where you can pass them
lists of arguments instead of single arguments, and the function will be applied to every element in the list.
If you tried to call a vectorized function with multiple list arguments, it would expand them quadratically before (a
cartesian product). It now expands linearly, where the function will be applied to the first argument of each list,
then the second, and so on. This should make vectorization more usable, especially when doing operations on GROUP BY
.
I.e.,
# Before
replace(["hello", "jello"], "ello", ["a", "b"]) = [["ha", "ja"], ["hb", "jb"]]
# After
replace(["hello", "jello"], "ello", ["a", "b"]) = ["ha", "jb"]
More work on vectorization and how it interacts with variable indexing will follow in the future.
The documentation has been updated with instructions on how to build and use Dataview locally; thanks to @sheeley for
adding hot-reloading of the plugin and a test-vault
.
Dataview types and utility libraries are now also available on npm as blacksmithhgu/obsidian-dataview
; they are
updated every time dataview is updated.
The codebase now uses Prettifier for a consistent formatting experience (even if it does wierd things sometimes I wish
it wouldn't do).
LIST WITHOUT ID
.[[]]
.WITHOUT ID
for lists.containsword()
, which is a case-insensitive contains which checks for exact word matches.Published by blacksmithgu about 3 years ago
Feature release with some bugfixes for flatten
and group by
.
Adds basic lambda support to the dataview query language along with some functions which accept it. Lambdas have the
form (arg1, arg2, ...) => expression
; for example:
(x) => x + 2
(tag) => contains(tag, "yes")
(a, b) => a + b
The following methods have been updated to support lambdas:
any(list, lambda)
: Returns true if the lambda returns true for any value in the list.all(list, lambda)
: Returns true if the lambda returns true for all values in the list.none(list, lambda)
: Returns true if the lambda returns true for no values in the list.map(list, lambda)
: Returns a new list where the lambda has been applied to each element.filter(list, lambda)
: Returns a new list consisting only of elements that the lambda returned true for.You can write lists using a primitive JavaScript-like syntax: [1, 2, 3]
; you can additionally write objects using a
primitive JavaScript-like syntax: { key1: value1, key2: value2 }
. These are mostly useful for complicated sort and
equality checks, though will be more useful in the future as subqueries and complex FROM statements are added.
Published by blacksmithgu about 3 years ago
This is a bugfix release which also includes a few highly requested QOL features.
Dataview now supports dates with milliseconds (HH:MM:ss.mmm
), as well as dates with
timezones (HH:MM:ssZ
or HH:MM:ss+6:30
).
Several performance issues and bugs related to csv support have been fixed; you can query from a csv file via
TABLE WITHOUT ID field1, field2, ... FROM csv("path/to/file.csv")
You can remove the default 'File' or 'GROUP' fields now using the 'WITHOUT ID' qualifier in a table query:
TABLE WITHOUT ID ... FROM
...
You can now specify the default date format that dataview should use everywhere in the settings. You can also
use custom formatting inside of the query language with the new dateformat(date, "...format...")
function.
Several issues with files not properly reloading due to renames or deletions have been fixed.
Published by blacksmithgu about 3 years ago
Adds support for simple queries from CSV, as well as custom dataviews, and a few bugfixes.
You can query data from CSV files using the csv()
modifier:
TABLE file.name, field, field2 FROM csv("file.csv")
Which will select "field" and "field2" from CSV. You can select from multiple CSVs:
TABLE file.name, field, field2 FROM csv("file.csv") or csv("file2.csv")
You can now create custom dataviews for usage in DataviewJS (available through dv.view()
). The function can be used as
such: dv.view("path/to/view", input)
. A custom view is a folder containing view.js
, which should be JS code that
will be loaded and provided with the dv
object and your input
argument. For example, a trivial view which renders
whatever 'input' is:
test-view/view.js
:
console.log("hi!");
dv.paragraph(input);
You could then execute this view using dv.view("test-view", 16);
in another dataview. Views can also include CSS files
in the same folder (like test-view/view.css
), which will be applied when the view is rendered.
Mostly useful for development, but all commits and pull request are now checked that they properly build and commit.
Published by blacksmithgu over 3 years ago
Hotfix release which corrects spurious scary-looking error messages, as well as link comparisons and usage of this
in
queries. Fixes #323, #324.
Published by blacksmithgu over 3 years ago
Major internal refactor, but which includes several nice new bugfixes!
$= <js>
to evaluate an inline JS expression. You have access to dv
, like in DataviewJS.Published by blacksmithgu over 3 years ago
Various small bugfixes:
join
now works on single values.Published by blacksmithgu over 3 years ago
Fix #247, #246.
Published by blacksmithgu over 3 years ago
Fix #228; empty lists no longer render as ''.
Published by blacksmithgu over 3 years ago
Small release before bigger feature work. Potential hotfix for people struggling with long index wait-times (#231, #239, #244).
Published by blacksmithgu over 3 years ago
Fix a random debugging console.log that snuck it's way into the last release.
Published by blacksmithgu over 3 years ago
join(list, [separator])
function.Published by blacksmithgu over 3 years ago