Obsidian bases
Mac
Obsidian's bases show in Coffee. Embed a .base file in a note, or write a code block named base, and its views appear under it as a table or a board of cards, with a tab for each view.
How to show a base
- Put
![[Books.base]]on a line of its own, using the name of a.basefile in your library. - Click away from the line. The base's first view appears in its place.
- Click a tab above the list to see another view.
![[Books.base#By status]]opens that view first. - Click a row or card to open its note.
You can also write the base's YAML straight into a note, in a code block named base, as Obsidian allows.
Example
In Markdown
```base
filters:
and:
- file.hasTag("book")
- 'status != "done"'
formulas:
ppu: "(price / age).toFixed(2)"
views:
- type: table
name: Reading
order: [file.name, status, price, formula.ppu]
sort:
- property: price
direction: DESC
```This lists every book you haven't finished as a table, priciest first, with a column worked out from two properties.
Good to know
- Coffee reads filters with
and,orandnot, formulas, display names, sorting, limits and grouping.this.filemeans the note the base is shown in, sofile.hasLink(this.file)lists the notes that link to it. - Table views show as tables. Kanban and cards views with a group show as a board. A view type Coffee doesn't draw, such as a map, shows as a table.
- A function Coffee can't work out yet is named under the view, and that filter lets every note through rather than hiding them.
- Coffee only reads bases. Change a base, or the notes' properties, in the files themselves.
- Query blocks do the same job with a shorter syntax of Coffee's own.