Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/kepano/obsidian-skills/llms.txt

Use this file to discover all available pages before exploring further.

Obsidian Bases provides a rich set of built-in functions that can be called inside formula expressions and filter strings. Functions are organized by the type they operate on — global functions are called standalone, while type-specific functions are called as methods on a value using dot notation (e.g. file.ctime.format("YYYY-MM-DD") or file.tags.contains("project")). This page documents every built-in function available, organized by type.

Global Functions

Global functions are called directly by name without a receiver object. They are available everywhere an expression is valid — in formulas:, in filter strings, and in summary expressions.
FunctionSignatureDescription
date()date(string): dateParse a string to a date. Format: YYYY-MM-DD HH:mm:ss
duration()duration(string): durationParse a duration string (e.g. "1d", "2 weeks")
now()now(): dateCurrent date and time
today()today(): dateCurrent date with time set to 00:00:00
if()if(condition, trueResult, falseResult?)Conditional expression; falseResult defaults to empty
min()min(n1, n2, ...): numberReturns the smallest of the supplied numbers
max()max(n1, n2, ...): numberReturns the largest of the supplied numbers
number()number(any): numberConvert a value to a number
link()link(path, display?): LinkCreate a link from a path, with optional display text
list()list(element): ListWrap a value in a list if it is not already one
file()file(path): fileGet a file object for the given vault path
image()image(path): imageCreate an image value for rendering
icon()icon(name): iconReference a Lucide icon by name
html()html(string): htmlRender a string as raw HTML
escapeHTML()escapeHTML(string): stringEscape HTML special characters in a string

Any Type Functions

These functions are available on any value, regardless of its type.
FunctionSignatureDescription
isTruthy()any.isTruthy(): booleanCoerce the value to a boolean
isType()any.isType(type): booleanCheck whether the value is of the specified type
toString()any.toString(): stringConvert the value to a string

Date Functions

Date values expose both fields (accessed with dot notation, no parentheses) and functions (called with parentheses). Date fields:
FieldTypeDescription
date.yearNumberFour-digit year
date.monthNumberMonth (1–12)
date.dayNumberDay of the month (1–31)
date.hourNumberHour (0–23)
date.minuteNumberMinute (0–59)
date.secondNumberSecond (0–59)
date.millisecondNumberMillisecond (0–999)
Date functions:
FunctionSignatureDescription
date()date.date(): dateStrip the time portion, returning midnight on that date
format()date.format(string): stringFormat using a Moment.js pattern (e.g. "YYYY-MM-DD", "dddd")
time()date.time(): stringGet the time portion as a string
relative()date.relative(): stringHuman-readable relative time (e.g. “3 days ago”)
isEmpty()date.isEmpty(): booleanAlways returns false for date values

Duration Type

A Duration is returned when you subtract two dates. It has its own set of numeric fields and does not share the numeric functions available on plain numbers. Duration fields:
FieldTypeDescription
duration.daysNumberTotal days in the duration
duration.hoursNumberTotal hours in the duration
duration.minutesNumberTotal minutes in the duration
duration.secondsNumberTotal seconds in the duration
duration.millisecondsNumberTotal milliseconds in the duration
Duration does not support .round(), .floor(), or .ceil() directly. You must first access a numeric field (such as .days), and then call number functions on the resulting number.
# ✅ CORRECT — access .days first, then round
"(now() - file.ctime).days.round(0)"

# ✅ CORRECT — access .hours first
"(now() - file.ctime).hours.round(0)"

# ❌ WRONG — Duration does not support .round() directly
"(now() - file.ctime).round(0)"

# ❌ WRONG — Duration does not support division
"((date(due) - today()) / 86400000).round(0)"

Date Arithmetic

Dates support addition and subtraction of duration strings. Subtracting two dates returns a Duration (see above).
# Add a duration string to a date
"date + \"1M\""           # Add 1 month
"date - \"2h\""           # Subtract 2 hours
"now() + \"1 day\""       # Tomorrow
"today() + \"7d\""        # A week from today

# Subtract dates — returns Duration type
"now() - file.ctime"                    # Returns Duration
"(now() - file.ctime).days"             # Get days as number
"(now() - file.ctime).hours"            # Get hours as number

# Complex duration arithmetic
"now() + (duration('1d') * 2)"
Duration unit abbreviations accepted in strings:
UnitAbbreviations
Yearsy, year, years
MonthsM, month, months
Weeksw, week, weeks
Daysd, day, days
Hoursh, hour, hours
Minutesm, minute, minutes
Secondss, second, seconds

String Functions

String values expose a length field and a suite of method functions. String field:
FieldTypeDescription
string.lengthNumberNumber of characters in the string
String functions:
FunctionSignatureDescription
contains()string.contains(value): booleanCheck whether the string contains a substring
containsAll()string.containsAll(...values): booleanCheck whether all substrings are present
containsAny()string.containsAny(...values): booleanCheck whether any substring is present
startsWith()string.startsWith(query): booleanCheck whether the string starts with the query
endsWith()string.endsWith(query): booleanCheck whether the string ends with the query
isEmpty()string.isEmpty(): booleanReturns true if the string is empty or not present
lower()string.lower(): stringConvert to lowercase
title()string.title(): stringConvert to Title Case
trim()string.trim(): stringRemove leading and trailing whitespace
replace()string.replace(pattern, replacement): stringReplace a pattern with a replacement string
repeat()string.repeat(count): stringRepeat the string a given number of times
reverse()string.reverse(): stringReverse the characters in the string
slice()string.slice(start, end?): stringExtract a substring by character index
split()string.split(separator, n?): listSplit the string into a list on a separator

Number Functions

FunctionSignatureDescription
abs()number.abs(): numberAbsolute value
ceil()number.ceil(): numberRound up to the nearest integer
floor()number.floor(): numberRound down to the nearest integer
round()number.round(digits?): numberRound to the specified number of decimal digits
toFixed()number.toFixed(precision): stringFormat in fixed-point notation as a string
isEmpty()number.isEmpty(): booleanReturns true if the number is not present

List Functions

List values expose a length field and a comprehensive set of method functions for querying and transforming lists. List field:
FieldTypeDescription
list.lengthNumberNumber of elements in the list
List functions:
FunctionSignatureDescription
contains()list.contains(value): booleanCheck whether the list contains the value
containsAll()list.containsAll(...values): booleanCheck whether all values are in the list
containsAny()list.containsAny(...values): booleanCheck whether any value is in the list
filter()list.filter(expression): listFilter elements by a boolean expression
map()list.map(expression): listTransform each element with an expression
reduce()list.reduce(expression, initial): anyReduce the list to a single value
flat()list.flat(): listFlatten a nested list of lists into a single list
join()list.join(separator): stringJoin all elements into a string with a separator
reverse()list.reverse(): listReverse the order of elements
slice()list.slice(start, end?): listExtract a sub-list by index
sort()list.sort(): listSort elements in ascending order
unique()list.unique(): listRemove duplicate elements
isEmpty()list.isEmpty(): booleanReturns true if the list has no elements
The list.filter(), list.map(), and list.reduce() functions use the special iteration variables value (the current element) and index (the zero-based position) inside the expression. list.reduce() additionally exposes acc for the accumulator.
# Filter to tags that start with "project/"
'file.tags.filter(value.startsWith("project/"))'

# Map to uppercase
'file.tags.map(value.title())'

# Reduce to a comma-separated string
'file.tags.reduce(acc + ", " + value, "")'

File Functions

These functions are called as methods on a file object — either the implicit file built-in for the current note, or a file object retrieved with the global file() function.
FunctionSignatureDescription
asLink()file.asLink(display?): LinkConvert the file to a link, with optional display text
hasLink()file.hasLink(otherFile): booleanReturns true if the file contains a link to the specified file
hasTag()file.hasTag(...tags): booleanReturns true if the file has any of the specified tags
hasProperty()file.hasProperty(name): booleanReturns true if the file’s frontmatter contains the property
inFolder()file.inFolder(folder): booleanReturns true if the file is in the specified folder or any subfolder
These functions are called on a Link value (created by link() or file.asLink()).
FunctionSignatureDescription
asFile()link.asFile(): fileGet the file object that the link points to
linksTo()link.linksTo(file): booleanReturns true if the link points to the specified file

Object Functions

These functions are called on object values, such as file.properties (all frontmatter as an object).
FunctionSignatureDescription
isEmpty()object.isEmpty(): booleanReturns true if the object has no properties
keys()object.keys(): listReturns a list of the object’s property names
values()object.values(): listReturns a list of the object’s property values

Regular Expression Functions

Regular expressions can be written inline using JavaScript regex literal syntax (/pattern/) and matched against strings.
FunctionSignatureDescription
matches()regexp.matches(string): booleanReturns true if the regex matches the string
# Match only files whose basename is a date (YYYY-MM-DD)
filters: '/^\d{4}-\d{2}-\d{2}$/.matches(file.basename)'

# Match files whose name contains a four-digit year
filters: '/\d{4}/.matches(file.name)'

Build docs developers (and LLMs) love