obsidian-bases — Obsidian Bases 參考
Obsidian Bases (.base 檔案) 的完整參考。Bases 是動態資料庫視圖,可以查詢和展示 vault 中的筆記。
檔案格式
.base 檔案使用 YAML 格式。
基本結構
yaml
# 全域篩選器
filter:
- field: folder
op: equals
value: "20_專案"
# 視圖定義
views:
- name: "視圖名稱"
type: table # table, cards, list, map
# 視圖專屬設定
篩選操作符
- •
equals,not_equals - •
contains,not_contains - •
starts_with,ends_with - •
is_empty,is_not_empty - •
gt,lt,gte,lte(數值/日期)
視圖類型
- •table: 表格視圖,支援排序和分組
- •cards: 卡片視圖,適合視覺化瀏覽
- •list: 列表視圖,簡潔展示
- •map: 地圖視圖(需要地理座標)
公式欄位
可以在 base 中定義計算欄位:
yaml
formula_properties:
- name: "天數"
formula: "dateDiff(now(), prop('created'), 'days')"
常用函數
- •日期:
now(),dateDiff(),dateFormat() - •字串:
contains(),replace(),length() - •數值:
sum(),avg(),min(),max() - •列表:
map(),filter(),join() - •檔案:
prop(),file.name,file.folder