返回顶部
o

obsidian-bases黑曜石基地

Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
618
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

obsidian-bases

Obsidian Bases 技能

工作流程

  1. 1. 创建文件:在仓库中创建一个包含有效 YAML 内容的 .base 文件
  2. 定义范围:添加 filters 来选择显示哪些笔记(按标签、文件夹、属性或日期)
  3. 添加公式(可选):在 formulas 部分定义计算属性
  4. 配置视图:添加一个或多个视图(table、cards、list 或 map),使用 order 指定要显示的属性
  5. 验证:确认文件是有效的 YAML 且没有语法错误。检查所有引用的属性和公式是否存在。常见问题:包含特殊 YAML 字符的未加引号字符串、公式表达式中引号不匹配、在 formulas 中未定义 X 却引用了 formula.X
  6. 在 Obsidian 中测试:在 Obsidian 中打开 .base 文件,确认视图正确渲染。如果显示 YAML 错误,请检查下面的引号规则

模式

Base 文件使用 .base 扩展名,并包含有效的 YAML。

yaml

全局过滤器适用于 base 中的所有视图


filters:
# 可以是单个过滤器字符串
# 或者是包含 and/or/not 的递归过滤器对象
and: []
or: []
not: []

定义可在所有视图中使用的公式属性

formulas: formula_name: expression

配置属性的显示名称和设置

properties: property_name: displayName: 显示名称 formula.formula_name: displayName: 公式显示名称 file.ext: displayName: 扩展名

定义自定义汇总公式

summaries: customsummaryname: values.mean().round(3)

定义一个或多个视图

views: - type: table | cards | list | map name: 视图名称 limit: 10 # 可选:限制结果数量 groupBy: # 可选:分组结果 property: property_name direction: ASC | DESC filters: # 视图特定的过滤器 and: [] order: # 按顺序显示的属性 - file.name - property_name - formula.formula_name summaries: # 将属性映射到汇总公式 property_name: Average

过滤器语法

过滤器用于缩小结果范围。它们可以全局应用或按视图应用。

过滤器结构

yaml

单个过滤器


filters: status == done

AND - 所有条件必须为真

filters: and: - status == done - priority > 3

OR - 任一条件为真即可

filters: or: - file.hasTag(book) - file.hasTag(article)

NOT - 排除匹配项

filters: not: - file.hasTag(archived)

嵌套过滤器

filters: or: - file.hasTag(tag) - and: - file.hasTag(book) - file.hasLink(Textbook) - not: - file.hasTag(book) - file.inFolder(必读)

过滤器运算符

运算符描述
==等于
!=
不等于 | | > | 大于 | | < | 小于 | | >= | 大于或等于 | | <= | 小于或等于 | | && | 逻辑与 | | \|\| | 逻辑或 | | ! | 逻辑非 |

属性

三种属性类型

  1. 1. 笔记属性 - 来自前置元数据:note.author 或直接 author
  2. 文件属性 - 文件元数据:file.name、file.mtime 等
  3. 公式属性 - 计算值:formula.my_formula

文件属性参考

属性类型描述
file.name字符串文件名
file.basename
字符串 | 不带扩展名的文件名 | | file.path | 字符串 | 文件的完整路径 | | file.folder | 字符串 | 父文件夹路径 | | file.ext | 字符串 | 文件扩展名 | | file.size | 数字 | 文件大小(字节) | | file.ctime | 日期 | 创建时间 | | file.mtime | 日期 | 修改时间 | | file.tags | 列表 | 文件中的所有标签 | | file.links | 列表 | 文件中的内部链接 | | file.backlinks | 列表 | 链接到此文件的文件 | | file.embeds | 列表 | 笔记中的嵌入内容 | | file.properties | 对象 | 所有前置元数据属性 |

this 关键字

  • - 在主内容区域:指 base 文件本身
  • 嵌入时:指嵌入文件
  • 在侧边栏中:指主内容中的活动文件

公式语法

公式根据属性计算值。在 formulas 部分定义。

yaml
formulas:
# 简单算术
total: price * quantity

# 条件逻辑
status_icon: if(done, ✅, ⏳)

# 字符串格式化
formatted_price: if(price, price.toFixed(2) + 美元)

# 日期格式化
created: file.ctime.format(YYYY-MM-DD)

# 计算创建以来的天数(使用 .days 获取 Duration)
days_old: (now() - file.ctime).days

# 计算距离截止日期的天数
daysuntildue: if(duedate, (date(duedate) - today()).days, )

关键函数

最常用的函数。有关所有类型(日期、字符串、数字、列表、文件、链接、对象、正则表达式)的完整参考,请参见 FUNCTIONS_REFERENCE.md

函数签名描述
date()date(string): date将字符串解析为日期(YYYY-MM-DD HH:mm:ss)
now()
now(): date | 当前日期和时间 |
| today() | today(): date | 当前日期(时间 = 00:00:00) |
| if() | if(condition, trueResult, falseResult?) | 条件判断 |
| duration() | duration(string): duration | 解析持续时间字符串 |
| file() | file(path): file | 获取文件对象 |
| link() | link(path, display?): Link | 创建链接 |

Duration 类型

当两个日期相减时,结果是 Duration 类型(不是数字)。

Duration 字段: duration.days、duration.hours、duration.minutes、duration.seconds、duration.milliseconds

重要提示: Duration 不直接支持 .round()、.floor()、.ceil()。请先访问数字字段(如 .days),然后应用数字函数。

yaml

正确:计算日期之间的天数


(date(due_date) - today()).days # 返回天数
(now() - file.ctime).days # 创建以来的天数
(date(due_date) - today()).days.round(0) # 四舍五入后的天数

错误 - 会导致错误:

((date(due) - today()) / 86400000).round(0) # Duration 不支持除法后再四舍五入

日期算术

yaml

持续时间单位:y/年、M/月、d/天、


w/周、h/小时、m/分钟、s/秒


now() + \1 day\ # 明天
today() + \7d\ # 从今天起一周
now() - file.ctime # 返回 Duration
(now() - file.ctime).days # 获取天数(数字)

视图类型

表格视图

yaml
views:
- type: table
name: 我的表格
order:
- file.name
- status
- due_date
summaries:
price: Sum
count: Average

卡片视图

yaml
views:
- type: cards
name: 画廊
order:
- file.name
- cover_image
- description

列表视图

y

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 obsidian-bases-1776209387 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 obsidian-bases-1776209387 技能

通过命令行安装

skillhub install obsidian-bases-1776209387

下载

⬇ 下载 obsidian-bases v1.0.0(免费)

文件大小: 7.43 KB | 发布时间: 2026-4-15 12:35

v1.0.0 最新 2026-4-15 12:35
Obsidian Bases 1.0.0 – Initial Release

- Create and edit Obsidian Bases (`.base` files) using views, filters, formulas, and summaries.
- Supports table, card, list, and map views with customizable display order and summaries.
- Provides flexible filtering with AND/OR/NOT logic and custom filter operators.
- Formulas allow computed properties; summaries support common functions like Average, Sum, Min, Max.
- Documentation includes schema overview, filter syntax, property types, and formula examples.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部