Obsidian Plugins
Useful plugins for Obsidian.md ยท #note/sink
Dataview
Docs
Other links
- My DVJS bookmarks
- Complex structures via CustomJS plugin
- How to use Dataview outside a dataviewjs code block
- async & await in dataviewjs codeblock
- Code reuse
- Dataviewjs disappears in reading and preview mode
data: |
dataviewjs:
const loadData = async () => {
return dv.pages()
.groupBy(p => p.file.ctime.toFormat("HH"))
.map(p => ({cdate: p.key, count: p.rows.length}))
.array();
};
return await loadData();
Dynamic Tables with DataviewJS
Reusing Dataview queries
If I had a page called my script and put the DQL into a property called script, you can call it onto any page with just
$ =dv.execute(await dv.page("my script").script)
The this in the script will localise to the page it's called on, and if changes to the script it will naturally update everywhere, same as bases.
If the only thing your script page was, was the script, then you can also skip the property entirely. Just write it into a plain text file and call it the same sans the last .script.
CalcCraft
Have formulas in tables like in excel
GitHub
---
cssclasses: calccraft
---
a2+b2 // simple sum
-2c+1r // two columns left, one row down
-0c-1r // same column, 1 row up
(b-2r)-(b-1r)
[a:a] // map entire column to the result column
sum(b1:b-1r)
min(b2:b-1r)
max(b2:b-1r)
[b2:b99]-[c2:c99] // sub rows
sum(a2:b4) >20 // boolean
transpose([a2:c4]) // transpose matrix
range(1,20,2) // generate sequence
map([a:a],hex) // map function
map([a:a],sin)
map([a:a],isPrime)
isNumeric([a:a])
to(unit(a2), "cm") // unit conversion
[a:a]./[b:b] // 5 m | 10 s = 0.5 m/s
([b:b]-[a:a])./[c:c] // 10 km/h | 100 km/h | 10 s = 2.5 m/s^2
gravitationConstant
planckConstant
Use [a1:c3] for matrix operations, a1:c3 for simple ranges
Include units in your data - the plugin handles conversions automatically