Repository: blacksmithgu/obsidian-dataview
Branch: master
Commit: 5ad0994ff384
Files: 148
Total size: 749.9 KB
Directory structure:
gitextract_umn6h50l/
├── .editorconfig
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── bug_report_mobile.yml
│ │ ├── config.yml
│ │ ├── documentation.md
│ │ └── feature_request.md
│ └── workflows/
│ ├── documentation.yml
│ └── test.yml
├── .gitignore
├── .prettierrc.json
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── __mocks__/
│ ├── data-import/
│ │ └── web-worker/
│ │ └── import-manager.ts
│ └── obsidian.ts
├── cspell.json
├── docs/
│ ├── .gitignore
│ ├── docs/
│ │ ├── annotation/
│ │ │ ├── add-metadata.md
│ │ │ ├── metadata-pages.md
│ │ │ ├── metadata-tasks.md
│ │ │ └── types-of-metadata.md
│ │ ├── api/
│ │ │ ├── code-examples.md
│ │ │ ├── code-reference.md
│ │ │ ├── data-array.md
│ │ │ └── intro.md
│ │ ├── changelog.md
│ │ ├── friends.md
│ │ ├── index.md
│ │ ├── queries/
│ │ │ ├── data-commands.md
│ │ │ ├── differences-to-sql.md
│ │ │ ├── dql-js-inline.md
│ │ │ ├── query-types.md
│ │ │ └── structure.md
│ │ ├── reference/
│ │ │ ├── expressions.md
│ │ │ ├── functions.md
│ │ │ ├── literals.md
│ │ │ └── sources.md
│ │ └── resources/
│ │ ├── develop-against-dataview.md
│ │ ├── examples.md
│ │ ├── faq.md
│ │ └── resources-and-support.md
│ ├── mkdocs.yml
│ └── overrides/
│ └── main.html
├── jest.config.js
├── manifest-beta.json
├── manifest.json
├── package.json
├── rollup.config.js
├── scripts/
│ ├── beta-release
│ ├── install-built
│ └── release
├── src/
│ ├── api/
│ │ ├── data-array.ts
│ │ ├── extensions.ts
│ │ ├── inline-api.ts
│ │ ├── plugin-api.ts
│ │ └── result.ts
│ ├── data-import/
│ │ ├── common.ts
│ │ ├── csv.ts
│ │ ├── inline-field.ts
│ │ ├── markdown-file.ts
│ │ ├── persister.ts
│ │ └── web-worker/
│ │ ├── import-entry.ts
│ │ ├── import-impl.ts
│ │ └── import-manager.ts
│ ├── data-index/
│ │ ├── index.ts
│ │ ├── resolver.ts
│ │ └── source.ts
│ ├── data-model/
│ │ ├── markdown.ts
│ │ ├── serialized/
│ │ │ └── markdown.ts
│ │ ├── transferable.ts
│ │ └── value.ts
│ ├── expression/
│ │ ├── binaryop.ts
│ │ ├── context.ts
│ │ ├── field.ts
│ │ ├── functions.ts
│ │ └── parse.ts
│ ├── index.ts
│ ├── main.ts
│ ├── query/
│ │ ├── engine.ts
│ │ ├── parse.ts
│ │ └── query.ts
│ ├── settings.ts
│ ├── test/
│ │ ├── api/
│ │ │ └── data-array.test.ts
│ │ ├── common.ts
│ │ ├── data/
│ │ │ ├── index-map.test.ts
│ │ │ ├── transferable.test.ts
│ │ │ └── values.test.ts
│ │ ├── function/
│ │ │ ├── aggregation.test.ts
│ │ │ ├── coerce.test.ts
│ │ │ ├── constructors.test.ts
│ │ │ ├── eval.test.ts
│ │ │ ├── functions.test.ts
│ │ │ ├── meta.test.ts
│ │ │ ├── string.test.ts
│ │ │ └── vectorization.test.ts
│ │ ├── markdown/
│ │ │ └── parse.file.test.ts
│ │ ├── parse/
│ │ │ ├── parse.expression.test.ts
│ │ │ ├── parse.inline.test.ts
│ │ │ └── parse.query.test.ts
│ │ └── util/
│ │ ├── normalize.test.ts
│ │ └── paths.test.ts
│ ├── typings/
│ │ ├── obsidian-ex.d.ts
│ │ └── workers.d.ts
│ ├── ui/
│ │ ├── export/
│ │ │ └── markdown.ts
│ │ ├── lp-render.ts
│ │ ├── markdown.tsx
│ │ ├── refreshable-view.ts
│ │ ├── render.ts
│ │ └── views/
│ │ ├── calendar-view.ts
│ │ ├── inline-field-live-preview.ts
│ │ ├── inline-field.tsx
│ │ ├── inline-view.ts
│ │ ├── js-view.ts
│ │ ├── list-view.tsx
│ │ ├── table-view.tsx
│ │ └── task-view.tsx
│ └── util/
│ ├── hash.ts
│ ├── locale.ts
│ ├── media.ts
│ └── normalize.ts
├── styles.css
├── test-vault/
│ ├── .obsidian/
│ │ └── community-plugins.json
│ ├── Books.md
│ ├── Home.md
│ ├── blog/
│ │ ├── 2020-08-08-an-earlier-post.md
│ │ └── 2021-08-08-a-post.md
│ ├── books/
│ │ ├── Catcher in the Rye.md
│ │ ├── Origin of Species.md
│ │ └── The Great Gatsby.md
│ ├── example calendars.md
│ ├── example lists.md
│ ├── example tables.md
│ ├── recipes/
│ │ ├── pbj.md
│ │ └── toast.md
│ ├── tasks/
│ │ ├── Annotated Tasks.md
│ │ ├── Completed Tasks.md
│ │ ├── Grouped Sorted Tasks.md
│ │ ├── Sorted Tasks.md
│ │ ├── Tasks Completed on specific Date.md
│ │ ├── Tasks in a specific section.md
│ │ ├── Uncompleted Tasks.md
│ │ ├── checklist.md
│ │ └── example tasks.md
│ └── untracked/
│ └── README.md
├── tsconfig-lib.json
├── tsconfig.json
└── versions.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.{ts,js}]
charset = utf-8
indent_style = space
indent_size = 4
================================================
FILE: .github/FUNDING.yml
================================================
github: ["blacksmithgu"]
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug Report (desktop)
description: "File a bug report for Dataview on desktop Obsidian"
title: "Bug report"
labels: ["bug", "needs-investigation"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: dql
attributes:
label: DQL
description: If applicable, provide the query where the bug occurred
placeholder: |
```dataview
LIST FROM #example
```
- type: textarea
id: js
attributes:
label: JS
description: If applicable, provide the javascript where the bug occurred
render: js
- type: input
id: version
attributes:
label: Dataview Version
description: What version of Dataview are you running?
placeholder: 0.4.20
validations:
required: true
- type: input
id: obsidian-version
attributes:
label: Obsidian Version
placeholder: 0.12.19
validations:
required: true
- type: dropdown
id: os
attributes:
label: OS
options:
- Windows
- MacOS
- Linux
validations:
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report_mobile.yml
================================================
name: Bug Report (mobile)
description: "File a bug report for Dataview on mobile Obsidian"
title: "Bug report"
labels: ["bug", "needs-investigation", "mobile"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: dql
attributes:
label: DQL
description: If applicable, provide the query where the bug occurred
placeholder: |
```dataview
LIST FROM #example
```
- type: textarea
id: js
attributes:
label: JS
description: If applicable, provide the javascript where the bug occurred
render: js
- type: input
id: version
attributes:
label: Dataview Version
description: What version of Dataview are you running?
placeholder: 0.4.20
validations:
required: true
- type: input
id: obsidian-version
attributes:
label: Obsidian Version
placeholder: 0.12.19
validations:
required: true
- type: input
id: device
attributes:
label: Device
description: What device are you running Obsidian on? Please provide the full model (version, year, etc.)
placeholder: iPhone 6
validations:
required: true
- type: input
id: os
attributes:
label: OS
description: What OS are you running Obsidian on? Please provide the full OS version.
placeholder: iOS 8.1
validations:
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Dataview Discussions
url: https://github.com/blacksmithgu/obsidian-dataview/discussions
about: Please ask and answer questions here.
- name: Obsidian Discord
url: https://obsidian.md/community
about: "Check out the #dataview channel under the Plugins section."
- name: Dataview Snippet Showcase
url: https://forum.obsidian.md/t/dataview-plugin-snippet-showcase
about: Show off your Dataview snippets here!
- name: DataviewJS Snippet Showcase
url: https://forum.obsidian.md/t/dataviewjs-snippet-showcase
about: Show off your DataviewJS snippets here!
================================================
FILE: .github/ISSUE_TEMPLATE/documentation.md
================================================
---
name: Documentation
about: Suggest improvements to documentation
title: ''
labels: documentation
---
**Please provide a link to the documentation page and section**
**Describe the problem**
A clear and concise description of what is unclear about the documentation
**Describe the solution you'd like**
A clear and concise description of what you want to happen. Feel free to suggest wording, full sentences, etc.
**Additional context**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature-request
---
[//]: # (Note: If you are unsure about or have questions related to your feature request prefer making a discussion first. After we understand what you are looking for we can easily create an issue to track the solution and progress)
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/workflows/documentation.yml
================================================
name: docs
on:
release:
types:
- published
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: |
pip install mkdocs-material mkdocs-redirects
cd docs
mkdocs gh-deploy --force
================================================
FILE: .github/workflows/test.yml
================================================
name: Build and test project
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
format:
runs-on: ubuntu-latest
name: Check code formatting
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run check-format
build:
runs-on: ubuntu-latest
name: Build project
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run build
test:
runs-on: ubuntu-latest
name: Test project
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run test
================================================
FILE: .gitignore
================================================
# Intellij
*.iml
.idea
# VSCode
.vscode
.history/
# npm
node_modules
# build
build/
# Ignore .obsidian
# No one will commit these files, they just spam 'git status'
test-vault/.obsidian/*
# Tells obsidian what plugins are enabled
!test-vault/.obsidian/community-plugins.json
# This plugin should still be tracked by git.
# It might need updated at some point
!test-vault/.obsidian/hot-reload-master/*
# Don't track this folder. For random things to try.
# If its import to test though, add it somewhere where other
# people can test it too.
test-vault/untracked/*
!test-vault/untracked/README.md
lib
yarn.lock
================================================
FILE: .prettierrc.json
================================================
{
"tabWidth": 4,
"semi": true,
"embeddedLanguageFormatting": "off",
"parser": "typescript",
"printWidth": 120,
"arrowParens": "avoid"
}
================================================
FILE: CHANGELOG.md
================================================
# 0.5.70 (Beta)
Still attempting to fix #2557, github is acting up.
---
# 0.5.69 (Beta)
Attempting to fix #2557, but uncertain to any side effects.
---
# 0.5.68
- Many fixes to the documentation
- #2318 & co: Various fixes related to _live preview_ rendering of lists
- New/documented functions for `unique()`, `display()`, `firstvalue()`
- Added DOM information related to standalone inline fields
This is the first release done by @holroy, so thanks to him for further developing of _Dataview_. Thank you also to all the people having contributed through PRs and issues.
---
# 0.5.67
Includes several documentation fixes and several community-contributed bug fixes.
- @reply2za: Fixed inline rendering in the reading view.
- @carlesalbasboix: Adds sum(), avg(), min(), and max() to data arrays.
- @mnaoumov: Adds code mirror configuration which code highlights dataviewjs!
---
# 0.5.66
Bugfix for version comparisons to fix some other plugins having broken interactions with Dataview.
---
# 0.5.65
A maintenance update which fixes some issues with rendering embeds in Dataviews and adds a few new functions.
- Adds the `hash()` function for generating consistent uniformly-distributed values given arbitrary inputs. Primarily useful for creating "random" views which remain consistent across page refreshes. Thanks to @holroy.
- Adds the `slice()` function for slicing arrays, similar to Javascript's `Array.slice`. Thanks to @holroy.
- Fixes several issues with rendering embeds inside dataviews. Thanks to @GottZ.
- Several documentation improvements around tasks - thanks to @holroy and @RaviOnline.
---
# 0.5.64
More bug fixes for inline field rendering.
---
# 0.5.63
- More bugfixes from @RyotaUshio for rendering Markdown paragraphs and other blocks in DataviewJS.
---
# 0.5.62
Several more inline field fixes from @RyotaUshio, including more configuration options, fixing inline fields being rendered inside codeblocks, and more. Thanks!
---
# 0.5.61
- @RyotaUshio: Fix several bugs related to the new inline field rendering, including source mode and fixing date formatting.
---
# 0.5.60
- @RyotaUshio: Add explicit rendering of inline fields in live preview. They are much more visually distinct now!
- @MarioRicalde: Adds `PluginApi#evaluateInline(expression, path)` to the plugin API, which evaluate expressions as if you were on the given page.
---
# 0.5.59
- Fix an issue with the plugin failing to run on iOS due to an esoteric regex issue.
---
# 0.5.58
- Negative durations will now be properly rendered.
---
# 0.5.57
Maintenance patch which bumps many internal dependency versions and which includes approximately ~20 community-contributed PRs which add some new functions, fix some Dataview interactions with properties, and more!
---
# Unreleased
- DQL: Adds new `durationformat(duration, string)` function.
- DQL: New math rounding functions, `trunc(number)`, `floor(number)`, `ceil(number)`.
# 0.5.56
- Includes some performance fixes on recent versions of Obsidian 1.3+ due to some API changes. Thanks @kometenstaub.
- Documentation cleanups and improvements by @mocsa, @protofarer, @seanlzx, and @somidad.
- Adds the new `flat(array)` method for flattening nested arrays, as well as parsing dates using arbitrary formats using
`date(text, "format")`. Thanks @holroy!
---
# 0.5.55
- Durations are now internationalized using luxon's new internationalization support.
- Dataviews should now properly render inside Canvas and some other contexts. Thanks @GamerGirlandCo!
---
# 0.5.54
- Regular list items are now also clickable in task views, not just task lines! Thanks to @LilaRest.
---
# 0.5.53
- Fix some documentation issues causing docs to not be updated.
---
# 0.5.52
Substantial documentation improvements thanks to @s-blu and @AB1908!
- For people concerned about dataviewjs code execution from copy-pasting, @eyuelt has made it possible to change the
dataviewjs codeblock prefix.
- @sohanglal has added some documentation for `task.visual` for changing the visual text of a task.
- @Chouffy and @Daryl-Horton have fixed some bad documentation links!
- @vrtmrz swapped the regex used for parsing tags to better match Obsidian's own parser.
- @alexfertel has added `regextest`, which allows for matching parts of a string instead of the whole thing.
- @iamrecursion has added more metadata to file links, so they now include section metadata. This may cause some slight
visual changes in link views.
---
# 0.5.51 (Beta)
- Allow disabling regular Dataview inline queries via configuration option.
---
# 0.5.50 (Beta)
- Expose dataview EXPRESSION and QUERY parsing to the dataview npm plugin, so others can parse dataview ASTs.
- Fix documentation issue with `join`.
---
# 0.5.49 (Beta)
- Add the `average` function to compute averages of lists (`average([list of things])`).
- Added documentation for `average`, `min`, `max`, `minby`, and `maxby` functions.
- Fixed the broken `nonnull` function and documented it.
---
# 0.5.48 (Beta)
We're back to more regular beta releases while I trial out new functionality!
- Fixed broken list behavior for `dv.markdownTaskList`.
- @GamerGirlandCo: Better handling of block IDs when checking off tasks!
- @s-blu and @AB1908: Lots of big documentation upgrades! Nice!
- @leoccyao: More block ID task checking fixes. Should work after this one.
- Add expression/query parsing to the dataview NPM package.
- @charleshan: Fix a missing header level in the dataview `dv.header` example.
---
# 0.5.47
Improves `date + duration` behavior when either the date or duration are null.
---
# 0.5.46
- Fix #1412: Fix bad `file.cday` and `file.ctime` comparisons due to wrong timezone being set. Ugh.
---
# 0.5.45
- #1400: Properly use the group by field for the group name.
- Fix bad table highlighting in some themes.
---
# 0.5.44
- #1404: Fixed dates in non-local timezones parsing incorrectly.
- Fixed some build non-determinism issues.
- Swapped to pull requests for adding new functionality, and added some more internal tests.
---
# 0.5.43
- Fix #1366: Better handling of calendar emoji (used as due dates in tasks).
---
# 0.5.42
It's been over a month since the last release! Anyway, this release bundles several nice user-contributed features:
- @AB1908: Tag queries are now case insensitive.
- @AB1908: Shift-clicking a link/task to open in a new tab now works properly on Mac.
- @AB1908: Numerous documentation fixes for clarity and more examples.
- @AnnaKornfeldSimpson: Additional emoji shorthands for more task fields (finished, due).
- @ooker777: Documentation improvements for some DataviewJS functions, and the ability to use inline emoji for the
completion tracking feature.
- @mt-krainski: Custom date formats for task completions.
- @gentlegiantJGC: Better support for nested inline fields (i.e., less crashy).
---
# 0.5.41
- Fix a bad regex doing escaping in markdown tables.
- Improve async documentation.
---
# 0.5.40
Adds some more documentation about the new markdown functionality.
---
# 0.5.39
- Fixed an issue where checking a task in a task view would check the wrong box visually.
- Added experimental plugin APIs for querying dataview directly as markdown, and converting dataview results to properly
formatted markdown.
---
# 0.5.38
- Some minor documentation improvements.
- Fix an issue with inline fields rendering out of order. That was a weird bug.
---
# 0.5.37
Fixes inline field rendering to once again work for highlighting/links, as well as some other rendering quirks with
inline queries in codeblocks.
---
# 0.5.36
- Fix a bug when checking if an element is an HTMLElement.
- Properly include the nice improvements to the file count in tables and lists.
---
# 0.5.35
- Fix #1196, #1176: Re-enable HTML values. This was never a featured I advertised since it was just for some internal
hackery, but it appears people just discovered it in DataviewJS queries.
- Improved initial time to popular queries that use `file.starred`.
---
# 0.5.34
- Fix #1174: Fix indexing with a variable.
- Fix an issue with the experimental calendar view.
---
# 0.5.33
- Fix a bug with inline views that was introduced in 0.5.32.
---
# 0.5.32
The Dataview API has been noticeably revamped - there are now approximately twice as many functions available on the
plugin API as there were before, and some additional utilities have been added to both the plugin and inline API. I
will be finishing up the associated new "extension" functionality shortly, which will allow:
1. For custom Dataview + DataviewJS functions to be added via plugins.
2. For custom renderable objects (progress bars, embedded task lists, embedded tables) to be added to any Dataview view via plugins.
3. For plugins to provide alternative behavior for some dataview functionality (such as integrating task plugins with
the dataview task query).
As part of the API revamp, it is now possible to programmatically execute Dataview and DataviewJS queries - either for
using the existing Dataview query language in your own plugin, or for embedding dataview. The Dataview npm library also
now exposes many useful internal Dataview types, including the AST structure for all dataview queries.
I am hoping that cleaning up the Dataview API and making it much more extensible will allow for Dataview [to](to) integrate
much better with existing plugins, and to provide the full power of the in-memory index for plugins. I have been very
carefully watching index performance in recent weeks to ensure smooth frontend performance for anyone using the API
(with a goal of <10ms for most queries).
---
# 0.5.31
Tasks now have an `outlinks` list field which includes all links in the task; this can be used for finding tasks with
links in them.
---
# 0.5.30
- Added the `typeof(any)` function in Dataview, which obtains the type of any value for comparison:
```javascript
typeof("text") = "string"
typeof(1) = "number"
typeof([1, 2, 3]) = "array"
```
- Added the modulo operator (`%`) for doing integer division remainder. I.e., `14 % 2 = 0` and `14 % 3 = 2`.
- Fixed some minor spacing issues with lists in tables.
---
# 0.5.29
Fix another subtle incompatibility between 0.4.26 and 0.5.29 - if you frequently used empty inline fields (like
`Key::` with no value), the 0.5+ behavior is now the same as 0.4 behavior and will map such fields to null instead of an
empty string.
This may fix a broad variety of "subtly wrong" queries that you may have seen after the upgrade.
---
# 0.5.28
- Fix a bug with some more string concatenations and null handling.
---
# 0.5.27
More performance + correctness bugfixes.
- The parser has been made a little more robust to prevent major indexing issues (or at least recover from them
quickly).
- Several new strange tag variants are now supported.
- Markdown links are now properly indexed again.
Some DataviewJS performance issues should be resolved now, especially for external plugins using Dataview. This fix
does involve a slight API break w.r.t. what types are wrapped into Dataview Arrays (which provide functions like
`.where()`). Generally, only Dataview-provided implicits are wrapped in data arrays now; frontmatter and inline fields
are always now regular JS arrays - use `dv.array()` to explicitly make a data array if you want the advanced querying.
---
# 0.5.26
More small bugfixes:
- Fix a few small link rendering issues.
- Tag extraction from tasks now handles punctuation properly.
- Upgrade luxon (which is embedded in DataviewJS) to 2.4.0.
---
# 0.5.25
- Fix #1147: Fix there being a `#null` tag for files with an empty `tag` or `tags` frontmatter.
---
# 0.5.24
Several bugfixes:
- Nulls are now sorted first rather than last; it's generally good practice to explicitly check for nulls in your
queries to avoid strange behavior.
- Dataview now properly parses space-delimited tags (like `tags: abc def ghi`).
- Dataview now supports dropping the entire file cache in case of bugs.
---
# 0.5.23
- Fix #1140: Force API objects to be arrays if they are iterables.
---
# 0.5.22
- Fix #1135: Use 'x' instead of 'X' for checkboxes.
---
# 0.5.21
A long-overdue swap from the beta branch to the stable branch. The beta branch should not include any (intended) breaking
changes, and has some nice performance improvements that come along with it! Here are the major changes:
- Most views now use React and no longer flicker when updating; this is not the case yet for DataviewJS, which will be
getting equivalent treatment in the future.
- Dataview now caches metadata, so Dataview loads are very fast after the first time you open your vault. Dataview still
needs to visit every file when you update the plugin version, so that should be the only times you experience slower
load times.
- A brand new task view backend and query which allows you to filter per-task, rather than per-page! Check the
documentation for details, but this broadly means `WHERE` statements now use task properties instead of page
properties.
- Some additional metadata is now available for use - `file.starred`, `file.lists`, and more metadata in
`file.tasks`.
There have been some moderate documentation touch-ups to keep things up to date; I'm still working on a walkthrough for
common Dataview use cases. This review also includes about ~30-40 bugfixes; some new bugs may arise due to internal
changes, so please flag them if you encounter them.
---
# 0.5.20 (Beta)
Slight fix to hopefully improve some strange reported cases of bad indexing at startup.
---
# 0.5.19 (Beta)
Dataview now uses IndexedDB to cache file metadata, reducing startup time to virtually nothing if you've opened the
vault before; if you have a small vault (<1000 notes), you may notice a slight improvement, but large vaults and mobile
devices will notice a very significant performance improvement to "first valid paint". Some other performance parameters
have been tuned to hopefully make the default experience better.
A few small bugs related to rendering have also been squashed, including an issue with images being scaled wrongly.
---
# 0.5.18 (Beta)
- Tasks in task views now support alternative task status characters like '!' and '/'; thanks @ebullient.
- A few documentation nit fixes.
- Added `DataArray#sortInPlace` for a more efficient mutable sort for niche use cases.
---
# 0.5.17 (Beta)
- Improved behavior when clicking on tasks in the task view; will now properly scroll to the relevant line in long
files!
- Fixed a bug with incorrect counts being displayed in task views.
- Added `tags` as a field available on task items, so you can now do things like `TASK WHERE contains(tags, "#tag")`.
---
# 0.5.16 (Beta)
Dataview now tracks initialization and will report when all files have been indexed in the console; you can
programmatically see this via `dataview:index-ready`, or by checking `api.index.initialized`.
---
# 0.5.15 (Beta)
- Add hover highlights to tables to make seeing rows a little easier.
- Tables and task lists now include counts of the number of results in the headers.
- Further improved task selection in the task view.
---
# 0.5.14 (Beta)
- Fix task highlighting when not grouping.
- Remove some spurious console logging.
- Slightly improve task highlighting behavior when clicking on a task.
---
# 0.5.13 (Beta)
Several smaller bugfixes!
- Fix #997: Use the group by field name in the table name.
- Prevent tons of errors if you incorrectly set the inline query prefix.
---
# 0.5.12 (Beta)
Improve error messages for queries somewhat and get rid of some ugly output.
---
# 0.5.11 (Beta)
Add detection of tasks inside of block quotes, as well as correctly implement automatic checking and unchecking of these
tasks.
---
# 0.5.10 (Beta)
Adds the `Dataview: Force Refresh Views` Command (accessible via the Ctrl+P command view) to force current views to
refresh immediately.
---
# 0.5.9 (Beta)
Another fix for due-date related emoji in tasks. I hate emoji.
---
# 0.5.8 (Beta)
Fix some issues with infinite loops of tasks due to bad Obsidian metadata (potentially due to being out of date?).
---
# 0.5.7 (Beta)
Fix issues with parsing '🗓️2021-08-29' due-date annotations on tasks, as well as an issue with properly extracting
due/completed/completed times for use in queries.
---
# 0.5.6 (Beta)
Proper release of 0.5.5 plus one additional small improvement:
- Add `duration * number` and `duration / number` operations for manipulation durations numerically.
---
# 0.5.5 (Beta)
More small features:
- Fix issues with task sorting not doing anything. Sort away!
- Table headers can now be arbitrary markdown. So you can put things like links in your headers: `TABLE (1 + 2) AS
"[[File]]".
- You can now specify the size of an image embed by providing WxH in it's display property: `![[image.png|50x50]]`.
---
# 0.5.4 (Beta)
Improved image rendering for some link types, and adds the `embed(link)` and `embed(link, false)` options to convert
links to/from their embedded equivalents.
---
# 0.5.3 (Beta)
Iterative beta which adds a few nice QoL features and fixes some more bugs:
- Internally swapped to a React-based renderer; this should not have a noticeable perf or usability impact, but makes it
easier for me to implement complex table/list behaviors.
- Naming your fields with `AS "Name"` is now optional; Dataview will infer the name from the expression automatically.
For example, `TABLE 8 + 4, 3 + 6 FROM ...` is now a valid table expression, and the columns will be named `8 + 4` and
`3 + 6` respectively.
- Some issues with array and object rendering were corrected.
- Error messages on empty dataview results were improved and now show up for all views.
Inline images are now rendered correctly in Dataview tables and lists - no more hacky `app://local/` shenanigans!
---
# 0.5.2 (Beta)
- Fix #971: Objects now work properly inside DataviewQL evaluation.
---
# 0.5.1 (Beta)
- Temporarily revert the new task metadata behavior: inline fields in sublists of tasks are added to the page, instead
of the task. This behavior is not good, but is compatible with legacy usages of task metadata, which should not break
some existing queries.
- This behavior will be removed in the future behind a flag.
- Added the 'visual' field to tasks - if set, tasks render 'visual' instead of their regular text.
- Fixed `DataArray#mutate()`.
---
# 0.5.0 (Beta)
Re-release of broken release 0.4.23, now hopefully with fixes that make it work on (most) machines. I'll be doing beta
releases for a little while until I can confirm the new version is stable; use BRAT
(https://github.com/TfTHacker/obsidian42-brat) to easily track Dataview beta versions if you are interested in cutting
edge features.
---
# 0.4.25
Fix #867: Create a container div per taskList to allow for multiple task views.
---
# 0.4.24
Re-release of 0.4.23f since Obsidian does not automatically update between non-semver versions.
---
# 0.4.23f
Remove some code which attempted to make tag queries case-insensitive; I'll reimplement this more generally later (it
conflicts with existing queries which check tags via `contains(file.tags, "#Tag")` and similar).
---
# 0.4.23e
More task bugfixes / improvements, and a fix that caused task metadata to be duplicated.
---
# 0.4.23d
More inline field list parsing bug fixes. Hopefully we're back to a nice working order!
---
# 0.4.23c
Bugfix which adds support for '1)' style lists, as well as a very annoying null issue due to JavaScript being a very
sad, very sad language.
---
# 0.4.23b
Bugfix for bad inlink/outlink computations; links were not being normalized properly so reverse lookups were not
working.
---
# 0.4.23
The Task Update! This release reworks how dataview handles tasks and list items so that they should be much more
intuitive to use and interact with:
1. **Subtask Support**: Queries now search over all list items, instead of only over root elements. This should make
task filtering much more usable, especially if you tend to put tasks under other list items or care specifically
about subtasks.
2. **Multiline Support**: Dataview now understands multi-line tasks and renders/updates them correctly.
3. **Immediately Navigate to Task**: The new task view, aside from looking a little cleaner than previous views, now
immediately navigates to the task in it's original file on click and selects it.
4. **Grouping Support**: For DataviewJS users, `dv.taskList` now supports grouping (as produced by `groupBy` and the new
`groupIn`) natively.
For DataviewJS users, the task and list representation has changed: `file.tasks` (and the new `file.lists`) contain
every single task (including subtasks) in the file, instead of only the root elements. You can return to previous
behavior by filtering out tasks with a non-null parent - i.e., `file.tasks.where(task => !task.parent)`. `dv.taskList`
will intelligently deal with properly nesting and de-duplicating tasks, so just filter to the tasks you want to render and
the API will do the rest.
This release also includes general backend improvements as we prepare for live-editing in Dataview views, as well as
several community-contributed API improvements:
- `DataArray#groupIn`: For grouping already grouped data, you can now use `array.groupIn(v => ...)`, which will group
the innermost (original) data in the array instead of the top level groups. This allows for more easily grouping
recursively, such as `dv.pages().groupBy(page => page.file.folder).groupIn(page => page.title)` producing a grouping
of folders, then page titles.
- `substring(string, start[, end])`: The last major missing string function is now available! Take slices of strings.
- Improved `dv.el()` and other HTML functions - thanks @vitaly.
- null and undefined entries sort at the end instead of the beginning by default; sorry to those whose code sorts wrong
because of this, but it is a better default for most people's use cases.
- All links are now properly normalized to their full paths, fixing many link comparison edge cases in DataviewJS.
Documentation additions for the new task functionality will be coming out in the next few days. The next release 0.4.24
is currently targeting expanded `FROM` query support, basic table view improvements, and general exporting functionality
for Dataview. See you then!
---
# 0.4.22
The @pjeby update! This includes several performance improvements suggested by @pjeby to dramatically improve background
Dataview performance as well as reduce some memory pressure. It also includes some minor bug-fixes and preliminary
functionality:
- Target ES2018 for better Promise support
- Allow parsing shorthands in `dv.date()`.
- Add additional metadata to inline field rendering which can be styled.
- Cleanup events & workers on plugin uninstall, improving the Dataview uninstall/disable/reload experience.
- Add preliminary `CALENDAR` queries - rendering similar to the obsidian-calendar plugin, see the documentation!
Dataview should perform much better on startup and when you have lots of tabs open - thanks again to @pjeby.
---
# 0.4.21
Bugfix release which primarily fixes issues that Dataview had with the live preview mode in upcoming Obsidian versions;
Dataview live preview should now be functional. Also includes a number of smaller bugfixes.
- Fix #646: Add `date(yesterday)` to create a date 24 hours ago.
- Fix #618: Luxon is now available on the dataview API (`dv.luxon`).
- Fix #510: Add `dv.duration()` for parsing durations.
- Fix #647: All HTML functions in the DataviewJS API now return their rendered objects.
- Fix #652: Fix parsing of invalid dates.
- Fix #629: Fix block link parsing.
- Fix #601: Timezones are now rendered properly and parsed properly in Dataview dates.
- PR #637: Add `meta(link)` which allows you to access various metadata about a link itself.
- Various minor null safety fixes.
- Dataview now reports it's exact version and build time in logs.
---
# 0.4.20
Some feature work (mostly by other contributors) while I while away at section metadata. May also fix a few bugs!
- Fix #448: You can now use the "Task Completion Tracking" option to automatically add completion metadata to tasks
which are checked/unchecked through Dataview. Thanks to @sheeley.
- Add a search bar to documentation. Thanks to @tzhou.
- Add new date expressions for the start of the week (`date(sow)`), and the end of the week (`date(eow)`). Thanks
@Jeamee and @v_mujunma.
Small minor bugfix / security releases may follow in the near future; otherwise, the next major release will include
section and object metadata.
---
# 0.4.19
Bugfix release which corrects emoji parsing & localization issues.
- Add `DataArray#into`, which lets you index into objects without flattening.
- Renamed 'header' to 'section' in task metadata; 'header' will remain around for a few major releases to let people
naturally migrate.
- Fix #487: You no longer need spaces around '*' in expressions.
- Fix #559: Fix unicode issues in variable canonicalization which was causing problems with non-Latin inline field
keys.
## Duration Parsing
You can now include multiple units in durations: `dur(8 minutes, 4 seconds)` or `dur(2yr8mo12d)`. You can separate
durations by commas, or use the abbreviated syntax with/without spaces.
---
# 0.4.18
Bugfix release which fixes bad inline field highlighting if '[' and '(' are mixed on the same line in particular orders.
---
# 0.4.17
Minor feature release to patch up more implementation holes.
## Single File Queries
You can now query from a specific file (instead of just folders and tags) by specifying the full file path:
```
TASK FROM "dataview/Test"
...
```
This is primarily useful for task queries, but will soon be useful for section and object queries in the near future as
well.
## Better Inline Field Highlighting
The CSS for inline field highlighting has been fixed and some compatibility issues improved, so it should work on all
themes now instead of only a few.
## dv.el()
DataviewJS now has `dv.el()`, which is like existing functions like `dv.paragraph` and `dv.span` but can create any
HTML element type; for example:
```js
dv.el("b", "Text!");
dv.el("i", 18);
```
---
# 0.4.16
Small performance release which substantially reduces the impact Dataview has on vault loading times (by spreading out
file loading). The Dataview Index is now also eagerly initialized, so plugin consumers of the API can immediately start
using it instead of waiting for the `dataview:api-ready` event.
---
# 0.4.15
A simple fix for #537 which properly 'awaits' value rendering in `dv.view()`. Fixes issues with values rendering out of
order.
---
# 0.4.14
Small bugfix release.
- Fixes inline field evaluation when using the new fancy highlighting.
- You can now configure whether task links should show up at the beginning or end of the task (or just disable them)
in the "Task Link Location" setting.
- Most setting updates will immediately be applied to existing Dataviews.
---
# 0.4.13
Bugfix release which adds fancy rendering to inline-inline fields and includes a few bugfixes.
## Pretty Inline Fields
Inline fields of the form `[key:: value]` will now be rendered with fancy new HTML! By default, they are rendered with
both the key and value. You can only render the value using parenthesis instead: `(key:: value)`. You can disable
this feature in the configuration.
Full-line inline fields (that Dataview has supported for a long time) will gain similar rendering support soon; in the
meanwhile, give the new syntax a try!
### Task Linking
Tasks now render with a link to the page/section that they are defined in, making `GROUP BY` and custom task
editing easier to do:
- [ ] A Task. 🔗
- [ ] Another Task. 🔗
- [ ] Some Random Subtask. 🔗
You can configure the symbol for the link or disable it altogether.
### Improving DataviewJS Posture
I am currently actively looking into improving DataviewJS sandboxing and general security posture. As a first small step
in this, I have made DataviewJS opt-in instead of opt-out, and added a separate control for Inline DataviewJS. You may
need to re-enable it in your settings if you use it.
More improvements and better JavaScript sandboxing will follow.
---
# 0.4.12-hotfix1
Re-release of 0.4.12 that fixes an important indexing issue.
- Fix #505: Use `completion` instead of `completed` when setting task completion time.
- Fix #509: Add `startswith` / `endswith` string functions.
- Fix #488: Add `padleft` and `padright`, and `string`.
- Fix #506, #512: Fix date comparisons due to a bizarre date zone issue.
---
# 0.4.12
Bugfix release following up 0.4.11 which includes a few minor function additions.
- Fix #512: Strange zone issue causing dates to not be equal.
- Fix #506: Same as #512.
- Fix #488: Add `padleft` / `padright` functions.
- Fix #509: Add `startswith` and `endswith` functions.
- Fix #505: Correctly read completion dates for tasks from `completion`.
This release also includes improved testing thanks to mocking Obsidian plugin APIs!
---
# 0.4.11
Fixes task behavior and adds "truly inline" fields!
## Improved Task Behavior
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](https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#tasks); 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.
## Inline Inline Fields
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 upcoming update to improve the visual look of these inline
fields.
## Issues
- Fix #496: Fix task `SORT` functionality to do something.
- Fix #492: Tasks now properly annotated with parent file information.
- Fix #498: Fix task checking/unchecking logic (which broke due to a change in the task regex...).
---
# Initial
Start of the automatic changelog.
================================================
FILE: LICENSE.txt
================================================
MIT License
Copyright (c) 2021 Michael Brenan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Obsidian Dataview
Treat your [Obsidian Vault](https://obsidian.md/) as a database which you can query from. Provides a JavaScript API and
pipeline-based query language for filtering, sorting, and extracting data from Markdown pages. See the Examples section
below for some quick examples, or the full [reference](https://blacksmithgu.github.io/obsidian-dataview/) for all the details.
## Examples
Show all games in the game folder, sorted by rating, with some metadata:
~~~markdown
```dataview
table time-played, length, rating
from "games"
sort rating desc
```
~~~

---
List games which are MOBAs or CRPGs.
~~~markdown
```dataview
list from #game/moba or #game/crpg
```
~~~

---
List all markdown [tasks](https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#tasks) in un-completed projects:
~~~markdown
```dataview
task from #projects/active
```
~~~

---
Show all files in the `books` folder that you read in 2021, grouped by genre and sorted by rating:
~~~markdown
```dataviewjs
for (let group of dv.pages("#book").where(p => p["time-read"].year == 2021).groupBy(p => p.genre)) {
dv.header(3, group.key);
dv.table(["Name", "Time Read", "Rating"],
group.rows
.sort(k => k.rating, 'desc')
.map(k => [k.file.link, k["time-read"], k.rating]))
}
```
~~~

## Usage
For a full description of all features, instructions, and examples, see the [reference](https://blacksmithgu.github.io/obsidian-dataview/). For a more brief outline, let us examine the two major aspects of Dataview: *data* and *querying*.
#### **Data**
Dataview generates *data* from your vault by pulling
information from **Markdown frontmatter** and **Inline fields**.
- Markdown frontmatter is arbitrary YAML enclosed by `---` at the top of a markdown document which can store metadata
about that document.
- Inline fields are a Dataview feature which allow you to write metadata directly inline in your markdown document via
`Key:: Value` syntax.
Examples of both are shown below:
```yaml
---
alias: "document"
last-reviewed: 2021-08-17
thoughts:
rating: 8
reviewable: false
---
```
```markdown
# Markdown Page
Basic Field:: Value
**Bold Field**:: Nice!
You can also write [field:: inline fields]; multiple [field2:: on the same line].
If you want to hide the (field3:: key), you can do that too.
```
#### **Querying**
Once you've annotated documents and the like with metadata, you can then query it using any of Dataview's four query
modes:
1. **Dataview Query Language (DQL)**: A pipeline-based, vaguely SQL-looking expression language which can support basic
use cases. See the [documentation](https://blacksmithgu.github.io/obsidian-dataview/query/queries/) for details.
~~~markdown
```dataview
TABLE file.name AS "File", rating AS "Rating" FROM #book
```
~~~
2. **Inline Expressions**: DQL expressions which you can embed directly inside markdown and which will be evaluated in
preview mode. See the [documentation](https://blacksmithgu.github.io/obsidian-dataview/reference/expressions/) for
allowable queries.
```markdown
We are on page `= this.file.name`.
```
3. **DataviewJS**: A high-powered JavaScript API which gives full access to the Dataview index and some convenient
rendering utilities. Highly recommended if you know JavaScript, since this is far more powerful than the query
language. Check the [documentation](https://blacksmithgu.github.io/obsidian-dataview/api/intro/) for more details.
~~~markdown
```dataviewjs
dv.taskList(dv.pages().file.tasks.where(t => !t.completed));
```
~~~
4. **Inline JS Expressions**: The JavaScript equivalent to inline expressions, which allow you to execute arbitrary JS
inline:
~~~markdown
This page was last modified at `$= dv.current().file.mtime`.
~~~
#### JavaScript Queries: Security Note
JavaScript queries are very powerful, but they run at the same level of access as any other Obsidian plugin. This means
they can potentially rewrite, create, or delete files, as well as make network calls. You should generally write
JavaScript queries yourself or use scripts that you understand or that come from reputable sources. Regular Dataview
queries are sandboxed and cannot make negative changes to your vault (in exchange for being much more limited).
## Contributing
Contributions via bug reports, bug fixes, documentation, and general improvements are always welcome. For more major
feature work, make an issue about the feature idea / reach out to me so we can judge feasibility and how best to
implement it.
#### Local Development
The codebase is written in TypeScript and uses `rollup` / `node` for compilation; for a first time set up, all you
should need to do is pull, install, and build:
```console
foo@bar:~$ git clone git@github.com:blacksmithgu/obsidian-dataview.git
foo@bar:~$ cd obsidian-dataview
foo@bar:~/obsidian-dataview$ npm install
foo@bar:~/obsidian-dataview$ npm run dev
```
This will install libraries, build dataview, and deploy it to `test-vault`, which you can then open in Obsidian. This
will also put `rollup` in watch mode, so any changes to the code will be re-compiled and the test vault will automatically
reload itself.
#### Preparing for creating pull requests
If you plan on doing pull request, we would also recommend to do the following in advance of creating the pull request:
```console
foo@bar:~$ npm run dev
foo@bar:~$ npm run check-format
foo@bar:~$ npm run format
foo@bar:~$ npm run test
```
The third step of `npm run format` is only needed if the format check reports some issue.
#### Installing to Other Vaults
If you want to dogfood dataview in your real vault, you can build and install manually. Dataview is predominantly a
read-only store, so this should be safe, but watch out if you are adjusting functionality that performs file edits!
```console
foo@bar:~/obsidian-dataview$ npm run build
foo@bar:~/obsidian-dataview$ ./scripts/install-built path/to/your/vault
```
#### Building Documentation
We use `MkDocs` for documentation (found in `docs/`). You'll need to have python and pip to run it locally:
```console
foo@bar:~/obsidian-dataview$ pip3 install mkdocs mkdocs-material mkdocs-redirects
foo@bar:~/obsidian-dataview$ cd docs
foo@bar:~/obsidian-dataview/docs$ mkdocs serve
```
This will start a local web server rendering the documentation in `docs/docs`, which will live-reload on change.
Documentation changes are automatically pushed to `blacksmithgu.github.io/obsidian-dataview` once they are merged
to the main branch.
#### Using Dataview Types In Your Own Plugin
Dataview publishes TypeScript typings for all of its APIs onto NPM (as `blacksmithgu/obsidian-dataview`). For
instructions on how to set up development using Dataview, see [setup instructions](https://blacksmithgu.github.io/obsidian-dataview/plugin/develop-against-dataview/).
## Support
Have you found the Dataview plugin helpful, and want to support it? I accept donations which go towards future
development efforts. I generally do not accept payment for bug bounties/feature requests, as financial incentives add
stress/expectations which I want to avoid for a hobby project!
Support @blacksmithgu:
[](https://www.paypal.com/donate?business=Y9SKV24R5A8BQ&item_name=Open+source+software+development¤cy_code=USD)
Support @holroy:
================================================
FILE: __mocks__/data-import/web-worker/import-manager.ts
================================================
/** A mock for `FileImporter` which runs on the same thread. */
import { runImport } from "data-import/web-worker/import-impl";
import { CachedMetadata, MetadataCache, TFile, Vault } from "obsidian";
export class FileImporter {
public constructor(public numWorkers: number, public vault: Vault, public metadataCache: MetadataCache) {}
public async reload(file: TFile): Promise {
let contents = await this.vault.read(file);
let metadata = await this.metadataCache.getFileCache(file);
return runImport(file.path, contents, file.stat, metadata as CachedMetadata) as any as T;
}
}
================================================
FILE: __mocks__/obsidian.ts
================================================
import EventEmitter from "events";
/** Basic obsidian abstraction for any file or folder in a vault. */
export abstract class TAbstractFile {
/**
* @public
*/
vault: Vault;
/**
* @public
*/
path: string;
/**
* @public
*/
name: string;
/**
* @public
*/
parent: TFolder;
}
/** Tracks file created/modified time as well as file system size. */
export interface FileStats {
/** @public */
ctime: number;
/** @public */
mtime: number;
/** @public */
size: number;
}
/** A regular file in the vault. */
export class TFile extends TAbstractFile {
stat: FileStats;
basename: string;
extension: string;
}
/** A folder in the vault. */
export class TFolder extends TAbstractFile {
children: TAbstractFile[];
isRoot(): boolean {
return false;
}
}
export class Vault extends EventEmitter {
getFiles() {
return [];
}
trigger(name: string, ...data: any[]): void {
this.emit(name, ...data);
}
}
export class Component {
registerEvent() {}
}
================================================
FILE: cspell.json
================================================
{
"version": "0.2",
"ignorePaths": [],
"dictionaryDefinitions": [],
"dictionaries": [],
"words": [
"aaab",
"akey",
"alexfertel",
"AnnaKornfeldSimpson",
"apng",
"artisticat",
"autorelease",
"bcbe",
"bimap",
"binaryop",
"bkey",
"blacksmithgu",
"Brenan",
"bryc",
"callouts",
"canonicalization",
"canonicalize",
"CANONICALIZER",
"canonicalizes",
"canonicalizing",
"carlesalbasboix",
"cday",
"charleshan",
"Cheatsheet",
"Cheatsheets",
"Chouffy",
"clsname",
"codemirror",
"combinators",
"compday",
"comptime",
"concat",
"containsword",
"crashy",
"cres",
"crog",
"crpg",
"cssclasses",
"currencyformat",
"cyrb",
"dailys",
"datapoints",
"Datarow",
"Dataview",
"dataviewjs",
"Dataviews",
"datefield",
"ddd",
"DDTHH",
"début",
"dedup",
"dformat",
"dogfood",
"Donadio",
"dtformat",
"duedate",
"dueday",
"duetime",
"durationformat",
"dvjs",
"econtains",
"elink",
"embeddable",
"endswith",
"errorbox",
"etags",
"Evals",
"eyuelt",
"failable",
"fastfood",
"fdefault",
"fileset",
"Filetext",
"Filipe",
"frontmatter",
"fullscan",
"functionname",
"GamerGirlandCo",
"gdhjg",
"gentlegiantJGC",
"Gott",
"Groot",
"helloxx",
"Hoeven",
"holroy",
"iamrecursion",
"icontains",
"iden",
"ifield",
"iitem",
"implicits",
"INDEXEDDB",
"Ingrouped",
"Inlines",
"inlink",
"inlinks",
"Jeamee",
"jfif",
"Kanban",
"kometenstaub",
"ldefault",
"leoccyao",
"lezer",
"Linkpath",
"localforage",
"localtime",
"longkeyidontneedwhenreading",
"lres",
"luxon",
"lwrap",
"MarioRicalde",
"matchreg",
"maxby",
"mday",
"meello",
"meep",
"Millis",
"minby",
"mkdocs",
"mnaoumov",
"moba",
"mobas",
"mocsa",
"mt-krainski",
"mvalues",
"nestedfield",
"nonnull",
"noopener",
"Nums",
"offref",
"onwarn",
"ooker777",
"outlink",
"outlinks",
"padleft",
"padright",
"Pagerow",
"papaparse",
"parsimmon",
"pathlike",
"pjeby",
"pjepg",
"pleh",
"preact",
"protofarer",
"proxied",
"pymdownx",
"RaviOnline",
"rawlink",
"recurkey",
"Refreshable",
"REGEXES",
"regexmatch",
"regexreplace",
"regextest",
"renderable",
"Repr",
"RyotaUshio",
"sandboxed",
"sandboxing",
"seanlzx",
"sheeley",
"sohanglal",
"somemetadata",
"somidad",
"spoopy",
"Stardew",
"startswith",
"steamid",
"steg",
"striptime",
"subargs",
"subcontainer",
"subeval",
"subfolders",
"sublists",
"Subsettings",
"subsources",
"subtag",
"Subtags",
"subvalue",
"subword",
"succ",
"superfences",
"tasklist",
"tcopy",
"Templater",
"Testcase",
"toolbelt",
"trunc",
"typeof",
"tzhou",
"unindented",
"unrendered",
"v_mujunma",
"vals",
"vararg",
"varargs",
"vectorize",
"vitaly",
"vpos",
"vrtmrz",
"weekyear",
"whitespaces",
"xxhello",
"ymdh",
"ymdhm",
"ymdhms",
"zerollup",
"Статус"
],
"ignoreWords": [],
"import": [],
"enabled": true
}
================================================
FILE: docs/.gitignore
================================================
site/
================================================
FILE: docs/docs/annotation/add-metadata.md
================================================
# Adding Metadata to your Pages
Dataview cannot query all content of your vault. In order to be able to search, filter and display content, this content needs to be **indexed**. Some content is indexed automatically, like bullet points or task lists - so called **Implicit fields**, more on that below - and other data needs to be saved in a metadata **field** to be accessible through dataview.
## What is a "field"?
A metadata field is a pair of a **key** and a **value**. The _value_ of a field has a data type (more on that [here](./types-of-metadata.md)) that determines how this field will behave when querying it.
You can add any number of fields to a **note**, a **list item** or a **task**.
## How do I add fields?
You can add fields to a **note** in three different ways. How a field look like depends on the way you add it.
On **tasks or list items**, you will have YAML Frontmatter information available, but won't be able to add them to a specific list item. If you want to add metadata to one list item or task only, use [Inline Fields](#inline-fields).
### Frontmatter
Frontmatter is a common Markdown extension which allows for YAML metadata to be added to the top of a page. It is natively supported by Obsidian and explained in its [official documentation](https://help.obsidian.md/Advanced+topics/YAML+front+matter). All YAML Frontmatter fields will be automatically available as Dataview fields.
```yaml
---
alias: "document"
last-reviewed: 2021-08-17
thoughts:
rating: 8
reviewable: false
---
```
With this your note has metadata fields named `alias`, `last-reviewed`, and `thoughts`. Each of these have different **data types**:
- `alias` is a [text](types-of-metadata.md#text), because its wrapped in ""
- `last-reviewed` is a [date](types-of-metadata.md#date), because it follows the ISO date format
- `thoughts` is a [object](types-of-metadata.md#object) field, because it uses the YAML Frontmatter object syntax
You could query for this note with the following query:
~~~
```dataview
LIST
WHERE thoughts.rating = 8
```
~~~
### Inline Fields
For those wanting a more natural-looking annotation, Dataview supports "inline" fields via a `Key:: Value` syntax that you can use everywhere in your file. This allows you to write your queryable data right where you need it - for example in the middle of a sentence.
If your inline field has an own line, without any content beforehand, you can write it like this:
```markdown
# Markdown Page
Basic Field:: Some random Value
**Bold Field**:: Nice!
```
All content after the `::` is the value of the field until the next line break.
!!! hint "Mind the `::`"
Note that you need to use a double colon `::` between key and value when using inline fields, contrary to YAML Frontmatter fields where one colon is enough.
If you want to embed metadata inside sentences, or multiple fields on the same line, you can use the bracket syntax and wrap your field in square brackets:
```markdown
I would rate this a [rating:: 9]! It was [mood:: acceptable].
```
!!! info "Fields on list items and tasks"
When you want to annotate a list item, e.g. a task, with metadata, you always need to use the bracket syntax (because the field is not the only information in this line)
```markdown
- [ ] Send an mail to David about the deadline [due:: 2022-04-05].
```
Bracketed inline fields are the only way to explicitly add fields to specific list items, YAML frontmatter always applies to the whole page (but is also available in context of list items.)
There is also the alternative parenthesis syntax, which hides the key when
rendered in Reader mode:
```markdown
This will not show the (longKeyIDontNeedWhenReading:: key).
```
will render to:
```markdown
This will not show the key.
```
You can use YAML Frontmatter and Inline fields with all syntax variants together in one file. You do not need to decide for one and can mix them to fit your workflow.
## Field names
Imagine you used all the examples for Inline fields you see above in one note, then following metadata would be available to you:
| Metadata Key | Sanitized Metadata key | Value | Data Type of Value |
| ----------- | ------------------------|----------- | ----------- |
| `Basic Field` | `basic-field` | Some random Value | Text |
| `Bold Field` | `bold-field` | Nice! | Text |
| `rating` | - | 9 | Number |
| `mood` | - | acceptable | Text |
| `due` | - | Date Object for 2022-04-05 | Date |
| `longKeyIDontNeedWhenReading` | `longkeyidontneedwhenreading` | key | Text |
Like you can see in the table, if you are using **spaces or capitalized letters** in your metadata key name, dataview will provide you with a **sanitized version** of the key.
**Keys with spaces** cannot be used in a query as-is. You have two possibilities here: Either use the sanitized name, that is always all lowercase and with dashes instead of spaces or use the **row** variable syntax. Find out more [in the FAQ](../resources/faq.md).
**Keys with capitalized letters** can be used as-is, if you wish. The sanitized version allows you to query for a key independent of its capitalization and makes it easier to use: You can query the same field that's, for example, in one file named `someMetadata` and in another `someMetaData` when using the sanitized key `somemetadata`.
In addition, the **bold field key is missing its formatting tokens**. Even though the `**` used to make it appear bold are part of the key name in the file, they are left out when indexing your note. The same goes for all other built-in formatting, like strike through or italic. This means formatted keys can only be queried without their formatting. This allows you to format the key in context of the note without worrying that you might create different keys for the same type of information.
### Usage of emojis and non-latin characters
You are not limited to latin characters when naming your metadata fields. You can use all characters available in UTF-8:
```markdown
Noël:: Un jeu de console
クリスマス:: 家庭用ゲーム機
[🎅:: a console game]
[xmas🎄:: a console game]
```
**Using emojis as metadata keys** is possible, but it comes with some limitations. When using emojis in field names, you need to put them into square brackets so that dataview recognize them correctly.
Also, please be aware when switching the OS (i.e. from Windows to Android), the same emoji could use another character code and you might not find your metadata when querying it.
!!! info "Task Field Shorthands"
An exception to this are the [shorthand syntax](./metadata-tasks.md#field-shorthands) in Tasks. You can use shorthands without bracketing. Please mind though that this only counts for listed shorthands - every other field (if with emojis or not) need to use the `[key:: value]` syntax.
## Implicit fields
Even if you do not add any metadata explicitly to your note, dataview provides you with a big amount of indexed data out of the box. Some examples for implicit fields are:
- day the file was created (`file.cday`)
- links in the file (`file.outlinks`)
- tags in the file (`file.etags`)
- all list items in the file (`file.lists` and `file.tasks`)
and many more. Available implicit fields differ depending if you look at a page or a list item. Find the full list of available implicit fields on [Metadata on pages](metadata-pages.md) and [Metadata on Tasks and Lists](metadata-tasks.md).
================================================
FILE: docs/docs/annotation/metadata-pages.md
================================================
# Metadata on Pages
You can add fields to a markdown page (a note) in three different ways - via Frontmatter, Inline fields and Implicit fields. Read more about the first two possibilities in ["how to add metadata"](./add-metadata.md).
## Implicit Fields
Dataview automatically adds a large amount of metadata to each page. These implicit and automatically added fields are collected under the field `file`. Following are available:
| Field Name | Data Type | Description |
| --------------------- | --------- | ----------- |
| `file.name` | Text | The file name as seen in Obsidians sidebar. |
| `file.folder` | Text | The path of the folder this file belongs to. |
| `file.path` | Text | The full file path, including the files name. |
| `file.ext` | Text | The extension of the file type; generally `md`. |
| `file.link` | Link | A link to the file. |
| `file.size` | Number | The size (in bytes) of the file. |
| `file.ctime` | Date with Time | The date that the file was created. |
| `file.cday` | Date | The date that the file was created. |
| `file.mtime` | Date with Time | The date that the file was last modified. |
| `file.mday` | Date | The date that the file was last modified. |
| `file.tags` | List | A list of all unique tags in the note. Subtags are broken down by each level, so `#Tag/1/A` will be stored in the list as `[#Tag, #Tag/1, #Tag/1/A]`. |
| `file.etags` | List | A list of all explicit tags in the note; unlike `file.tags`, does not break subtags down, i.e. `[#Tag/1/A]` |
| `file.inlinks` | List | A list of all incoming links to this file, meaning all files that contain a link to this file. |
| `file.outlinks` | List | A list of all outgoing links from this file, meaning all links the file contains. |
| `file.aliases` | List | A list of all aliases for the note as defined via the [YAML frontmatter](https://help.obsidian.md/How+to/Add+aliases+to+note). |
| `file.tasks` | List | A list of all tasks (I.e., `| [ ] some task`) in this file. |
| `file.lists` | List | A list of all list elements in the file (including tasks); these elements are effectively tasks and can be rendered in task views. |
| `file.frontmatter` | List | Contains the raw values of all frontmatter in form of `key | value` text values; mainly useful for checking raw frontmatter values or for dynamically listing frontmatter keys. |
| `file.day` | Date | Only available if the file has a date inside its file name (of form `yyyy-mm-dd` or `yyyymmdd`), or has a `Date` field/inline field. |
| `file.starred` | Boolean | If this file has been bookmarked via the Obsidian Core Plugin "Bookmarks". |
## Example page
This is a small Markdown page which includes both user-defined ways to add metadata:
```markdown
---
genre: "action"
reviewed: false
---
# Movie X
#movies
**Thoughts**:: It was decent.
**Rating**:: 6
[mood:: okay] | [length:: 2 hours]
```
In addition to the values you see here, the page has also all keys listed above available.
### Example Query
You can query part of the above information with following query, for example:
~~~yaml
```dataview
TABLE file.ctime, length, rating, reviewed
FROM #movies
```
~~~
================================================
FILE: docs/docs/annotation/metadata-tasks.md
================================================
# Metadata on Tasks and Lists
Just like pages, you can also add **fields** on list item and task level to bind it to a specific task as context. For this you need to use the [inline field syntax](add-metadata.md#inline-fields):
```markdown
- [ ] Hello, this is some [metadata:: value]!
- [X] I finished this on [completion:: 2021-08-15].
```
Tasks and list items are the same data wise, so all your bullet points have all the information described here available, too.
## Field Shorthands
The [Tasks](https://publish.obsidian.md/tasks/Introduction) plugin introduced a different [notation by using Emoji](https://publish.obsidian.md/tasks/Reference/Task+Formats/Tasks+Emoji+Format) to configure the different dates related to a task. In the context of Dataview, this notation is called `Field Shorthands`. The current version of Dataview only support the dates shorthands as shown below. The priorities and recurrence shorthands are not supported.
=== "Example"
=== "Example"
- [ ] Due this Saturday 🗓️2021-08-29
- [x] Completed last Saturday ✅2021-08-22
- [ ] I made this on ➕1990-06-14
- [ ] Task I can start this weekend 🛫2021-08-29
- [x] Task I finished ahead of schedule ⏳2021-08-29 ✅2021-08-22
There are two specifics to these emoji-shorthands. First, they omit the inline field syntax (no `[🗓️:: YYYY-MM-DD]` needed) and secondly, they map to a **textual** field name data-wise:
| Field name | Short hand syntax |
| ---------- | ----------------- |
| due | `🗓️YYYY-MM-DD` |
| completion | `✅YYYY-MM-DD` |
| created | `➕YYYY-MM-DD` |
| start | `🛫YYYY-MM-DD` |
| scheduled | `⏳YYYY-MM-DD` |
This means if you want to query for all tasks that are completed 2021-08-22, you'll write:
~~~markdown
```dataview
TASK
WHERE completion = date("2021-08-22")
```
~~~
Which will list both variants - shorthands and textual annotation:
```markdown
- [x] Completed last Saturday ✅2021-08-22
- [x] Some Done Task [completion:: 2021-08-22]
```
## Implicit Fields
As with pages, Dataview adds a number of implicit fields to each task or list item:
!!! info "Inheritance of Fields"
Tasks inherit *all fields* from their parent page - so if you have a `rating` field in your page, you can also access it on your task in a `TASK` Query.
| Field name | Data Type | Description |
| ---------- | --------- | ----------- |
| `status` | Text | The completion status of this task, as determined by the character inside the `[ ]` brackets. Generally a space `" "` for incomplete tasks and an `"x"` for completed tasks, but allows for plugins which support alternative task statuses. |
| `checked` | Boolean | Whether or not this task's status is **not** empty, meaning it has some `status` character (which may or may not be `"x"`) instead of a space in its `[ ]` brackets. |
| `completed` | Boolean | Whether or not this *specific* task has been completed; this does not consider the completion or non-completion of any child tasks. A task is explicitly considered "completed" if it has been marked with an `"x"`. If you use a custom status, e.g. `[-]`, `checked` will be true, whereas `completed` will be false. |
| `fullyCompleted` | Boolean | Whether or not this task and **all** of its subtasks are completed. |
| `text` | Text | The plain text of this task, including any metadata field annotations. |
| `visual` | Text | The text of this task, which is rendered by Dataview. This field can be overridden in DataviewJS to allow for different task text to be rendered than the regular task text, while still allowing the task to be checked (since Dataview validation logic normally checks the text against the text in-file). |
| `line` | Number | The line of the file this task shows up on. |
| `lineCount` | Number | The number of Markdown lines that this task takes up. |
| `path` | Text | The full path of the file this task is in. Equals to `file.path` for [pages](./metadata-pages.md). |
| `section` | Link | Link to the section this task is contained in. |
| `tags` | List | Any tags inside the task text. |
| `outlinks` | List | Any links defined in this task. |
| `link` | Link | Link to the closest linkable block near this task; useful for making links which go to the task. |
| `children` | List | Any subtasks or sublists of this task. |
| `task` | Boolean | If true, this is a task; otherwise, it is a regular list element. |
| `annotated` | Boolean | True if the task text contains any metadata fields, false otherwise. |
| `parent` | Number | The line number of the task above this task, if present; will be null if this is a root-level task. |
| `blockId` | Text | The block ID of this task / list element, if one has been defined with the `^blockId` syntax; otherwise null. |
With usage of the [shorthand syntax](#field-shorthands), following additional properties may be available:
- `completion`: The date a task was completed.
- `due`: The date a task is due, if it has one.
- `created`: The date a task was created.
- `start`: The date a task can be started.
- `scheduled`: The date a task is scheduled to work on.
### Accessing Implicit Fields in Queries
If you're using a [TASK](../queries/query-types.md#task) Query, your tasks are the top level information and can be used without any prefix:
~~~markdown
```dataview
TASK
WHERE !fullyCompleted
```
~~~
For every other Query type, you first need to access the implicit field `file.lists` or `file.tasks` to check for these list item specific implicit fields:
~~~markdown
```dataview
LIST
WHERE any(file.tasks, (t) => !t.fullyCompleted)
```
~~~
This will give you back all the file links that have unfinished tasks inside. We get back a list of tasks on page level and thus need to use a [list function](../reference/functions.md) to look at each element.
================================================
FILE: docs/docs/annotation/types-of-metadata.md
================================================
# Field Types
All fields in dataview have a **type**, which determines how dataview will render, sort, and operate on that field.
Read more about how to create fields on ["Adding metadata"](add-metadata.md) and which information you have automatically available on [metadata on pages](./metadata-pages.md) and [metadata on tasks and lists](./metadata-tasks.md).
## Why does the type matter?
Dataview provides [functions](../reference/functions.md) you can use to modify your metadata and allows you to write all sorts of complex queries. Specific functions need specific data types to work correctly. That means the data type of your field determines which functions you can use on these fields and how the functions behave. Furthermore, depending on the type, the output dataview renders can be different.
Most of the time you do not need to worry too much about the type of your fields, but if you want to perform calculations and other magical operations on your data, you should be aware of them.
!!! example "Different rendering based on type"
If you have this file:
~~~yaml
date1:: 2021-02-26T15:15
date2:: 2021-04-17 18:00
```dataview
TABLE date1, date2
WHERE file = this.file
```
~~~
You'll see the following output (depending on your Date + Time Format Setting for dataview):
| File (1) | date1 | date2 |
| -------- | ----- | ----- |
| Untitled 2 | 3:15 PM - February 26, 2021 | 2021-04-17 18:00 |
`date1` is recognized as a **Date** while `date2` is a normal **Text** to dataview, that's why `date1` is parsed differently for you. Find out more on [Dates below](#date).
## Available Field Types
Dataview knows several field types to cover common use cases.
### Text
The default catch-all. If a field doesn't match a more specific type, it is plain text.
```markdown
Example:: This is some normal text.
```
!!! hint "Multiline text"
Multiline text as a value is only possible via YAML Frontmatter and the pipe operator:
```yaml
---
poem: |
Because I could not stop for Death,
He kindly stopped for me;
The carriage held but just ourselves
And Immortality.
author: "[[Emily Dickinson]]"
title: "Because I could not stop for Death"
---
```
For inline fields, a line break means the end of the value.
### Number
Numbers like '6' and '3.6'.
```markdown
Example:: 6
Example:: 2.4
Example:: -80
```
In YAML Frontmatter, you write a number without surrounding quotes:
```yaml
---
rating: 8
description: "A nice little horror movie"
---
```
### Boolean
Boolean only knows two values: true or false, as the programming concept.
```markdown
Example:: true
Example:: false
```
### Date
Text that matches the ISO8601 notation will be automatically transformed into a date object. [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) follows the format `YYYY-MM[-DDTHH:mm:ss.nnn+ZZ]`. Everything after the month is optional.
```markdown
Example:: 2021-04
Example:: 2021-04-18
Example:: 2021-04-18T04:19:35.000
Example:: 2021-04-18T04:19:35.000+06:30
```
When querying for these dates, you can access properties that give you a certain portion of your date back:
- field.year
- field.month
- field.weekyear
- field.week
- field.weekday
- field.day
- field.hour
- field.minute
- field.second
- field.millisecond
For example, if you're interested in which month your date lies, you can access it via `datefield.month`:
~~~markdown
birthday:: 2001-06-11
```dataview
LIST birthday
WHERE birthday.month = date(now).month
```
~~~
gives you back all birthdays happening this month. Curious about `date(now)`? Read more about it under [literals](../reference/literals.md#dates).
!!! info "Displaying of date objects"
Dataview renders date objects in a human readable format, i.e. `3:15 PM - February 26, 2021`. You can adjust how this format looks like in Dataview's Setting under "General" with "Date Format" and "Date + Time Format". If you want to adjust the format in a specific query only, use the [dateformat function](../reference/functions.md#dateformatdatedatetime-string).
### Duration
Durations are text of the form `