obsidian-bases by kepano/obsidian-skills
npx skills add https://github.com/kepano/obsidian-skills --skill obsidian-bases.base 文件filters 以选择哪些笔记出现(通过标签、文件夹、属性或日期)formulas 部分定义计算属性table、cards、list 或 map),并使用 order 指定要显示的属性广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
formula.XformulasX.base 文件以确认视图正确渲染。如果显示 YAML 错误,请检查下面的引号规则Base 文件使用 .base 扩展名并包含有效的 YAML。
# 全局过滤器应用于 base 中的所有视图
filters:
# 可以是单个过滤器字符串
# 或者是一个带有 and/or/not 的递归过滤器对象
and: []
or: []
not: []
# 定义可在所有视图中使用的公式属性
formulas:
formula_name: 'expression'
# 配置属性的显示名称和设置
properties:
property_name:
displayName: "Display Name"
formula.formula_name:
displayName: "Formula Display Name"
file.ext:
displayName: "Extension"
# 定义自定义摘要公式
summaries:
custom_summary_name: 'values.mean().round(3)'
# 定义一个或多个视图
views:
- type: table | cards | list | map
name: "View Name"
limit: 10 # 可选:限制结果数量
groupBy: # 可选:对结果分组
property: property_name
direction: ASC | DESC
filters: # 视图特定的过滤器
and: []
order: # 按顺序显示的属性
- file.name
- property_name
- formula.formula_name
summaries: # 将属性映射到摘要公式
property_name: Average
过滤器用于缩小结果范围。可以全局应用或按视图应用。
# 单个过滤器
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("Required Reading")
| 运算符 | 描述 |
|---|---|
== | 等于 |
!= | 不等于 |
> | 大于 |
< | 小于 |
>= | 大于或等于 |
<= | 小于或等于 |
&& | 逻辑与 |
| ` | |
| ! | 逻辑非 |
note.author 或仅 authorfile.name、file.mtime 等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 | 对象 | 所有 frontmatter 属性 |
this 关键字公式根据属性计算值。在 formulas 部分定义。
formulas:
# 简单算术
total: "price * quantity"
# 条件逻辑
status_icon: 'if(done, "✅", "⏳")'
# 字符串格式化
formatted_price: 'if(price, price.toFixed(2) + " dollars")'
# 日期格式化
created: 'file.ctime.format("YYYY-MM-DD")'
# 计算自创建以来的天数(对 Duration 使用 .days)
days_old: '(now() - file.ctime).days'
# 计算距离截止日期的天数
days_until_due: 'if(due_date, (date(due_date) - today()).days, "")'
最常用的函数。有关所有类型(Date、String、Number、List、File、Link、Object、RegExp)的完整参考,请参阅 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.days、duration.hours、duration.minutes、duration.seconds、duration.milliseconds
重要提示: Duration 不直接支持 .round()、.floor()、.ceil()。请先访问数字字段(如 .days),然后再应用数字函数。
# 正确:计算日期之间的天数
"(date(due_date) - today()).days" # 返回天数
"(now() - file.ctime).days" # 自创建以来的天数
"(date(due_date) - today()).days.round(0)" # 四舍五入后的天数
# 错误 - 会导致错误:
# "((date(due) - today()) / 86400000).round(0)" # Duration 不支持除法然后四舍五入
# Duration 单位:y/year/years, M/month/months, d/day/days,
# w/week/weeks, h/hour/hours, m/minute/minutes, s/second/seconds
"now() + \"1 day\"" # 明天
"today() + \"7d\"" # 从今天起一周后
"now() - file.ctime" # 返回 Duration
"(now() - file.ctime).days" # 获取天数作为数字
views:
- type: table
name: "My Table"
order:
- file.name
- status
- due_date
summaries:
price: Sum
count: Average
views:
- type: cards
name: "Gallery"
order:
- file.name
- cover_image
- description
views:
- type: list
name: "Simple List"
order:
- file.name
- status
需要经纬度属性和 Maps 社区插件。
views:
- type: map
name: "Locations"
# 针对经纬度属性的地图特定设置
| 名称 | 输入类型 | 描述 |
|---|---|---|
Average | 数字 | 算术平均值 |
Min | 数字 | 最小数 |
Max | 数字 | 最大数 |
Sum | 数字 | 所有数字的总和 |
Range | 数字 | 最大值 - 最小值 |
Median | 数字 | 算术中位数 |
Stddev | 数字 | 标准差 |
Earliest | 日期 | 最早的日期 |
Latest | 日期 | 最晚的日期 |
Range | 日期 | 最晚 - 最早 |
Checked | 布尔值 | 真值的计数 |
Unchecked | 布尔值 | 假值的计数 |
Empty | 任意 | 空值的计数 |
Filled | 任意 | 非空值的计数 |
Unique | 任意 | 唯一值的计数 |
filters:
and:
- file.hasTag("task")
- 'file.ext == "md"'
formulas:
days_until_due: 'if(due, (date(due) - today()).days, "")'
is_overdue: 'if(due, date(due) < today() && status != "done", false)'
priority_label: 'if(priority == 1, "🔴 High", if(priority == 2, "🟡 Medium", "🟢 Low"))'
properties:
status:
displayName: Status
formula.days_until_due:
displayName: "Days Until Due"
formula.priority_label:
displayName: Priority
views:
- type: table
name: "Active Tasks"
filters:
and:
- 'status != "done"'
order:
- file.name
- status
- formula.priority_label
- due
- formula.days_until_due
groupBy:
property: status
direction: ASC
summaries:
formula.days_until_due: Average
- type: table
name: "Completed"
filters:
and:
- 'status == "done"'
order:
- file.name
- completed_date
filters:
or:
- file.hasTag("book")
- file.hasTag("article")
formulas:
reading_time: 'if(pages, (pages * 2).toString() + " min", "")'
status_icon: 'if(status == "reading", "📖", if(status == "done", "✅", "📚"))'
year_read: 'if(finished_date, date(finished_date).year, "")'
properties:
author:
displayName: Author
formula.status_icon:
displayName: ""
formula.reading_time:
displayName: "Est. Time"
views:
- type: cards
name: "Library"
order:
- cover
- file.name
- author
- formula.status_icon
filters:
not:
- 'status == "dropped"'
- type: table
name: "Reading List"
filters:
and:
- 'status == "to-read"'
order:
- file.name
- author
- pages
- formula.reading_time
filters:
and:
- file.inFolder("Daily Notes")
- '/^\d{4}-\d{2}-\d{2}$/.matches(file.basename)'
formulas:
word_estimate: '(file.size / 5).round(0)'
day_of_week: 'date(file.basename).format("dddd")'
properties:
formula.day_of_week:
displayName: "Day"
formula.word_estimate:
displayName: "~Words"
views:
- type: table
name: "Recent Notes"
limit: 30
order:
- file.name
- formula.day_of_week
- formula.word_estimate
- file.mtime
在 Markdown 文件中嵌入:
![[MyBase.base]]
<!-- 特定视图 -->
![[MyBase.base#View Name]]
'if(done, "Yes", "No")'"My View Name"未加引号的特殊字符:包含 :、{、}、[、]、,、&、*、#、?、|、-、<、>、=、!、%、@、``` 的字符串必须加引号。
# 错误 - 未加引号的字符串中包含冒号
displayName: Status: Active
# 正确
displayName: "Status: Active"
公式中引号不匹配:当公式包含双引号时,用单引号包裹整个公式。
# 错误 - 双引号内包含双引号
formulas:
label: "if(done, "Yes", "No")"
# 正确 - 用单引号包裹双引号
formulas:
label: 'if(done, "Yes", "No")'
没有字段访问的 Duration 运算:减去日期返回的是 Duration,而不是数字。始终访问 .days、.hours 等。
# 错误 - Duration 不是数字
"(now() - file.ctime).round(0)"
# 正确 - 先访问 .days,然后四舍五入
"(now() - file.ctime).days.round(0)"
缺少空值检查:属性可能并非在所有笔记中都存在。使用 if() 进行保护。
# 错误 - 如果 due_date 为空则崩溃
"(date(due_date) - today()).days"
# 正确 - 使用 if() 保护
'if(due_date, (date(due_date) - today()).days, "")'
引用未定义的公式:确保 order 或 properties 中的每个 formula.X 在 formulas 中都有匹配的条目。
# 如果 'total' 未在 formulas 中定义,这将静默失败
order:
- formula.total
# 修复:定义它
formulas:
total: "price * quantity"
每周安装量
9.7K
仓库
GitHub 星标数
16.9K
首次出现
Jan 20, 2026
安全审计
安装于
opencode8.8K
codex8.6K
gemini-cli8.6K
github-copilot8.3K
kimi-cli8.0K
amp8.0K
.base file in the vault with valid YAML contentfilters to select which notes appear (by tag, folder, property, or date)formulas sectiontable, cards, list, or map) with order specifying which properties to displayformula.X without defining X in formulas.base file in Obsidian to confirm the view renders correctly. If it shows a YAML error, check quoting rules belowBase files use the .base extension and contain valid YAML.
# Global filters apply to ALL views in the base
filters:
# Can be a single filter string
# OR a recursive filter object with and/or/not
and: []
or: []
not: []
# Define formula properties that can be used across all views
formulas:
formula_name: 'expression'
# Configure display names and settings for properties
properties:
property_name:
displayName: "Display Name"
formula.formula_name:
displayName: "Formula Display Name"
file.ext:
displayName: "Extension"
# Define custom summary formulas
summaries:
custom_summary_name: 'values.mean().round(3)'
# Define one or more views
views:
- type: table | cards | list | map
name: "View Name"
limit: 10 # Optional: limit results
groupBy: # Optional: group results
property: property_name
direction: ASC | DESC
filters: # View-specific filters
and: []
order: # Properties to display in order
- file.name
- property_name
- formula.formula_name
summaries: # Map properties to summary formulas
property_name: Average
Filters narrow down results. They can be applied globally or per-view.
# Single filter
filters: 'status == "done"'
# AND - all conditions must be true
filters:
and:
- 'status == "done"'
- 'priority > 3'
# OR - any condition can be true
filters:
or:
- 'file.hasTag("book")'
- 'file.hasTag("article")'
# NOT - exclude matching items
filters:
not:
- 'file.hasTag("archived")'
# Nested filters
filters:
or:
- file.hasTag("tag")
- and:
- file.hasTag("book")
- file.hasLink("Textbook")
- not:
- file.hasTag("book")
- file.inFolder("Required Reading")
| Operator | Description |
|---|---|
== | equals |
!= | not equal |
> | greater than |
< | less than |
>= | greater than or equal |
<= | less than or equal |
&& |
note.author or just authorfile.name, file.mtime, etc.formula.my_formula| Property | Type | Description |
|---|---|---|
file.name | String | File name |
file.basename | String | File name without extension |
file.path | String | Full path to file |
file.folder | String | Parent folder path |
file.ext | String | File extension |
this KeywordFormulas compute values from properties. Defined in the formulas section.
formulas:
# Simple arithmetic
total: "price * quantity"
# Conditional logic
status_icon: 'if(done, "✅", "⏳")'
# String formatting
formatted_price: 'if(price, price.toFixed(2) + " dollars")'
# Date formatting
created: 'file.ctime.format("YYYY-MM-DD")'
# Calculate days since created (use .days for Duration)
days_old: '(now() - file.ctime).days'
# Calculate days until due date
days_until_due: 'if(due_date, (date(due_date) - today()).days, "")'
Most commonly used functions. For the complete reference of all types (Date, String, Number, List, File, Link, Object, RegExp), see FUNCTIONS_REFERENCE.md.
| Function | Signature | Description |
|---|---|---|
date() | date(string): date | Parse string to date (YYYY-MM-DD HH:mm:ss) |
now() | now(): date | Current date and time |
today() | today(): date | Current date (time = 00:00:00) |
When subtracting two dates, the result is a Duration type (not a number).
Duration Fields: duration.days, duration.hours, duration.minutes, duration.seconds, duration.milliseconds
IMPORTANT: Duration does NOT support .round(), .floor(), .ceil() directly. Access a numeric field first (like .days), then apply number functions.
# CORRECT: Calculate days between dates
"(date(due_date) - today()).days" # Returns number of days
"(now() - file.ctime).days" # Days since created
"(date(due_date) - today()).days.round(0)" # Rounded days
# WRONG - will cause error:
# "((date(due) - today()) / 86400000).round(0)" # Duration doesn't support division then round
# Duration units: y/year/years, M/month/months, d/day/days,
# w/week/weeks, h/hour/hours, m/minute/minutes, s/second/seconds
"now() + \"1 day\"" # Tomorrow
"today() + \"7d\"" # A week from today
"now() - file.ctime" # Returns Duration
"(now() - file.ctime).days" # Get days as number
views:
- type: table
name: "My Table"
order:
- file.name
- status
- due_date
summaries:
price: Sum
count: Average
views:
- type: cards
name: "Gallery"
order:
- file.name
- cover_image
- description
views:
- type: list
name: "Simple List"
order:
- file.name
- status
Requires latitude/longitude properties and the Maps community plugin.
views:
- type: map
name: "Locations"
# Map-specific settings for lat/lng properties
| Name | Input Type | Description |
|---|---|---|
Average | Number | Mathematical mean |
Min | Number | Smallest number |
Max | Number | Largest number |
Sum | Number | Sum of all numbers |
Range | Number | Max - Min |
filters:
and:
- file.hasTag("task")
- 'file.ext == "md"'
formulas:
days_until_due: 'if(due, (date(due) - today()).days, "")'
is_overdue: 'if(due, date(due) < today() && status != "done", false)'
priority_label: 'if(priority == 1, "🔴 High", if(priority == 2, "🟡 Medium", "🟢 Low"))'
properties:
status:
displayName: Status
formula.days_until_due:
displayName: "Days Until Due"
formula.priority_label:
displayName: Priority
views:
- type: table
name: "Active Tasks"
filters:
and:
- 'status != "done"'
order:
- file.name
- status
- formula.priority_label
- due
- formula.days_until_due
groupBy:
property: status
direction: ASC
summaries:
formula.days_until_due: Average
- type: table
name: "Completed"
filters:
and:
- 'status == "done"'
order:
- file.name
- completed_date
filters:
or:
- file.hasTag("book")
- file.hasTag("article")
formulas:
reading_time: 'if(pages, (pages * 2).toString() + " min", "")'
status_icon: 'if(status == "reading", "📖", if(status == "done", "✅", "📚"))'
year_read: 'if(finished_date, date(finished_date).year, "")'
properties:
author:
displayName: Author
formula.status_icon:
displayName: ""
formula.reading_time:
displayName: "Est. Time"
views:
- type: cards
name: "Library"
order:
- cover
- file.name
- author
- formula.status_icon
filters:
not:
- 'status == "dropped"'
- type: table
name: "Reading List"
filters:
and:
- 'status == "to-read"'
order:
- file.name
- author
- pages
- formula.reading_time
filters:
and:
- file.inFolder("Daily Notes")
- '/^\d{4}-\d{2}-\d{2}$/.matches(file.basename)'
formulas:
word_estimate: '(file.size / 5).round(0)'
day_of_week: 'date(file.basename).format("dddd")'
properties:
formula.day_of_week:
displayName: "Day"
formula.word_estimate:
displayName: "~Words"
views:
- type: table
name: "Recent Notes"
limit: 30
order:
- file.name
- formula.day_of_week
- formula.word_estimate
- file.mtime
Embed in Markdown files:
![[MyBase.base]]
<!-- Specific view -->
![[MyBase.base#View Name]]
'if(done, "Yes", "No")'"My View Name"Unquoted special characters : Strings containing :, {, }, [, ], ,, &, *, #, ?, |, -, , , , , , , ``` must be quoted.
# WRONG - colon in unquoted string
displayName: Status: Active
# CORRECT
displayName: "Status: Active"
Mismatched quotes in formulas : When a formula contains double quotes, wrap the entire formula in single quotes.
# WRONG - double quotes inside double quotes
formulas:
label: "if(done, "Yes", "No")"
# CORRECT - single quotes wrapping double quotes
formulas:
label: 'if(done, "Yes", "No")'
Duration math without field access : Subtracting dates returns a Duration, not a number. Always access .days, .hours, etc.
# WRONG - Duration is not a number
"(now() - file.ctime).round(0)"
# CORRECT - access .days first, then round
"(now() - file.ctime).days.round(0)"
Missing null checks : Properties may not exist on all notes. Use if() to guard.
# WRONG - crashes if due_date is empty
"(date(due_date) - today()).days"
# CORRECT - guard with if()
'if(due_date, (date(due_date) - today()).days, "")'
Referencing undefined formulas : Ensure every formula.X in order or properties has a matching entry in formulas.
# This will fail silently if 'total' is not defined in formulas
order:
- formula.total
# Fix: define it
formulas:
total: "price * quantity"
Weekly Installs
9.7K
Repository
GitHub Stars
16.9K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode8.8K
codex8.6K
gemini-cli8.6K
github-copilot8.3K
kimi-cli8.0K
amp8.0K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
AI智能体长期记忆系统 - 精英级架构,融合6种方法,永不丢失上下文
1,200 周安装
AI新闻播客制作技能:实时新闻转对话式播客脚本与音频生成
1,200 周安装
Word文档处理器:DOCX创建、编辑、分析与修订痕迹处理全指南 | 自动化办公解决方案
1,200 周安装
React Router 框架模式指南:全栈开发、文件路由、数据加载与渲染策略
1,200 周安装
Nano Banana AI 图像生成工具:使用 Gemini 3 Pro 生成与编辑高分辨率图像
1,200 周安装
SVG Logo Designer - AI 驱动的专业矢量标识设计工具,生成可缩放品牌标识
1,200 周安装
| logical and |
| ` |
| ! | logical not |
file.size | Number | File size in bytes |
file.ctime | Date | Created time |
file.mtime | Date | Modified time |
file.tags | List | All tags in file |
file.links | List | Internal links in file |
file.backlinks | List | Files linking to this file |
file.embeds | List | Embeds in the note |
file.properties | Object | All frontmatter properties |
if() | if(condition, trueResult, falseResult?) | Conditional |
duration() | duration(string): duration | Parse duration string |
file() | file(path): file | Get file object |
link() | link(path, display?): Link | Create a link |
Median| Number |
| Mathematical median |
Stddev | Number | Standard deviation |
Earliest | Date | Earliest date |
Latest | Date | Latest date |
Range | Date | Latest - Earliest |
Checked | Boolean | Count of true values |
Unchecked | Boolean | Count of false values |
Empty | Any | Count of empty values |
Filled | Any | Count of non-empty values |
Unique | Any | Count of unique values |
<>=!%@